Thursday, September 24, 2015

Immediately-Invoked Function Expression : what and why?

I remember I was confused by the syntax of Immediately-Invoked Function Expression in my early days with JavaScript. I'll follow DRY principle in this blog post and shall point to the articles that I found most helpful when I learned this.

The definitive explanation with very good examples can be found in Ben Alman's blog post. He actually coined the term IIFE which was widely adopted later in JavaScript community.

Why and when to use IIFE? 2 cases are recurring:
1) create private namespace: We can create private functions and properties and can expose only those members intended to be public. This helps us not to pollute global namespace. Vivin Paliath explained this really well on stackoverflow.

2) resolve global variable conflict: Josh Mock gave a good example of this.

Monday, September 21, 2015

Skills of a full stack developer

I had the following questions:
  1. What is the standard definition or scope of full stack developer?
  2. What does that 'full stack' look like actually?
  3. Why do employers seek full stack developer instead of developers specializing in particular aspects?
  4. What are the skills a full stack developer bring to the table?
  5. How to become a full stack developer? Is there any road map?

So I googled and read blog posts and articles. Here's my findings:

1. What is the standard definition or scope of full stack developer?

There is no acceptable definition yet. Some people have tried to define it in a logical way; some called it meaningless with valid arguments. Facebook engineer Carlos Bueno defined full stack developer as a generalist with a broad range of skills. Mike Loukides echoed the same idea - "Full-stack development is about exposing yourself to a broad range of ideas". The general impression that I got after reading several other articles is that it's a term being used to mean engineers or developers who is capable of working in any layer of the whole stack (usually web stack).


2. What does that 'full stack' look like actually?

The first bottleneck of defining a full stack developer is coming up with a good idea of the stack itself. Scott Hadfield presented a non-exhaustive list of layers that contains from hardware, OS, hosting, scaling to frameworks, front-end dev, security, business requirements. Edward Chung gave a list of roles/jobs needed to build a web application, ranging from web designer to web analyst, quality assurance tester.

Whenever we hear 'full stack', we usually think of LAMP, WAMP, or MEAN stack. What is obvious now is that these acronym-style stacks are just the tip of the iceberg or we can say the beginning of a long yet fun and rewarding journey.


3. Why do employers seek full stack developer instead of developers specializing in particular aspects?

The main reason for hiring 'jack of all trades' is speed and the economic benefit that follows. When a company wants to build a prototype or a MVP (Minimum Viable Product), a full stack developer is very handy. Because (s)he can understand and work in all layers of the application. This essentially eliminates the overhead of communication, for instance, between UI designer, front end developer, back end developer, database developer and database administrator, DevOps engineer. In an Agile environment, a full stack developer can focus on a complete end-to-end feature.

4. What are the skills a full stack developer bring to the table?

Jack of all trades, master of a few. In my opinion, that's a reasonable expectation. We no longer can afford to remain in a silo and to become a true master of one thing but almost ignorant of others. A full stack developer is able to grasp the big picture - the whole stack - and working across the layers and whenever help is needed, (s)he is able to communicate the problem effectively to an expert in the team. The 'value proposition' of full stack developer is versatility.

5. How to become a full stack developer? Is there any road map?

This is subjective. The answer also depends on the background (web designer vs. web developer) of an aspiring full stack developer. The following is the start of one of many possible road maps:

JavaScript-based platforms and frameworks are extremely in demand now. So this road map assumes that we want to be proficient in JavaScript-based full stack.

  1. Decide on a project idea that you are very motivated to see coming into life. Write down the detailed requirements. Create 'user stories'. Go through the requirements again and again so that you have a good idea of what you're going to get. If you don't have any idea, just google for project idea.
  2. Learn the basics of language first. As you work more and more in that language, you will learn details about the different features the language provides. It is not a good idea to target being a master in the first step. Just get comfortable using the language.
  3. Pick a popular front end framework or library. I wasted a lot of time trying to figure out THE ONE. Like all programming languages, frameworks and libraries have strengths and weaknesses. AngularJS is a very popular and established framework now. Let's start with this. The experience gained while working with one framework/library will definitely help you pick another one very fast. Do a few tutorials of AngularJS. Then implement the client-side functionalities of your project.
  4. Pick a back end framework or library. Node.js is the most popular JavaScritp based platform. Pick a popular Node.js-based framework or library. Following MEAN stack, you can choose Express framework. (By the way, the number of JavaScript-based libraries and frameworks will soon outnumber the population of the world. So don't spend too much time to choose the 'best' like I did.) Do a few tutorials of Express. Then implement the server-side functionalities of your project. It's okay if data is hard-coded for now. Expose your server-side capabilities as APIs. Modify client-side to consume those APIs.
  5. Pick a database. A full stack developer should be very knowledgeable about the trade-offs of relational vs non-relational (NoSQL) databases and must know when to use which. For now, just pick MongoDB. Learn the basics, design your data collections and attributes. Do a few tutorials of Mongoose and know how what it is useful for. Finally implement the integration of your server-side code with DB. You should be careful about how you keep the DB interaction logic and business logic separate in your code base.
  6. Now it's time for deployment. You can use cloud infrastructure provider. In that case, learn about docker, do a few tutorials and write dockerfile for your client, server and DB containers. You can use docker-compose (successor of Fig). Alternatively, you can use PaaS, for example, Heroku or Pivotal (Cloud Foundry). Learn how to use them.
  7. Now start broadening your knowledge about trade-offs involved in design decisions. In addition to that, increase your familiarity with different available libraries and frameworks. Let's start with front end. What are the other popular alternatives? Pick one by one. Do a few tutorials. Re-implement your client-side with that library or framework. What kind of client-side needs is this suitable for? Do the same things for back end.
  8. Regarding databases, know about different data models of NoSQL databases (key-value, column, document, graph) and the trade-offs (performance, scalability, flexibility, complexity). Which one will be the most appropriate for your project when you have millions of hits per hour? Moreover, in which cases relational databases are the most appropriate ones?
  9. Eventually the back end can be a distributed application communicating through messaging. How can you decompose your back end application into small independent applications so that you can scale in a more refined manner? This is where polyglot programmers come in handy. For instance, you can implement a CPU-intensive part of your distributed application in Go.

I would appreciate your suggestions regarding the possible road maps for being a full stack developer.