Succeeding with Agile, Brief Overview I

Couple months ago, I was promoted to a ScrumMaster role at DocuSign. In light of it, I decided to brush up on my agile development skills and theory by reading. My choice fell on the highly acclaimed Succeeding with Agile: Software Development Using Scrum by the guru of Agile Development and Scrum — Mike Cohn.

Succeeding with Agile
Succeeding with Agile

Here is a short overview of the first half of the book, or gist as programmers call it:

  • A ScrumMaster has more responsibility and authority over processes, but a limited authority over people; the role is akin to a fitness trainer (a yoga teacher analogy fits me better): enforcing the agile process.
  • Every sprint team needs to deliver shippable (and tested) code: features, bugs, etc.; if the task is too large — split it.
  • Developers should work with product managers/owners directly on requirements.
  • Different developers should work on all parts of the application / code base.
  • Agile is not for the developers who likes to work in privacy putting their headphone and not talking to people (Bummer). :-)
  • Team functions better with a mix of generalists and specialists; avoid all-specialists teams at all cost.
  • When possible use feature teams rather than component teams.
  • Keep teams small. Four to nine people is an optimal size due to the social loafing (having more people reduces average productivity) — this was one of the reason our DocuSign team was split into three smaller teams!
  • A non-coding architect and project manager are obsolete roles on a Scum team.
  • Don’t let team members multitask. Each additional task reduces productivity; however, after three and more tasks the reduction becomes smaller and smaller. Direct quote: “Individuals assigned to work on multiple projects inevitably get less done

To be continued…

What I really liked about the book so far is that it’s not just boring theory. Each point is supported by data, references to sources and personal three-decade-long (anecdotal) experience of the author (Mike Cohn). If you liked the bullet point above, get Kindle Succeeding with Agile on Amazon.

Programmers Are Assholes?

Right now, I’m lucky to work in a great team where everybody is a wonderful human being. However, during the years in software engineering, I’ve encountered a disproportionate number of assholes comparing to other fields or professions. Does coding affect someone’s personality negatively or it’s the other way around? Do computers attract certain asocial elements, so they can put on the headphones and not talk to people? Why there are more assholes in software engineering than in real estate or food&beverage?
Continue reading “Programmers Are Assholes?”

Invest in Yourself

In the modern society, it’s not enough anymore just to graduate from a four-year college, and hope the skills and education acquired there will get you through the next 30–40 years of professional life. This is very prominent in software and technology fields, but applicable to many other industries as well.

In the age of the information workers, just to stay competitive on the market place, we constantly need to re-invent or jobs and ourselves. However, not everybody is happy about it. I often find people who don’t read professional books, magazines, blogs, and don’t learn outside of the job duties. Wake up people!

It’s so easy. MOOCs and online courses like Udemy and CreativeLive provide affordable interactive education. Free online ebooks are everywhere. Pick up a new language like Node.js or build something cool with React.

It’s no surprise that tomorrow, these people might be the first to be left on the outskirts of professional world . And when this happens, whom they’ll blame?

Get Your Programming Questions Answered

If you have questions about programming and web development, we’re accepting them. Don’t suffer in the unknown!

Depending on the volume of received questions, we’ll be answering some of them on our blog and a future podcast.

Example topics:

  • What programming language should I learn?
  • How to land a dream job in software engineering?
  • What libraries should I use?
  • What is NoSQL?
  • What is Node.js?

Send your questions via the form: http://webapplog.com/about-azat-mardanov/.

Breaking Bad (Loops in JavaScript Libraries)

JavaScript Libraries are important (e.g., jQuery, Lo-Dash, Underscore), but in the case of asynchronous loops (`forEach` and `each`) they create a lot of confusion… Lo-Dash is not equal to Underscore, unless a special underscore-compatible version is being used.

It was sort of a surprise for me when I discovered inconsistencies in the most popular JavaScript libraries in how they handle their each and forEach loops. This post compares:

  • forEach Loop in Native JavaScript
  • each Loop in Lo-Dash
  • each Loop in jQuery
  • each Loop in Underscore.js
  • forEach Loop in Underscore.js

forEach Loop in Native JavaScript

JavaScript Libraries are important (e.g., jQuery, Lo-Dash, Underscore), but in the case of functional loops (forEach and each) they create a lot of confusion (for loop can be broken with ‘break’). Let’s inspect the example of native JavaScript code for the forEach method:

[1,2].forEach(function(v){
  alert(v);
  return false;
})

This will display us two alert boxes. Try the native JavaScript code yourself in JSFiddle.

This is an expected behavior in most cases because with each iteration we invoke a new function. Unlike the for (var i=0; i<arr.length; i++) {} code that has no function/iterators.

Continue reading “Breaking Bad (Loops in JavaScript Libraries)”

Understanding Fat Arrows (=>) in CoffeeScript

The fat arrows (=>) are special function expressions that confuse even the smartest of developers. Most JavaScript professionals know that closure changes the meaning of this (@ in CoffeeScript).

There’s no reason to be afraid of fat arrows in CoffeeScript. They are time savers (and clarity achievers) when it comes to the nested functions and jQuery event handlers. When they are applied to class methods, the good rule of thumb is: use => when we need @ to be the object in which method is written; use-> when we need @ to be the object in which method is executed.

The fat arrows (=>) are special function expressions that confuse even the smartest of developers. Most JavaScript professionals know that closure changes the meaning of this (@ in CoffeeScript).

Continue reading “Understanding Fat Arrows (=>) in CoffeeScript”

Q&A: ImageMagick and Code Organization in Express.js

We continue with the Q&A from our readers. This is a question from Ian, the reader of Rapid Prototyping with JS.

We continue with the Q&A from our readers. This is a question from Ian, the reader of Rapid Prototyping with JS.

Continue reading “Q&A: ImageMagick and Code Organization in Express.js”

Goodby MediaTemple and Hello WPEngine

This week I transferred webapplog.com from MediaTemple to WPEngine. MT was orders of magnitude better than my previous frugal shared hosting. Nevertheless, lately my weblog was choking on the days when the traffic was higher than 1,000 visitors. The transition was as easy as uploading SQL dump file and the wp-content folder. At the same time, I changed my nameservers which resulted in insonsistency and the slight downtime was cause by some kinks which WPEngine team was able to solve. However, so far the overall experience of WPE is pleasant and most importantly the speed is lightning fast!

No, WPEngine didn’t pay me credits to write this post. :-) Here is a coupon if you decide to switch: ARTOFBLOG.

This week I transferred webapplog.com from MediaTemple to WPEngine. MT was orders of magnitude better than my previous frugal shared hosting. Nevertheless, lately my weblog was choking (anywhere from 6–12s to load) on the days when the traffic was higher than 1,000 visitors. The transition was as easy as uploading SQL dump file and the wp-content folder. At the same time, I changed my nameservers which resulted in insonsistency and the slight downtime was cause by some kinks which WPEngine team was able to solve. However, so far the overall experience of WPE is pleasant and most importantly the speed is lightning fast!

No, WPEngine didn’t pay me credits to write this post. :-) Here is a coupon if you decide to switch: ARTOFBLOG.

Why You Should Not Work at a Startup

I have nothing against startups per se. I think they are great places for exceptionally bright individuals to work on ground breaking products. However, I think there are some misconceptions and myths about working at a startup, especially working in an early stage startup as a technical person, i.e., software engineer (or web developer, or coder, or programmer). Here is my list of reasons why someone should not work at a startup.

Continue reading “Why You Should Not Work at a Startup”

Q&A: Thank You Web App, Express.js and Emails

I recently received a question from Joanne Daudier. She is a up and coming web developer, middle term student at a JS/Node.js bootcamp called RefactorU and a reader of Express.js Guide. This is what she wrote:

Hi Azat:

I skimmed over your book today. I feel like it is a bit advanced for me since I’m just learning Express. I do have a few questions for you though.

I recently received a question from Joanne Daudier. She is an up and coming web developer, middle term student at a JS/Node.js bootcamp called RefactorU and a reader of Express.js Guide. This is what she wrote:

Continue reading “Q&A: Thank You Web App, Express.js and Emails”

Solving Programming Problems

Programming problems are not that much different from mathematics or physics problems. There are usually an input and an output to which someone needs to arrive by providing an algorithm. This algorithm is typically a function or series of functions.

Programming puzzles and toy problems are good exercises to sharpen skills and prepare for technical interviews. No wonder that more and more online coding schools (e.g., CodeAcademy) make those metal workouts main staple of their courses.

Beginner programmers might benefit by applying these steps to their process of solving a programming problem:

Programming problems are not that much different from mathematics or physics problems. There are usually an input and an output to which someone needs to arrive by providing an algorithm. This algorithm is typically a function or series of functions.

Programming puzzles and toy problems are good exercises to sharpen skills and prepare for technical interviews. No wonder that more and more online coding schools (e.g., CodeAcademy) make those metal workouts main staple of their courses.

Beginner programmers might benefit by applying these steps to their process of solving a programming problem:

Continue reading “Solving Programming Problems”

Markdown Web Publishing

TL;DR: Know and use Markdown because it’s fast and convenient.

Meet Markdown

“What is a Markdown?” my editor asked me the other day. She is an experienced content and copy editor and has worked for magazines and book publishers. However, she is not familiar with the powerful and convenient Markdown because it’s still a rather unknown approach to publishing except for an elite circle of early adopters and technology professionals. Even the so called re-invented web publishing experience Medium doesn’t support Markdown, but many other services and apps including my favorites (ByWord and LeanPub) build their whole flow around Markdown! In fact, I’m such a huge fan of Markdown that I’m writing my daily journals in it as well as this blog post.

Continue reading “Markdown Web Publishing”

Interview Hacks

About a year and a half ago I wrote a ranting post about same old boring technical interview questions. Those pesky hash tables, arrays and trees! Now it’s time to revisit the topic, and enhance it with some useful tips, tricks and insights (a.k.a., hacks) that I’ve observed over the years in software engineering.

Continue reading “Interview Hacks”

Not Everything has to be done Server-side

Here is a little JavaScript trick I did to randomly include LeanPub embed (e.g., like the one in the right sidebar

Here is a little JavaScript trick I did to randomly include LeanPub embed (e.g., like the one in the right sidebar).

Continue reading “Not Everything has to be done Server-side”

Nested Objects in Mongoose

There is a certain magic in ORMs like Mongoose. I learned it the hard way (as usual!), when I was trying to iterate over nested object’s properties…

There is a certain magic in ORMs like Mongoose. I learned it the hard way (as usual!), when I was trying to iterate over nested object’s properties. For example, here is a schema with a nested object features defines like this:

var User = module.exports = new Schema({
  features: { 
    realtime_updates: {
      type: Boolean
    },
    storylock: {
      type: Boolean
    },
    custom_embed_style: {
      type: Boolean
    },
    private_stories: {
      type: Boolean
    },
    headerless_embed:{
      type: Boolean
    }
};

Let’s say I want to overwrite object features_enabled with these properties:

if (this.features) { 
  for (var k in this.features) {
    features_enabled[k] = this.features[k];
  }
}
console.log(features_enabled)
return features_enabled;

Not so fast, I was getting a lot of system properties specific to Mongoose. Instead we need to use toObject(), e.g.:

if (this.features.toObject()) { 
  for (var k in this.features.toObject()) {
    console.log('!',k)
    features_enabled[k] = this.features.toObject()[k];
  }
}

Remember rule number one, computer is always right. If we think that it’s wrong — look up the rule number one. :-)

Git Reflog to Rescue after Hard Resets

On benefits of using Git reflog command

Today I was resetting a local Git repository to previous commits,, in order to trace back some changes which lead to Continious Integration tests failures. I did a few trail and error runs with:


git reset --hard SHA

Where SHA was taken from GitHub or git log. These commands were performed on my local branch which had some new changes commited locally, but not yet pushed to GitHub. Then, I found the working old commit I realized that I am stuck on it! There was a SHA for my latest commit and the command:


git log

wasn’t showing my latest commit either, because I moved the HEAD of the branch behind it. Thansk for an advice, this command saved me:


git reflog BRANCHNAME

It had a short SHA of my latest commit and I was able to reset HEAD back with reset. I knew that Git had my change save, but I wasn’t sure how to get them. As usual Git is a great technology… with a terrible user interface! :-)

Git reflog — a lifesaver!
Git reflog — a lifesaver!

More on git reflog:

Test-Driven Development in Node.js With Mocha

Don’t waste time writing tests for throwaway scripts, but please adapt the habit of Test-Driven Development for the main code base. With a little time spent in the beginning, you and your team will save time later and have confidence when rolling out new releases. Test Driven Development is a really really really good thing.

Who needs Test-Driven Development?

Imagine that you need to implement a complex feature on top of an existing interface, e.g., a ‘like’ button on a comment. Without tests you’ll have to manually create a user, log in, create a post, create a different user, log in with a different user and like the post. Tiresome? What if you’ll need to do it 10 or 20 times to find and fix some nasty bug? What if your feature breaks existing functionality, but you notice it 6 months after the release because there was no test!

Mocha: simple, flexible, fun
Mocha: simple, flexible, fun

Don’t waste time writing tests for throwaway scripts, but please adapt the habit of Test-Driven Development for the main code base. With a little time spent in the beginning, you and your team will save time later and have confidence when rolling out new releases. Test Driven Development is a really really really good thing.

Quick Start Guide

Follow this quick guide to set up your Test-Driven Development process in Node.js with Mocha.

Install Mocha globally by executing this command:

$ sudo npm install -g mocha

We’ll also use two libraries, Superagent and expect.js by LeanBoost. To install them fire up npm commands in your project folder like this:

$ npm install superagent
$ npm install expect.js   

Open a new file with .js extension and type:

var request = require('superagent');
var expect = require('expect.js');

So far we’ve included two libraries. The structure of the test suite going to look like this:

describe('Suite one', function(){
  it(function(done){
  ...
  });
  it(function(done){
  ...
  });
});
describe('Suite two', function(){
  it(function(done){
  ...
  });
});

Inside of this closure we can write request to our server which should be running at localhost:8080:

...
it (function(done){
  request.post('localhost:8080').end(function(res){
    //TODO check that response is okay
  });
});
...

Expect will give us handy functions to check any condition we can think of:

...
expect(res).to.exist;
expect(res.status).to.equal(200);
expect(res.body).to.contain('world');
...

Lastly, we need to add done() call to notify Mocha that asynchronous test has finished its work. And the full code of our first test looks like this:

var request = require('superagent');
var expect = require('expect.js');
  
describe('Suite one', function(){
 it (function(done){
   request.post('localhost:8080').end(function(res){
    expect(res).to.exist;
    expect(res.status).to.equal(200);
    expect(res.body).to.contain('world');
    done();
   });
  });
});

If we want to get fancy, we can add before and beforeEach hooks which will, according to their names, execute once before the test (or suite) or each time before the test (or suite):

before(function(){
  //TODO seed the database
});
describe('suite one ',function(){
  beforeEach(function(){
    //todo log in test user
  });
  it('test one', function(done){
  ...
  });
});

Note that before and beforeEach can be placed inside or outside of describe construction.

To run our test simply execute:

$ mocha test.js

To use different report type:

$ mocha test.js -R list
$ mocha test.js -R spec

Home and End Shortcuts in Terminal

I like my shortcuts to be consistent across the most used applications: Chrome, Sublime Text 2 and iTerm. This way I don’t have to think about what application I’m in, and I can just hit the buttons.

TL;DR

Here are the shortcuts that will work in Terminal app.

Home: control + A

End: control + E

Next Word: esc, then f

Previous word: esc, then b

Why Bother

I like my shortcuts to be consistent across the most used applications: Chrome, Sublime Text 2 and iTerm. This way I don’t have to think about what application I’m in, and I can just hit the buttons.

I’ve set tab switch to option+command+left and option+command+right, home to command+left, and end to command+right and previous word to option+left, and next word to option+right. These shortcuts for the most part mimic the default behavior in Sublime Text 2 and other editors.

iTerm

iTerm is a better alternative to Terminal app on Mac OS X. You can get it at iterm2.com.

Home and End Shortcuts in iTerm
Home and End Shortcuts in iTerm

Go to your iTerm and open preferences from the menu (iTerm-> Preferences) or by using command + , or ⌘ + , shortcuts. Open Profiles tab and click on Keys for the Default profile.

To set home — that is, to jump to the beginning of a line — press command+left and then select ‘Send Hex Code’ and enter value 001.

Repeat the same thing for end substituting shortcut with command+right and hex with 005.

To set up previous word shortcut, press down option+left and then select ‘Send Escape Sequence’ and enter b. For the next word option+right shortcut, enter f.

Related posts:

I don’t know why Terminal and iTerm by default have broken shortcuts. Maybe there is some history to it, but it seems like I’m not the only person who has encountered (and/or fixed) the issue: