Tags: , , | Categories: development Posted by pieterg on 3/28/2010 6:25 AM | Comments (6)

It’s difficult to remember the principles of the paradigm when you are bombarded with deadline after deadline and you just need to take a step back and realize that.

class, instance, methods and inheritance, abstraction and encapsulation they ring a bell don’t they? They are the principles of object oriented programming, the paradigm most of the programmers use nowadays.

Digging through my own code, I see names like “Entity” and “RenderableEntity” and you know, I kept thinking, they aren’t truly descriptive and looking at their name, you cannot determine what their functions or properties are.

When developing an API, I like to keep in mind that the consumer of the API, should not need to have a look at any documentation to understand how the API works, it should just come naturally.

Let’s have a look at an example from the .NET Framework

DirectoryInfo directoryInfo = Directory.CreateDirectory("NewDirectory");
directoryInfo.MoveTo("c:\\NewDirectory");

I’m not too fond of Directory.CreateDirectory, I would’ve had Directory.Create(…), but you can determine that Directory would have a Create method inside of it, as well as returning some kind of information related to the directory that just go created.

I hardly ever have to open the MSDN documentation, the reason for this is clean design of the BCL (Base Class Libraries).

So, next time you decide to write a library of some sort, make sure that it’s intuitive and that you aren’t the next victim of the Daily WTF.