Being a software developer is not easy. When I say it’s not easy, I do not only mean its technically challenging, but its also emotionally challenging.

We as a developer can get attached to our code. We write it while our mind thought of creative ways to solve complex problems. The solutions we have are like our brainchild. However we work in a world that is constantly changing. Change happens around us and its inevitable. You can do scrum, mocks, freeze the product specification but a change will always happen and it can happen to an extent that the code you have written for a problem would not be applicable anymore. As far as that product is concerned, you may as well trash that code.

Despite of all that, I am here to tell you that its okay. It’s okay to throw your code and write it again. Yes it requires time and it’s not always justified but every creative challenge you have solved while writing that code has made you a better developer already. It may not do the product any good anymore, but it has already done good to you.

Every time you discover a new or a better way to do something it makes the previous method obsolete. Developers would often create something and keep throwing away/updating their code until they are satisfied with its performance, neatness and efficiency. The earlier in your developing career you learn, that its okay to throw the code and write it again, the more happy you will be working as a developer.

I have had plenty of encounters where I had to throw away the code and write it again, but every time you come back to a problem after a while, you have a fresh point of view and possibly a different approach, which can be efficient and better than the previous approach. Even if its not efficient than the previous one, its definitely neat and organized than previous one. It’s because you have already solved the problem once.

Therefore my friends, if you find yourself in a situation where you probably have to trash your code – archive it, and if you happen to write it again, compare the archive with the newly written code. You will probably find that you have gotten better.

Javascript has some weird stuff built into it and sometimes when used in conjunction with other languages, it is easier to forget the corner cases that can come with javascript coding.

Here I compile the list checks, that every developer working in javascript should know, so that there are no accidental bugs and also sometimes these can be use to our advantage

Equal operator comparison

Double Equals

Comparison

Result

null == null

true

null == undefined

true

null == 0

false

null == ” (empty string)

false

null == NaN

false

null == ‘2’

false

null == 2

false

undefined == null

true

undefined == undefined

true

undefined == 0

false

undefined == ” (empty string)

false

undefined == NaN

false

undefined == ‘2’

false

undefined == 2

false

0 == null

false

0 == undefined

false

0 == 0

true

0 == ” (empty string)

true

0 == NaN

false

0 == ‘2’

false

0 == 2

false

” (empty string) == null

false

” (empty string) == undefined

false

” (empty string) == 0

true

” (empty string) == ” (empty string)

true

” (empty string) == NaN

false

” (empty string) == ‘2’

false

” (empty string) == 2

false

NaN == null

false

NaN == undefined

false

NaN == 0

false

NaN == ” (empty string)

false

NaN == NaN

false

NaN == ‘2’

false

NaN == 2

false

‘2’ == null

false

‘2’ == undefined

false

‘2’ == 0

false

‘2’ == ” (empty string)

false

‘2’ == NaN

false

‘2’ == ‘2’

true

‘2’ == 2

true

2 == null

false

2 == undefined

false

2 == 0

false

2 == ” (empty string)

false

2 == NaN

false

2 == ‘2’

true

2 == 2

true

Double equals is not the same as triple equals when it comes to javascript. Notice that some things are unexpectedly true example 0 == “” is true when only compared with double equals vs its false when compared with triple equals. Double equals can somehow be helpful when you want to check if the value is either null or undefined you can quickly just do if(val == null) instead of if(val == null || val == undefined). Also notice that double equals does not check for the data type behind the comparator, example 2 == ‘2’ is true but not true in triple equals.

Triple Equals

Comparison

Result

null === null

true

null === undefined

false

null === 0

false

null === ” (empty string)

false

null === NaN

false

null === ‘2’

false

null === 2

false

undefined === null

false

undefined === undefined

true

undefined === 0

false

undefined === ” (empty string)

false

undefined === NaN

false

undefined === ‘2’

false

undefined === 2

false

0 === null

false

0 === undefined

false

0 === 0

true

0 === ” (empty string)

false

0 === NaN

false

0 === ‘2’

false

0 === 2

false

” (empty string) === null

false

” (empty string) === undefined

false

” (empty string) === 0

false

” (empty string) === ” (empty string)

true

” (empty string) === NaN

false

” (empty string) === ‘2’

false

” (empty string) === 2

false

NaN === null

false

NaN === undefined

false

NaN === 0

false

NaN === ” (empty string)

false

NaN === NaN

false

NaN === ‘2’

false

NaN === 2

false

‘2’ === null

false

‘2’ === undefined

false

‘2’ === 0

false

‘2’ === ” (empty string)

false

‘2’ === NaN

false

‘2’ === ‘2’

true

‘2’ === 2

false

2 === null

false

2 === undefined

false

2 === 0

false

2 === ” (empty string)

false

2 === NaN

false

2 === ‘2’

false

2 === 2

true

Triple equals is much tighter comparison in javascript, it also checks the data type example see that 2 === ‘2’ is false while its true in double equals

Or (||) operator comparison

Comparison

Result

null || null

null

null || undefined

undefined

null || 0

0

null || ” (empty string)

” (empty string)

null || NaN

NaN

null || ‘2’

2

null || 2

2

undefined || null

null

undefined || undefined

undefined

undefined || 0

0

undefined || ” (empty string)

” (empty string)

undefined || NaN

NaN

undefined || ‘2’

2

undefined || 2

2

0 || null

null

0 || undefined

undefined

0 || 0

0

0 || ” (empty string)

” (empty string)

0 || NaN

NaN

0 || ‘2’

2

0 || 2

2

” (empty string) || null

null

” (empty string) || undefined

undefined

” (empty string) || 0

0

” (empty string) || ” (empty string)

” (empty string)

” (empty string) || NaN

NaN

” (empty string) || ‘2’

2

” (empty string) || 2

2

NaN || null

null

NaN || undefined

undefined

NaN || 0

0

NaN || ” (empty string)

” (empty string)

NaN || NaN

NaN

NaN || ‘2’

‘2’

NaN || 2

2

‘2’ || null

‘2’

‘2’ || undefined

‘2’

‘2’ || 0

‘2’

‘2’ || ” (empty string)

‘2’

‘2’ || NaN

‘2’

‘2’ || ‘2’

‘2’

‘2’ || 2

‘2’

2 || null

2

2 || undefined

2

2 || 0

2

2 || ” (empty string)

2

2 || NaN

2

2 || ‘2’

2

2 || 2

2

This works like standard || or operator, if the value of the first comparator does not equals to true it will select the other value. See section truthy value for which values return false when asked for boolean value.

Truthy value

Comparision

Result

if ( null )

false

if ( undefined )

false

if ( 0 )

false

if ( ” (empty string) )

false

if ( NaN )

false

if ( ‘2’ )

true

if ( 2 )

true

Hopefully this can help someone have a reference check on what javascript does on == , === and || operators.

Let me know in comments..

PS: I originally created this post in jsfiddle here (http://jsfiddle.net/bsurela/13gdvom5/)

This post is just dedicated to check out http://bhavinsurela.com/color-generator/, a simple random color generation that i created. This is no rocket science but its fun to drag and drop colors around each other and to see them create different colors.

It works best in Chrome and uses drag and drop of HTML5 and also uses local storage. This is just a gig and some couple of hours of work, but I still hope it will be used somewhere.

Happy new year folks. I hope you had a fantastic year and plan to have a great 2015.

I am going to start 2015 with a simple naive trick. I am sure there are other good ways and things out in the wild to achieve similar results.

I was visiting a site for holiday shopping and I notice tons and tons of console logs. I assumed that the site was in debugging mode and had lot of console prints. It got me thinking that what would be the easiest way to get rid of those console logs in production while still keep them in debugging/developing mode. Of course assuming that they have no prior built-in switches for that.

I opened up my fiddle and here is what I came with, It works well and pretty easy to use. Its a simple logger. It uses domain name array which is the array of all the domains in which the console.log should be hidden (example, production domain). It has a force switch which allows you to still print logs in production (in case you are working like me where your end users are in the same room). This is a bare-bone structure to give you the idea – it can obviously be tweaked according to one’s need.

Here is the embedded fiddle

With this, all the console log disappear from production while still appear in everyones local.
Hope this helps someone.

Every machine evolves over time and gets to a point where it needs to be replaced or enhanced to fit new and changing needs. There are very less things that are sustainable to change. Software Applications are no different.

As time progresses, as new technology arrives, new ways of doing things become the “norm”, things that were developed years ago start to age, appear old and tacky and calls for migration to the new system.

However migration is not always easy, not always necessary. Biting the bullet of migration is also a challenging task and there are certain things that need to be carefully determined before we jump in migration.

Still reading? Lets take a look at what things we should consider before jumping to migration.

Current System

Life of a software as it is

As we just discussed, software application have an expiry date and though they are kind of working and get some work done, they tend to be replaced with a newer better version of it, specially when new technology comes often. Applications that are end user exposed example, website, mobile and desktop apps tend to expire more early then those backend applications, just because as new user experience techniques comes in to market, the old and not upgraded systems look outdated and are prone to loose business and are not appealing to the user.

So how do we determine if an application is aged and needs to be replaced?

Here are the hints

Team spends more time patching things rather than building on it

The underlying technology is so old, that we have limited support for it.

User complains / User experience becomes unpleasant

The application does things inefficiently than the competitor just because of its underlying technology.

etc.

Obviously this is not a complete list but should give us the idea that we should start thinking about migrating our system to a better one.

Development to Usability Ratio

While all of the above still holds true, we should not rush to migration. One of they key point is development to usability ratio. The complexity of migration of an application is directly proportional to its usability. The higher the usability, the longer, complex and difficult the migration. Why? Because there is less window of error, more user adaptability etc. Getting back to the point, example if an application is developed for something that is only used by a certain people, its working fine, there are no scalability chances, and the audience (the end user) are perfectly happy, applications like those do not need to be migrated versus an application that is used by thousands or millions of people then chances are over time we will start to see the above mentioned issues (in life of software as it is) and at that time migration becomes inevitable.

Understanding the system. Deeply

Among other things, we also need to understand the existing system deeply. No migration can be successful without understanding what the current system does and how. Only after once we understand the current application properly, then only successful migration can be planned. This plays similar role as requirements play in new software development, improper requirements lead to improper development and similarly not understanding what we are migrating and why, may lead to incorrect choices and inefficient migration

Benefits of the old system. Yes there are benefits

You might say that, when we are thinking about the migration, how can that application still deliver benefits. Yes it can and it does. The application was developed for a reason and chances are it is still doing some things correctly which are crucial to the system those things are the reason that application lasted till today. One should highly recognize it, understand it and should be ready to enhance or at least equate those things after migration.

Value of trained clients.

This goes back to development to usability ratio and this mostly falls under end user exposed applications. Since the application is used for a long time and the fact that it still exists probably means that you have some people that are using and know their way around the application well. No matter you don’t like the experience that they get when they navigate around, but they can and they still get some work done because of existing application. When we plan to undergo migration, those people should be highly valuable. The application is for your clients and should revolve around how its best for them to use it, changing it drastically will impact lot of people, example, Bad examples: Microsoft Windows, Evernote, Good examples: Gmail, slick deals etc.

New system

Motivation evaluation

Migration is a high impact change. However before migration we should analyze the correct reasons behind it. What persuades us to do the migration? One must answer this question before planning a new system. Is because we are doing more support then development? Is it because we look and appear outdated in front of our competitors? Is it because there is a better technology out there that can do the work we do currently, efficiently? Is it because we have a team that is more profound in a different tech/way of doing things? There can be numerous motivations behind migration and we should examine and identify those carefully so we can take right decisions when performing the migration.

Proposals and what does it solve?

After we have evaluated the motivation, its time about proposals, we should evaluate various proposals on migrations, explore different things and ways to do it. Time spent there can be long or short but one should definitely give it enough thought so that when you are in mid-way of the migration, there should be no moments like “Oh we should have done it this way.” Brainstorm, sleep over the solutions, and more importantly, should answer what does it solve? Does it stand behind the motivation that started this whole thing? Does it do anything extra? Does it take away anything? These are key questions and one should definitely think about it.

Try and foresee life

This one is the toughest and not always correct. However, sometimes there is a lot of effort going into this and there is probably a business model around the application, when we try and foresee life of an application, we should consider market trends, consider support life for the technology we plan to use in our proposals, foresee business requirement, product landscape, changing that might lead to migration. The reason we want to have some hint about it is because we want to compare our effort versus benefit.

Effort versus Benefit

Migration of a system to a new one is a big effort not to mention its a high impact change. Migration is not always the best solution and after we have recognized the problems, the motivation behind it, the proposals and have decent idea about the new systems life, we should always also compare the effort related to it with benefits. Are the efforts to be done justified? And we should hear it from more than one team example, something that may be more effort and less value to development team but can be of a high value to finance and accounts team etc. Overall for a product, are the efforts put up together to migrate to a new system should be well justified and well known. One can also not expect the migrated system to replace the old system which has been running for 25 years, point blank perfect the first time nor its going to be built in 3 months. Only when this is well known and established one should think about going forward with migration.

Client training versus user experience

One thing that is easy to miss is effort vs benefit is value of trained client as we discussed above and there change to the user experience. This also applies only to end user exposed applications but, one can be surprised how upset the new users can be when one changes / or take it away peoples favorite thing, remember the start button in windows 8? It can take a lot of effort when we try to find the right balance between our trained clients and perspective new users (who will probably expect the application to have the latest and greatest user experience). Be wise to consider and include those effort when do our comparison of effort and benefits.

Product Vision

Product Vision plays a crucial role when we make any changes to our application and when we develop any features in our application. We have said enough that migration is a pretty big and high impact change. It’s going to use a lot of resources and will take time. While we do this, we should make sure we do not divert from our product vision, the end goal mission and future features that are supposed to come in our application at a later stage. A good way to evaluate this, is to think about a product some years from now from company’s/product managers point of view and make sure that the new proposed system will fit in just fine. As a matter of fact it should be even more supportive of upcoming features.

We should evaluate and make sure that the vision the stake owners have for the entire product will not be disturbed by this new high impact change. We should evaluate the benefits of old system and benefits of new system and rank them against the product vision and make sure the change we are making is for the better.

Example if a product vision is to go native apps for desktop and mobile devices it might worth the effort to migrate the website but we should definitely consider migrating the back-end to a more restful architecture to support multiple clients.

Team

Team is as important as product. Whether you are a one-man army or a group of incredible people, team evaluation is must when going such a crucial change. Evaluation of the team against current system and new system is a must do. Chances are that your team is highly skilled in current technology stack and therefore can provide great support and quick development, but not so adept in new proposed technology stack. This is not bad but it may take team members to adapt /learn and go get better in it as they are in any other technology. This is added effort and should be known across the team. You do not want to end up in a system where one or two person know the most about it and others are clueless.

Decision Factors

So we have spent time and resources to evaluate the need for migration, the proposal of how to do the migration, the product vision, the team. We should be all set for migration right? Wrong. We still have some things to decide before we get to the migration. Cost is always an important point in every application. Does the migration in any way have more costs then previous? Are those costs justified? The answers to this may be quick but one should at least have it covered before jumping in the migration. The other factor is support to the current system. This is most challenging in small teams and migration is tough since the support for current system is dependent on the same team that is working on migration. These should be carefully examined before starting any migration project.

After deciding, “Yes” to migration.

Ok now you have carefully considered all the factors that we need to for a migration we need to decide how we are going to do it, is it something that needs to be done in full or in parts, they both have some things to worry about, If we go with full fledged migration, the correct time estimation is hard. If we go with partial than we should think about will our clients be able to accept the partial system? User acceptance is not easy with a partial system, no matter how great that partial system is.

One way to ease this is to apply the 80-20 rule when going in partial system, so we get done 20% of functionality that is used 80% of the time. If we are going full development, we should make sure, everyone understands that the deadline needs to be realistically flexible.

After Effect

So what happens after migration, or even in process of migration when we decided yes to migration? Team training happens, each team player who is playing significant role in migration is bound to find something new, that is interesting or scary. Team players are bound to undergo adaption of new technology, software, means of coding etc.. Continuous refactoring happens, when we develop something with new technology, its not always “the best” at the first time, as people learn about it, they find new and interesting ways to do it, but its important to go back and refactor the old code to new beautiful, easy, simple to understand code.

Conclusion

So overall, migration is hard, but doable, we should think about all of this when undergoing or planning migration so that we can take well informed decisions. It should not be scary; it’s nothing less than a project in itself. Share away your thoughts in comments…

I am in general an aggressive (aggressive in getting my work done) software developer. I want to get things done as they come. I do not like a TODO items sitting around even though its small. This means working fast, taking quick decisions, using fail fast methods. It also includes continuous education to yourself from team members and web, educating team members, know the latest and greatest tools avail at your disposal and sometimes running an extra mile for team / organization.

I have had a privilege here at my job for being in the team that builds a continuously evolving website for almost half of the company. These people use this website as their day to day job. All the business that comes in, get entered in our system from this website.

That’s right. I work with my end users sitting 10 feet away from me.

We all know how its like to build a software and demo it to the client. This means often times there is criticizing, change in priority, new requests and more new requests. Sometimes on a good day, there is appreciation and respect.

With all this going on release after release, there can be a point where you can feel “This is what they ask for, that’s all they get”. Times when you know that the ask is not the best thing to do and there might be some other solution, but we keep mum because we are afraid of making the change. I have had these moments. You have had these moments. Everyone who dealt with a real end-user have had these moments. All these moments hinder motivation and our strive to innovation.

What we should (and our end users should) realize

They are not developers.

Developers tend to best understand another developers professional challenges. While something that appear challenging to end user might not be challenging for developers and what may not appear challenging to end users, might be challenging to developers.

Everyone is on the same side.

Everyone is working on a vision of a better product. Period. If you think this is not true in your case, then there are bigger problems.

Communication is the key.

Communicate, in your team, to end users and try and explain what you think is best and why. Paint the bigger picture. You may not always be right, but hey you may not always be wrong.

While it might not look that way, getting things done is sometimes hard in these circumstances. Here is what I try to do and recommend.

While it might not look that way, getting things done is sometimes hard in these circumstances. Here is what I try to do and recommend.

Have a vision of end product and work towards that

Without proper vision, nothing will go in one direction, Aim and develop.

Have a TODO list of what needs to be done. Every day.

goes without saying, organizing things is more productive

Think and design as much as possible before development.

You will always miss something. Its okay.

Update the design as things change.

Prototype key features / changes to my end users

Best way to avoid bad surprises at the time of demo and to keep everyone in the loop.

Share new ideas among team.

Brainstorming ideas with team members always helps, builds team.

Ask yourself, How can this be better?

Everything can be made better, its just the matter of how and when?

When you ask these things to yourself, the good software developer inside you will force you to do things the better way.

Take pride in your work

If you don’t take pride in your work, no one will.

Praise yourself and others on their hard work.

If you don’t praise yourself and your team, no one else will.

Obviously there can be more to it…

Do you work along side your end users? Be proud about it.

What do you do to make sure you are at your best everyday? Share in comments.

Developers are usually problem solvers, we solve problems and once we solve the core of it we have a tendency to call it done. However completing the rest of it, the finishing touches takes a looong time.
The 99% complete syndrome is a documented fact that aligns well with software development and developers.

I have noticed this in many people and not all are developers. Once they solve the hard part, rest of them is unexciting/boring/tiring to them. Do not get me wrong, that remaining part is also as equally important in a process of making a thing complete, but the drive is usually gone. I am guilty of this too, once I am done solving that’s challenging, solving that was new and interesting, the drive, the motivation slightly decreases.
Why is that? How do you stay motivated and driven to complete it completely?

This can really happen if you are working on a side gig, Once a thing is 99% complete and 1% incomplete.
Deep inside my heart, I wish that was it. I know it is not and I know I will eventually do the rest of it, but when is that eventually going to come? I do not know.
I also noticed that, if you are working in an office or a product driven by other people you may still have this feeling but then there is someone at your shoulders waiting for it to be completely complete and so you complete it. There you go, nagging works

I do not want to include everyone here, I know developers who will completely complete the product before saying its DONE, done whether its office or a project they do in their garage. I am proud of those guys and one can really learn from those guys. I hope you have seen or met some of these guys around you too.
Its good to have them around.

Here is what I do to keep me going on my side gigs in those times,

Try and set deadlines, real deadlines, the one that goes on the calendar.

Share deadlines with your close ones who keep you motivated.

Demo the product to people who can be nit picky.

Being nit picky is good. It leads you to become a perfectionist.,which is good. Most times.

If you have a TODO list, DO NOT check the item until is completely complete.

If you do not have it, have one. TODAY.

Credit yourself after completely completing it.

What do you do to stay motivated and driven after 99% completeness? I would love to hear

It’s been a while since I have made a post, I have a lot to write but I have been bit busy with work, family, friends and some side projects. Today I want to dedicate this post to “Interviewing“.

In my new job I have been given an opportunity to interview people for various roles. Not sure about you, but I still have memories of my interviews (all good and bad, stupid and smart) and therefore I know what it’s like to give a technical interview for a job and now I know what it’s like to take one. I feel I shall share my early experience with you. I have not counted them all but I have taken some tech interviews till now and overall I feel, I have collected some knowledge that I can share with you guys.

While all this is good and I feel esteemed to do so, It’s also bit of a concern, specially when I know that the person I am interviewing has twice the experience I have and sometimes is going to be designated a role higher than me. I mean, what do you ask a candidate like that? Are my questions going to be too easy for them? And this sometimes apply to guys whose resume and projects looks outstanding. So after some early experience for me It turns out that it does not matter. If your questions are reasonably sound and tests basic knowledge, you can test the deverloper/problem solver in them. I have had people from fortune 500 companies do massive blunders when they write code on board and yes I have had people write error free compilable code on white board for the same questions. No, the questions were not given from “Crack the coding interview” or similar :). Sometimes I see someone making mistakes that I made or may be still make and sometimes I see a totally different approach that I didn’t thought of and it gladly surprises me. I have also had some bad interviewers interview me and I try not to be one myself during the interview.

The point is, If in your job, you are trusted to interview some one, feel proud, feel glad that you are given an opportunity like that but prepare/spend some time thinking about your questions and knowing about the person. In an interview you sort of are the representative of the company to that person, It becomes your duty to give the best of yourself, they do not know the company yet, but your approximate forty five minutes with them can give a general sense of type of people working in your company.

In all, I feel every developer should get a chance to interview other people in course of their career, Doing it the right way can give you insights about your mistakes in the interview and it also gives you a chance to represent the name on the door that you walk in every morning, five days a week.

2013 passed in blink of an eye and it was an amazing year for me. 2014 on the other hand brings so many new things in life. Before I go on about 2014, I would like to mention a few highlights about 2013.

Of Course the highlight of 2013 was that I got married to my girl friend and had an awesome time with family in India, but on the other hand I left Polaris Library Systems and snowy Syracuse, NY in Nov’13 and moved to sunny Mountain View, CA to work for a company called Adara Media.

2014, brings new challenges to me personally and professionally. Professionally- being a .Net nerd for so long, now I have decided to work in a “non windows” environment here in CA where I will be doing Java, MySql on a Mac instead of working with .Net, Sql Server, on Windows machine. This is not only just a technology change for me but an idea to widen my scope of technology that I can grasp and make better software on. Why did I do that? The heart wants what the heart wants…

Personally- Leaving Syracuse wasn’t easy, I have lived there for 4 years, had my masters there and worked in a company with awesome people making awesome software, It will always be a part of my life and in 2014 I will do my best to make this new place my new home.