Solve the problem at hand

Recently, I’ve had a bit of a paradigm shift in the way I think about software development. Essentially, that shift is to only focus on solving the problem at hand and not to write additional code just in case it might be needed. Credit for this comes from the excellent RailsTips article, Just in Time, Not Just in Case. Now many developers are going to find this concept hard to accept. After all, you should be writing code that addresses any problems that may arise in the future. That is how you write robust code right? … right???

Well I had the same problem accepting this at first. I had already accepted that my code sucks, and that I could be a better programmer by not programming. However, the concept of solving the problem at hand takes this one step further by making you catch yourself before you go writing code just in case it might be needed.

You end up asking yourself: “Wait a minute, am I over-engineering this?

The main reason for not writing code just in case is that it rots. Code that isn’t used still requires maintenance, it still has bugs in it, and it still needs to be tested. The key is to accept that every line of code you write will potentially add more bugs. Reducing bugs means writing less code. Writing less code involves finding the simplest thing that could possibly work. Remember as a software developer, you are you’re own worst enemy. I believe that’s what makes this concept so hard to accept, particularly if you already think you’re a rockstar programmer.

Another problem, is that the simplest solution isn’t elegant enough for some people. For example, the simplest solution might be to just to skip the first line when looping through a file because it stores headings and not data. But then the questions start; what if the data changes and the first line isn’t a heading any more? What if we have headings across two lines? What if the data is encrypted in an alien cipher … and so on. Right now, the headings are on the first line, and the code passes the test of reading the data with the headings where they are. Problem solved, move on now.

A good way to ensure you solve just the problem at hand is to take a test first strategy. Sure you can write unit tests and execute them in xUnit if all that is available to you. But really, this simply means:

  • Write the test first;
  • Write enough code to make it fail second;
  • Write enough code to make it pass third;
  • Move on.

Note that writing the test may simply mean writing the test out in English (or your preferred language). Automated unit tests are still a luxury.

March 8, 2010 | In Thoughts | 1 Comment

Copying very large files across a LAN network

I needed to copy a very large file (~25GB), a virtual machine disk across a network (LAN). Standard Windows copy isn’t great for this, and it kept on getting stuck. I also tried using the copy/xcopy commands but they weren’t much help. The problem was a matter of feedback and recovery. That is, having the ability to see how much longer it was take and to pause/resume in case of a failure.

Finally I settled on TeraCopy, a GUI file copy tool which has a portable version. All up it took about 4 hours to copy across a wireless network. Best thing is you can pause/resume if there are any network drops and you get instant feedback about the copy process. The remaining time is also a little bit more reliable than Microsoft time!

March 6, 2010 | In Software | No Comments

Local Web Development Servers

There are a number of great web development servers available that you can install on your PC to get straight into web development or trying out various web applications without the hassle of installing and configuring your own server.

These include:

  • XAMPP – Apache-MySQL-PHP and Perl server (its portable too)
  • WAMP Server -  Apache-MySQL-PHP for Windows
  • InstantRails – An instant Ruby on Rails Development Server
  • The Uniform Server – Windows-Apache-MySQL-PHP, there’s also a Tomcat Plugin
  • Server2Go – Windows-Apache-MySQL-PHP-Perl and also supports SQLite
March 4, 2010 | In Software | 2 Comments

Web Development Screencasts

I like learning web development skills by watching screencasts. They allow you ton see what’s being changed as its happening and you can pause and rewind as much as you need to.

Here’s a list of some really good screencasts sites and some specific screencasts that may be of interest:

Sites

ASP.net

CSS

General Web Development

JavaScript

PHP

Ruby on Rails

Wordpress

I’ll try to keep this post updated as I find more good screencasts.

March 3, 2010 | In Programming, Web Development | 2 Comments

Shut down Button on Login Screen

To enable the shut down button on the login screen in Windows Server (classic login), use these steps:

  1. Run Group Policy editor – Start > Run > gpedit.msc
  2. Navigate to Computer Configuration > Windows Settings > Security Settings > Local Policies > Security Options
  3. Find the entry Shutdown: Allow system to be shut down without having to log on
  4. Set to enabled if disabled
March 3, 2010 | In Software | 1 Comment
Page 7 of 141234567891011121314