Saturday, July 4, 2009

5 things to keep in mind before start coding

Most of the time, programmers start coding quickly because we think we understand what is to be done. From my 10 years experience in development I've discovered that this leads to a complete mess and hard maintenance.

Here I compile a list of 5 things to do before writing a single line of code.

1. Don't write an application without a soul.
Yes, the soul of any application is the actual purpose out of it. If you start coding the requirement without fully understand the use of the application, users will not use the application.

2. Don't open the Code Editor until its time
Just opening the code editor switches you brain to the left side, i.e. you will dive into the ugly if statements and the How-Tos of coding. I'll explain. How to I join two tables from different connections? How to populate a list grid from a database without looping? .etc.
Users don't care how you join tables and write your SQL.

3. List the engine players in the applications
After understanding the requirements, draw boxes of the entities you might think of in a paper. These players will form the engine (think of the engine is the hidden cogs of the application).

4. Run the application engine in your head
Just imagine the application is written on this paper, now try to execute it. No form design. Just run the engine. Draw arrows and attribute as you need them.

P.S. Remember you can't run the application properly if you keep thinking about your If statements, Loops, SQL. So clear it, clear it now.

5. Add/Remove attributes and methods as fit
As you virtually run the engine in your head you will find new attributes to be added to the classes. You may realize that you even need to remove some unneeded methods.

Until you feel comfortable with your paper (the Class Diagram), start the editor and enjoy coding.