Test or Regret!

Yes, for god sake test! Whoever you are, a web/desktop/mobile developer please add automated tests to your work. If you don’t then your works is questionable.
Why? That’s what I’m going to answer in the next few lines.


Were you in the case where you or a new developer joined a team? Were you in the case where you got to work on a legacy code? Were you in the case where you forgot what your own code was doing?
All the above scenarios are normal during your lifetime as a developer or a team lead. All of them have a common shared thing: What is this code doing? and where to start?
Adding automated tests to the project code base, where a test case refers to a real world scenario that the code has to deal with, is the ideal answer for the questions above.
When you add a test scenario, then technically you are adding a new spec on how the code should behave in that scenario. When you add automated tests for some module, then referring to these tests is the first thing you can do to understand how/what this module is doing and behaving in different cases.
The bottom line is that automated tests are your project specs.

Clean Code

A test usually checks the output/behavior of some method. Once you start testing you will find yourself in need to restructure your code in a way that you can test it. Technically, you will make sure the method is doing one thing and one thing only. One thing that can be tested like this: given some input x, the method should have some output y. Following this pattern(which technically you will be forced to when doing automated testing) will lead to a clean code, a code that doesn’t mix responsibilities and thus become harder to be read, updated and maintained.

Code Quality

New features will come, you have to update/refactor the code and then go and do some human tests to make sure everything you developed ever will work. This is called Regression Testing, test to make sure you didn’t break old code. Doing regression testing yourself is a natural thing and it will continue to be like that till your code base starts to evolve and evolve till you reach a level where doing a small fix in the code will make you scared to death before releasing since you have to do tens of human tests to make sure you didn’t break anything. Of course this will get worse if you are modifying others code. You simply(and really simply) can overcome this regression testing routine if you have a test suite for your code base that you can fire after whatever change you do to check what code is broken and what’s needed to be fixed. This will produce a robust code. Not only that, actually it will increase the code quality since whatever bug you have at some phase of the project, will be fixed and the fix will have an associated test scenario that will be added to the test suite. Next time when you update the code, the test suite will test that bug scenario to make sure you didn’t reproduce it again.

Agile Development

Most of the time you will have new requested features, or new discovered bugs. You have to add/fix whatever needed. Doing the changes and then doing human testing will consume your time and thus will slow down the project development and progress, and so will prevent it from iterating quickly. Having a test suite will save the time, and will complete the chain of Design, Test and Refactor methodology that Agile development poses. Actually some of you might think that adding automated tests will slow down the progress of development, which is wrong, very wrong. As a start it might slow it down, but after that it will save your time specially once your project starts to iterate with new features or bug fixing.


Test or you’ll regret! and if you want to do it, then do it right. I advice you to check Behavior Driven Development(BDD), a methodology of development that’s based on testing the behavior of your code.

2011 and I’m back!


It has been long time since I opened this page to write something. Actually 2010 was a very busy year. I left ArabCrunch team to join Inquiro, a cool startup focusing on SEO/SEM optimization, where my work completely took a different path and a whole shift. I became a team lead for a cool project using Python/Django stuff. Really enjoyed working there and loved the environment, I even had to cross half the planet(20 hours in air) to meet the managers and get acquainted to a whole new culture in life.

However, few weeks ago, I started to realize that I don’t belong to where I was working, since I always had the dream to do my own thing, always lacked the motivation. Yes, that was always the case, no motivation. Up till the cool ppl behind YallaStartup did a wonderful weekend startup event that I participated in. After that event things changed quickly and I decided to leave my job for my own startup. I’m spending whole time now work on my thing and I’m very glad to be so. In later posts I’ll describe what I’m doing in better details.

Now, I want to make use of this chance to express who much I missed Ruby and the whole community. Yes I really did. Now, I’m back and I’ll try to frequently update this blog with new life experience.

Just before I publish this post, for the little of you who are wondering whether Python is cool or not, indeed it’s very cool and so much similar to Ruby, but it lacks the great community that Ruby has.

Yes, now I can publish! C ya!!