Archive for the 'Programming' Category
I have been doing freelance development and consulting since 1999. I figured it was about time that I launched a site for this service. I decided on a cheesy but memorable name. http://dialadev.com
There are probably as many theories on proper commenting of your code as there are developers writing the code. What is worth noting? what is not? I think to much focus is wrapped up in rules that make writing good comments confusing to new and seasoned developers alike. I will go over a few simple rules I like to stand by.
1) Use XDoc comments wherever applicable. There are a number of tools out there that will make your life a lot easier when generating base documentation and HTML versions of your API documentation. They are quite useful.
2) Don’t comment just to comment. Quantity is not better than quality in most situations and this one is no exception. To many comments can be distracting and take you away from what is important; The code.
3) Answer the write question. To many times I read comments that always answer the question “What?” . If you can not easily read your code and determine what its doing you may want to consider addressing the problem a different way. There are a few exceptions to this rule with complex algorithms and methods, but you should use comments that answer this question minimally. The real question that should be answered is “Why?”. 6 months or 2 years down the road when you open up the code its probably going to be fairly obvious what the code is doing, what will not be so obvious is why you did something that particular way, some business based rule that was determined in a meeting that made sense at the time, is now just a big question mark. You will thank yourself when you don’t have to rewrite something just to figure out there was a reason you had done it that way.
4) Use examples. Even the best documentation and comments can leave confusion to people not as familiar with the code as you are. Be sure to include small snippets of code demonstrating how to use a class or method that you have created if there may be room for confusion.
5) Don’t be afraid of humor. Hunting down defects or just implementing a new feature can be long and tedious at times. At 3am when you or a fellow developer are knee deep in code you’ll appreciate the laugh it will remind you how much fun coding is.
I have been an avid user of Vim for some time now. The more I use it the more things I discover I can do with it, and the more I fall in love with it. There are a number of colleagues of mine who also share the same passion for Vim as I do and quite often we share tips and tricks as well as custom maps and plugins that we have written with each other.
I have noticed there isn’t really a great way to bring Vim users together to share tips, tricks, maps and plugins or really a place for new comers to go to get assistance from veteran users, aside from information scattered across linux forums.
So with great pleasure I announce the launching of VimForums.com which in time should become a great resource for Vim users.
This day and age its nearly impossible for anyone in the IT field to not have run ins with a head hunter at one point or another. Many employers have moved to the try before you buy philosophy. Get the expert in there doing work for a few months and see how things turn out.
This interaction irritates me quite frequently. Who am I kidding it irritates me about 90% of the time. Dealing with these people is rarely a good experience.
Never Ending Phone Calls & Emails
First and foremost you have to deal with the never ending calls from about 30 of these places at a time. That of course is provided that there are not multiple recruiters from the same office calling you about the same position which seems to happen more frequently then you’d expect. They will continue to call you and / or email you until they reach you. The greatest part about this is as an 8+ year web developer I will get phone calls about a Sales Floor Manager at a car dealership. Which brings me to my second point.
Lack of Knowledge
It’s quite amazing that a recruiter would not try to have at least a brief understanding of a field they are recruiting for. They call you about positions you are either completely over qualified for or under qualified for. It’s become quite apparent they only scan your resume for keywords before calling or emailing you telling you that after “reviewing” your resume they feel you are a perfect fit for a position they have. I can have a description of a previous job that says I use an internal language that is java based and I will be determined to be a perfect candidate for a Sr Java Developer position with a minimum of 5 years experience. Don’t even attempt to tell me you feel I’m a perfect match for a position you have with a client until you have actually read my resume.
Whats Best for “You”
Honesty is a trait you should never expect to find in a recruiter. Most of their effort is spent trying to convince you how great of an opportunity they have for you. When in reality they mean a great opportunity for them. I had a great example of this happen to me a few months ago.
I received a phone call from a head hunter about a position in Miami, FL. I currently live in Clearwater, FL this position is on the other side of the state. Through numerous phone calls and emails I tried to inform the head hunter that I was not at all interested in the position. She always had a rebuttal for how it wasn’t an issue. I have both a Doberman and a Pit Bull which are banned breeds in that city, of course that wasn’t a problem because there is a town about an hour outside of Miami where they are allowed. Transportation to and from this city isn’t that big of a deal because there is a bus running in and out. It continued over and over. “I really would hate to see you miss out on such a great opportunity”. After probably about ten emails I had enough, and informed her “A great opportunity for me? how can you say this is a great opportunity for me. I have to move across the state, with no help with relocation. Receive a salary lower then what I currently make, at a higher cost of living. I’ll have a longer commute to work. I’ll work for a company I have never heard of when I currently work for a prestigious name. How exactly is this a great opportunity for me? What makes it so great? The only person who benefits from this so called opportunity is you.”. Needless to say I never received anymore replies.
Disappearing Act
Once the head hunter lands you in the position don’t expect to hear from them again. Mission accomplished they collect their commission and move on to the next victim. Almost every placement I have ever gone through I either never heard from my recruiter again, or maybe once every 3-6 months. I once had a position where my recruiter didn’t even keep track of my contract end date. I ended up being informed by the employer at the time that it was the last day of my contract and I wouldn’t be coming back after the break. My recruiter should have known this already, but apparently didn’t want to be bothered to make a phone call to let me know. Amazingly enough about 9 months later I received an email from this same recruiter with another “great opportunity”. I hope he isn’t waiting by the phone.
Update: As a follow up I have posted a list of 7 Tips for Deailing with Recruiters
Overview
I have been playing around with a multitude of editors, and plugins over the several years that I have been doing web development, always searching for the next best thing, I have been through more editors than I can count of all different types; vim, jEdit, phpED, Zend Studio, Dreamweaver, and many more. For a long while I stayed clear of Eclipse, it always seemed to be a bit bloated for my tastes, I can admit now I was a little quick to jump to conclusions. The more I developed in a number of languages the more I realized I wanted to use one editor for all of them, Eclipse continues to grow and adapt to the ever changing development community. It has a number of useful plugins that do everything from add support for additional languages, revision control, to integrating directly with a number of issue trackers.
Limitations
Eclipse does however have limitations in my view. One of the things I dont like about Eclipse is that common functionality between editors can be limited, each language implements its code folding in a different manor, that is however if they implement it at all. I think some of this functionality could be exposed on a generic level. For instance, maybe a general preference to enable folding on tabs, or brackets { }, brackets are common in most languages to define blocks of code, it would be useful to have this functionality available by default in the editor for unsupported types, the ability to fold on tabs is huge for me, a lot of code no matter the syntax people generally keep a manor of spacing to define blocks clearly, to be able to fold on those makes it easier to view what you want, this is one of the features I miss most about jEdit, other functionality I miss about jEdit was its ability to expand a fold into the full buffer, let me explain this more in detail, when folding was implemented you had the ability to select a fold and show only that block of code in the editor window, which stops you from over scrolling the block of code you need to focus on, and finally SuperAbbrevs; Eclipse does have functionality like this available for Java, but I think this is another feature that could be implemented in all editors generically, what this plugin did was allow you to define tags, that when typed and a key combination was entered it would replace it with your abbreviation (code template) I’ll show you a brief example
I would define an abbrev like this for the value “fore”
if(is_array($${1:array})){
foreach($${1:array} as $${2:key} => $${3:val}){
$end
}
}
Now inside my editor if i typed “fore” and pressed the hotkey it would output the following and i would already have selected “array” inside $array. As i type it would replace the value in both sections, upon pressing tab i move to the next variable “key”, then “val”, and the final tab would put my cursor inside the foreach loop.
if(is_array($array)){
foreach($array as $key => $val){
}
}
Defining helpers like this can reduce your development time a lot and enforce good practices.
These are only a few pieces of functionality I feel Eclipse is lacking to make me a truly happy man. Over my time doing web development I have found a number of useful plugins to Eclipse, I will discuss some of my favorites I use on a daily basis below.
Revision Control
I’m a big supporter of revision control, and I believe that it is a necessity for any serious developer, it can save you a lot of time tracking down issues that may have been introduced in new code, rolling back changes to get rid of features, or bugs. It also simplifies the development in groups of more then one user, but this could be an article all in itself about all the benefits to source control.
The two revision control systems I commonly work with are Perforce and Subversion, both have plugins for Eclipse, P4WSAD for Perforce and Subclipse for subversion, these allow you to interact with your repository without ever needing to leave the development environment.
PDT - PHP Development Tools
PDT although not officially released till September of this year is currently in a Release Candidate state, and an extremely powerful tool for PHP developers. I use the plugin on a daily basis.
- Support for PHP 4 and 5
- Syntax Highlighting
- Syntax Validation
- Code Folding
- PHPDoc Support
- Code Completion - This reads PHPDoc as well and displays this information when the content assist drop down appears, supports PHP’s native functions and show descriptions and parameters.
- Code Outline
Aptana
I have only recently started playing with Aptana, but I am extremely impressed with it thus far, I know I have probably only scratched the surface of the functionality it offers; and same as PDT this is still in a pre-release state so plenty of functionality to come, Although Aptana does provide PHP support I am incredibly fond of PDT and have been sticking with that, rumor has it 1.0 release of PDT will incorporate the HTML / CSS / Javascript support from Aptana, One can only hope. I am only going to address features I have personally used.
- Javascript / CSS / Javascript Syntax Validation
- Javascript / CSS / Javascript Syntax Highlighting
- Code Folding
- Code Completion - the amount of code completion this offers is insane, it will code complete your user created javascript functions, CSS will code complete your tags by id if you type # in the document, after setting in your preferences which browsers you want to support code completion will also show you what browsers support the CSS attribute, or javascript function it is suggesting, javascript code completion will also tell you what versions of the DOM support it.
- Outline view
- Javascript debugger
- FTP / SFTP support
Mylar
Another useful plugin that I have only recently just found. Even the name of it is creative, for those that don’t know mylar is a polyester film that is used to make inexpensive viewing glasses uses to look at solar eclipses, it keeps the eclipse from blinding you, Mylar does the same thing, it keeps you from being blinded from Eclipse. Mylar is a task based view of Eclipse, when looking at your project structure, your outline, or even the code unfolded there is way to much to look at. This plugin allows you to create tasks, which have a context associated with them, it keeps track of what you do when you have this task activated, and limits the views in the project explorer, the outline view, and the unfolding of code to only the pieces you have interacted with while you have had this task activated. You have the ability to set portions of code to a higher priority, remove files from the context, or clear the context all together. This plugin comes in extremely handy for me in my day to day work, as things of higher priority always come up, I just create a new task and move on, then when i’m ready to go back to what i was doing I reactivate my old task and it brings up any files I was working with and limits the views to only what I was looking at.
The functionality doesn’t end there. It integrates into several issue trackers already, Bugzilla, Trac, and several others. So your tasks are automatically pulled from your issue tracker and you can close out the tasks right there without leaving your IDE, and also allow you to associate a context with it. Even if your issue tracker isn’t supported a feature that proves to be extremely useful is the ability to import / export contexts. So if I work on a defect and pass it along to another member of the team I can email him my context, or attach it to the defect, So he can work with what I already have.
Conclusion
Eclipse is a very powerful tool for web developers to have available, and the plugins for it continue to get better. I know I have only scratched the surface of some of the plugins I use regularly, and I know there are many more plugins I dont even know exist.
A lot of people are curious about what exactly it is that I do and why I do it, so Id like to take a few minutes to describe life as a software developer. Software development or programming as most here it, can be one of the most stressful and most self-rewarding professions.
First I will discuss a lot of the stressful situations, when applications are first designed a lot of factors are left unknown, uses the application may have at a later date things people do that werent taken into consideration. Most of the time the design of the application changes several times from start to finish, this causes a lot of rewrites of the code, so in essence more code gets thrown out then used, not only do the design specs change but also technology changes therefore you must take into account these things and often redesign portions of your application to account for these changes. Unreachable deadlines are always thrown into the equation, and it always seems that if you are ahead of deadline for a particular milestone that some wrench gets thrown in.
Bugs are probably some of the most stressful things, you are usually in a crunch to get these fixed before the application is released to its user base or the application is already in use in a production environment and you need to isolate a bug before it causes any major havoc on its user base. Then you have the time involved to find certain bugs, they become noticeable in one part of an application but triggered in a completely different area leading to many hours of debugging and troubleshooting to isolate where exactly the problematic code is, and I cant count the number of times I have spent hours searching for bugs that didnt exist, the user wasnt using the application properly, or the bug existed solely because of a typo. All of these lead to very long hours worked, and a lot of sleepless nights to get things done on time. Its stressful at the time but in the long run the challenge is nice it keeps you motivated and determined to solve a certain problem.
These are just a few of the stresses involved in the career path, so Im sure by now you are asking yourself why on earth would anyone want to do this, Ill explain. As mentioned above it can be one of the most self-rewarding professions, I say self-rewarding do to the fact that not many understand the profession or the level of technical and creative skill involved, they see a button that does a particular task without realizing their may be 100’s of man hours behind that button, the people who appreciate your work most are fellow developers. Usually you here nothing when things are running smoothly and nothing but bad feedback when the slightest bug is found. Think of it in the way, the task you are trying to do is usually difficult and not easily manageable now we as developers need to know how to develop in the first place which is a lot of knowledge and be creative enough to write an application that is capable of completing the same task, and easily used, this makes it highly taxing on us, so I have tremendous respect for other programmers, there are a lot of brilliant people in this profession who have excellent problem solving skills and a ton of creativity. The same problem can be solved numerous ways so its interesting to see how others solve the same problem.
Anyway to get back on topic, the feeling you get is indescribable when you see 100’, 1000’s, or even millions of people on a daily basis using something you made, and seeing the amount of time that it saves them, I compare this to the feeling a contractor must get when he sees his finished house, he does a lot of tedious manual labor, long hours, but when he steps back and looks at the house completely finished it brings a smile to his face, the same holds true for software development there are a lot of hours involved, as well as a lot of stress but seeing the end result is a huge reward.
Technology is forever changing so there are always new challenges, new technologies to learn, and new problems to solve. I myself love learning; Im a big sponge, so its nice to work in such a fast moving industry. I think the amount of happiness, gratification and respect not just from others but from myself I get from doing this far out ways the stress involved, and I look forward to the years to come and all the knowledge and achievements it brings me.
