Friday, August 1, 2008

Reinventing the wheel...

When it comes to programming, one of my favorite phrases is "KISS", or "Keep it simple, stupid". I am a regular contributor on Microsoft's Visual C# Forum, and I've noticed something lately: people reinventing the wheel. Here are two examples:

  • Rewriting generic BindingList because it doesn't inherit from a generic version of IBindingList, and that is what you want.
  • Rewriting the configuration system just simply because you want to. Nevermind the error you're getting from creating something that doesn't resemble an app.config file, and then insisting on calling it an app.config file. Yes. The .NET Framework actually does do something with the file called app.config when it's in the folder.

So, after a bit of this, I was prompted to write the following rant on another post. Take this as a suggestion to beginners.

#region Soapbox

Just because someone has posted code publicly on CodeProject, and not released it "professionally" doesn't mean that it's not still a really, really good way of doing things.

Beware of the sentiment that you'd rather start over than go with something that works. While this sentiment is very nice in an ideal world, the world is not ideal, and this means that sometimes you will have to do things like implement other people's code, even though you don't like it, in order to accomplish your task in a timely manner.

If I had all the time in the world, I would create the perfect application with the perfect architecture, perfect coding algorithms, and perfect readability. And I would also make it perfectly consise. I've seen too many people go the route of "I don't like that's provided for the exact purpose I need it for and seems to work properly, because it's not ."

Don't get me wrong, I'm not saying to go slap together unreadable, poorly designed code that has no semblance of an object oriented system, but I am saying five things:

1. Learning programming is a process. You will most likely underdesign your first application, and overdesign your second. Don't expect to write the perfect application the first time through. There is no such thing.

2. Your boss will probably not be happy with you if you spend so much time trying to do everything perfectly, that you never accomplish anything. I've seen people on these forums that have threads that go on for months where they are trying to accomplish a task "perfectly", when another simpler answer was already provided for them. There's a balance between quality, budget, and deadlines that have to be struck.

3. Some of the best programmers I've ever met don't earn their living that way. I once convinced an accountant to be a programmer by trade, simply because of his passion for the subject. Some people write incredible code and put it up on Code Project or Source Forge simply to get their name out there, because they do want to be professional coders, but they don't have the resume experience, etc. Read the code, and evaluate for yourself. It's a good way to learn good practices and not-so-good practices.

4. Learn the basics first. Otherwise, you'll find yourself in some crazy conversation with someone one day, and your vocabulary makes no sense to him, and he sounds like he's talking another language. This often happens when developers (I have been known to do this) make up terms for things that aren't the real terms.

5. Keep asking questions. Read everything you can get your hands on. And most importantly, code, code, code. Don't be afraid to screw up, because you will. Try everything, and if it doesn't work, try something else.

All that to say, I really suggest code project, because it's good code, and people actually walk you through portions of their code, explaining it along the way. I've been programming for two years, and I'd still rather learn something from code project than from Source Forge simply because I don't have the time to spend digging through line after line of code to find the one part I'm interested in.

Sorry for the rant, but I've seen alot of people lately trying to reinvent the wheel.


I suppose that says about as much as I want to right now.