Anyone can write a program these days, whether macro driven via wizards or using a powerful but simple syntactic language like Python. After all if software companies made languages too cryptic and difficult to use then their product would not market effectively through lack of support and interest (Java aside!). Granted some of us were born with a 'knack' for programming while others had a steep learning curve, with such a prevalence of available programmers for employees/clients to choose from how do you distinguish yourself as the best choice among competing candidates.
Quality and speed are two attributes that are usually not synonymous as can be seen in a plethora of hastily written applications produced against time-constraints. Relying upon one attribute heavily will usually nullify the other.
Beginning with the attribute of speed. Have you noticed how many programmers/code-cutters these days are two-finger-typists? Two-finger-typing code-cutters rely heavily upon IDE intellisense features to produce the code for them. This may explain the lack of well written and descriptive comments in much of the code they produce. Ideally a programmer should be able to touch-type as speed is a concomitant of touch-typing. This is for a number of reasons:
When you are touch-typing code, your are looking at the screen as you are typing which makes it easier to concentrate on the flow of your algorithms, using the intellisense feature, if there is one, at the same time only increases the speed and therefore your production of code. Your comments will be more descriptive and comprehensive because you are moving faster without any reliance upon inbuilt intellisense features per se.
As a simple analogy. When you drive a car do you repeatedly look at the stick-shift or pedals to change gears and brake? No, of course not. What would happen if you did, would you miss your turn or hit a tree? Concentrating on two things at once causes problems and causes you to take your eye off of the ball. It's the same when programming, why take you eye off of the ball to hunt the keyboard for keys whilst alternating between looking at the keyboard and screen for that time-saving intellisense feature? Touch-typing is one of those skills that, in my opinion, will put you above 80% of other programmers in your area of programming when it comes to producing code.
You can find typing-drill books or manuals either at Amazon.com or even second-hand bookshops. Buy one and practice, all you need is 30 words per minute (wpm) to vastly increase your coding speed and with the use of any available intellisense features you will probably type a good 40 to 60 words per minute. I recently was given a six week contract which I cleaned up in one and a half weeks because they had estimated the time taken to code the solution based upon their recent work and guess what, the programmers were two-finger-typists. Two fingers moving around the keyboard as opposed to my 86 words per minute output without intellisense. My client was very happy at the end of that!
Use a Code Clip Organiser to Improve Speed and Quality
======================================================
Another tool that will help you improve the speed and quality with which you code is a well organised, searchable library of code clips (snippets). How many times have you seen a programmer re-inventing the wheel and why do they? I have a code clip library called CodeClipper (www.bandicootsoftware.com.au) that I use constantly, dragging and dropping code into all of my routines. The code clips are tried and tested, accurate and high quality and best of all, I only had to write them once (apart from slight ameliorations in algorithm over time). When I start a routine I drag'n'drop the initial comments including my name, company, website,date and time of the routine's creation and place holders for the description, updates and notes. Next I drag a choice of error-handling into the routine. After I can either drag'n'drop a recordset template or search some code and paste it into the routine. 3-5 seconds and I've built a lot of quality code into the routine already. Quality and speed; the two juxtaposed attributes that employers and clients demand and already I'm ahead of other programmers in my field.
Use Comments To Enhance Code Quality
====================================
Descriptive and comprehensive comments are so much the result of touch-typing. When you can type fast you don't mind going that extra mile for clarity of explanation, you don't have to make short shrift of your comments. Many times other programmers have commented whilst looking at my code "Wow, lot of comments!" as opposed to their complete lack of comments within their own code. It is much easier to maintain my code by myself and others because of the ubiquitious and generous use of comments.
What are comments efficiently used for? Firstly, comments should explain why you chose a certain algorithm or path of action, when there are a myriad of other options available. For example: you may have tried a more obvious solution to a problem only to find it has integrating issues or perhaps did not perform as the documentation stated, then you decided on a more extraneous solution. Write succinctly what you have tried and why ideas failed and then explain your final decision. Sometime later someone or yourself may refactor your code or wish to change it, at least they will know what did noy work so you have saved someone time by providing quality and informative comments.
Another good use of comments is to plan an algorithm. Maybe you have a mehtod you know will be needed by a class but have no time to code it. Whilst it is fresh in your mind type the steps of the algorithm out into a routine or method in comments like pseudo code. When you get back to that routine you'll have the framework of your algorithm laid out for you, that's half your work done already. Remember to delete the obvious pseudo comments as you code, if you need comments every step of your code to explain what it is doing then you are not naming your variables and functions in a way that explains their purpose or values.
Make Your Code Understandle... Make it English
==============================================
If it's not against company policy throw away your naming conventions. This will save time renaming variables and then some when you change a control or variable type. A worse case scenario is if you change a variable type but fail to change the naming convention of the variable name. Once you dump naming conventions your methods can make sense and you will not need so many comments to explain why you are calling a certain routine. For example:
Instead of...
dim strUserName as String
dim cll as new clsLogonLogoff
strUserName = cll.mtdstrGetUserID
It could read...
dim user_name as String
dim logon_ as New Logon_Manager
user_name = logon_.user_name
Or better still:
Instead of...
rstrLibrary = funstrLibrary
It could read...
library = library_user_is_logged_onto
These examples are trivial but you get the gist. I once converted a rather shabby logon script full of obscure function names and ubiquitous loops into a cleanly written set of functions that even a user could read and make sense of. I prefer to use underscores and bring the code that step closer to ordinary English. When you have a whole list of coded instructions like this it is a dream to read and understand.
Write Scripts to Write Code
=============================
There is one thing faster than typing fast or using your own code clip organiser and that is script that writes code for you. I once had to write a database where the client was not sure on the type of fields or data they needed to capture and the Business Analyst was having problems working it out?! The main table that was likely to change would affect a lot of queries and code that worked with it's data, for example 'Select Case' statements, Recordsets, various routines. I spent about four hours scripting and testing routines that could delete the table and rebuild it along with rebuilding queries and rewriting large pieces of code. A big investment of time at the beginning of the project that paid off later in the software development cycle. These routines read their data from a text file with a simple format of table names and associated fields. There was one day where my client was looking at the database on another floor in our building and made table changes on the fly. I rewrote that database 5 times in 8 minutes that day as the client kept changing their mind upon viewing the results, and they were extremely apologetic but it took me 5 seconds at a time to rewrite the database once I quickly changed the fields in the text file. Don't just use code to make your client's life easier, use it to make your own life easier.
Writing scripts to write code means:
Script to script and improve the quality and speed of your work.
Know You Programming Cycles
===========================
When do you program best, morning, noon or night? Know when you are programming at your best and try to arrange the rest of your working or leisure time around that. I program best in the morning so I try to arrange my meetings for the afternoon, hey everyone falls to sleep in meetings anyway.
In short, almost anyone can write a program so you have to stay ahead of a lot of people. Some ways we have looked at to do this are:
Your a code cutter...Go forth and produce code!
Duane Hennessy
Senior Software Engineer and Systems Architect.
Bandicoot Software
Tropical Queensland, Australia
(ABN: 33 682 969 957)
Your own personal library of code snippets. http://www.bandicootsoftware.com.au