Tuesday, October 25, 2011

Some important things I have learned over the years

Over the years learning and practicing programming, there are still some things that I often hard people ask about programming. There are some strange things that people ask and stranger still, some of these things are asked by people already in the industry. I wanted to share with you some of the more often questions I have heard about programming.

One of the most peculiar questions I have heard about is, would there be an advantage to write code not using coding standards when in a professional environment and why or why not. That is a strange question and partial to most people, given the type of economy we are in right now. I know that developing a program that has difficult to follow syntax that only the developer would understand could seem to ensure that the programmer would have job security, especially if the program is distributed. On the flip side, by only having one developer that can understand how the program really works limits the company by relying on that developer to fix and maintain all errors and problems that the program develops. On this regard, having code that does not follow coding standards would be more harmful than helpful. By following coding standards, more people can work on improving and maintaining the program rather than relying on only a few people to do the same job.

I remember fooling around with C and using command line editors and text editors. Much more recently, I have been using IDEs to program and write my programs. I know of many advantages that IDEs provide and how useful they are. With all that the IDEs provide, I've heard people ask if is there any advantage to using a text editor rather than an IDE. IDEs offer many advantages over text editors and provide many other things that used to be done separately in command line. Text editors are limited by only providing an environment that can only be used to write a program, not to test or compile. When using text editors, the program still has to be compiled and even then, you must test and see of the program runs without errors. The only thing that text editors might have advantage over IDEs is that they're small and compact, quick to load and use. They are also fast for small programs that can be written without errors. But in all humble opinion, using an IDE is much more preferable than using only something like a text editor. The only other thing that I came across is that some companies prefer using Vim, rather than some other IDE.

When I'm writing some programs, I have Ant installed as my build system and I use Ant to compile some of my programs. Normally the way I have Ant run to compile my programs, I run several checks on my program. Three of the more prominent checks are PMD, findbugs and checkstyle. PMD and findbugs both check source code while checkstyle checks the Java file to see if it follows a set coding standard. As with the first question about having a coding standard, I have people ask that is it necessarily bad when checkstyle returns some errors, but PMD and findbugs do not. Checkstyle checks the Java file to see if the code was written using a set coding standard. While the code may be free of bugs upon compile, there might be things wrong with the code format such as missing comments and unused variables and objects. Having a set standard allows people to understand your code better and by not following the set standard, why have a set standard in the first place?

As I have said that I'm using Ant to compile some of my programs, I have heard some people asking about using a build system such as Ant and what is the advantage of using a build system. Under command line, the code must be compiled then linked and finally an executable is created. Each of these processes is entered one line at a time, and if there are multiple files that need to be compiled each of those needs to be entered and compiled before they are all linked and an executable is created.
This takes up too much time and becomes tedious, especially if the program has been compiled several times, in which the previous object file that is created after compiling must be deleted in order to make sure the resulting object file that is created from compiling the current source file. With all this command line procedures, there are many ways that this could be botched or incorrectly entered. Using a build system takes all of that out of the equation, by creating an running a file that does everything that should be done to create a running executable. For example, when using Ant, making and running a build file makes Ant compile, link and make an executable all at once (providing no bugs are found). Build programs take out the missed links and makes sure that the most current files are compiled and linked together. The files are also easily updated, if the program needs to include more or less files to compile and run.

One of the other things I have come across is validation and verification. They both have to deal with program correctness and effectiveness. Validation refers to when a program fits some need and verification is how well that program fits the specified need. Both are important to software testing and development, some people wonder what is the difference between static validation and verification and dynamic validation and verification. Static validation and verification usually means the program goes through code reviews as well as a controlled analysis of the source code, looking through control and data flow. Dynamic validation and verification refers to testing code, looking for errors in functionality and also errors due to scalability, performance and reliability. The main difference between static v&v and dynamic v&v is the focus, static v&v focuses on how the code executes and it functions where dynamic v&v focuses on the errors the program produces due to incorrect functionality as well as how well the program's performance and reliability when it is released and distributed.

These are just some of the questions and answers that I have come across over the years that I have been studying and practicing programming. I'm sure you have some ones as well and I would like to hear some of them as well.

No comments:

Post a Comment