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.

Comments

AVG Antivirus Review
AVG Antivirus Review United States on 4/14/2010 3:46 AM Thank you for this helpfull review. It really was helpfull. Keep up the good work.
Rapidshare
Rapidshare United States on 4/17/2010 11:38 PM I\'m happy I found this blog, I couldnt discover any info on this subject matter prior to. I also run a site and if you want to ever serious in a little bit of guest writing for me if possible feel free to let me know, i\'m always look for people to check out my site. Please stop by and leave a comment sometime!
shevchenko
shevchenko Turkey on 4/24/2010 7:18 PM Ich konnte nicht finden alle Informationen zu diesem Thema vor. Ich benutze auch die Website, und wenn Sie jemals ernsthaft Besucher, mir zu schreiben, wenn möglich, können Sie mir geben, ich bin immer auf der Suche nach Menschen zu meiner Website zu sehen.
chicco high chairs
chicco high chairs United States on 4/27/2010 11:29 AM thank you for explaining it thoroughly
locksmith 24 hours
locksmith 24 hours Bolivia on 4/27/2010 7:26 PM Attention-grabbing blog Smile
Fredia Macaulay
Fredia Macaulay Turkey on 4/30/2010 4:33 AM

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading