Thursday, January 29, 2015

Remembering Good Old API Design

* image copyright O'Reilly

I've started programming on my free time again. It helps me distract from all the clutter that is SQL (which is what I do at work at the moment). I'm starting some new personal private projects, and some public projects which will hopefully be online anytime soon. I've always liked to keep myself busy in my free time and ever since I know how to read I've loved reading. So, recently I came across some of my old notes on Software Design from 2007. Back at 2007 I devoured 7 books on software design (recommendations on separate blog post). I'm glad I did: all that knowledge has been very useful for the past 8 years as a software developer.

These are some of my notes from back then on API Design:
When developing an API keep in mind the following considerations:
  • avoid clutter: Only implement the functionality that is needed now and avoid planing for the future
  • avoid too many comments: If you need to comment every single line of code, then you are probably writing too complex code
  • write code that reads like a book: Write functions that complement (or link) each other thus avoiding spaghetti code. Name them appropiately so that you may know which one is the method that follows next
  • keep it short: Don't write long (and cryptic) method and variable names which may be hard when reading out loud
  • be consistent: e.g. if you started naming all methods and variables in one language (i.e. english) keep doing so. Define and use code conventions!
I'm surprised that even after more than 8 years when I started taking interest in Software Design and Software Engineering I did manage to get a lot right back then! 


Post a Comment