Less is MORE

Just fin­ished watch­ing an inter­est­ing sem­i­nar video by the guys from Object Men­tor (a con­sul­tant com­pa­ny found­ed by Robert C Mar­tin, the father of agile devel­op­ment) at:

http://www.infoq.com/presentations/polyglot-polyparadigm-programming

The video is about an hour long and cov­ered a large num­ber of top­ics around using dif­fer­ent lan­guages (poly­glot) and dif­fer­ent pro­gram­ming par­a­digms (poly-par­a­digm) to sim­pli­fy and speed up the soft­ware devel­op­ment process. The main thing I took away from this was:

Less code is bet­ter, so less code is more. With less code, all your prob­lems become small­er, be it main­te­nance, test­ing or per­for­mance.”

which most devel­op­ers would agree I’m sure, after all, one of the rea­sons we refrac­tor our code is so we end up with less code.

For young devel­op­ers like myself, we have come into soft­ware devel­op­ment in an era dom­i­nat­ed by the object ori­ent­ed par­a­digm and a small hand­ful of main­stream OO lan­guages like C++, C# and Java. So for me at least, it’s refresh­ing to see how oth­er par­a­digms and lan­guages can be used in con­junc­tion with those I’m famil­iar with to achieve:

  • greater pro­duc­tiv­i­ty from the devel­op­ers
  • more agile and exten­si­ble solu­tion

Summary:

If you don’t have the time to watch the video (or sim­ply not inter­est­ed enough to do so!) then hope­ful­ly the list of key points I’ve com­piled togeth­er would at least give you some idea what it’s all about:

  • There’s no sil­ver bul­let in soft­ware devel­op­ment
  • OO par­a­digm not always the best solu­tion for the prob­lem
  • Sta­t­i­cal­ly-typed lan­guages (C#, C++, Java, etc.) are com­piled for greater speed and effi­cien­cy at the cost of low­er­ing pro­duc­tiv­i­ty
  • Dynam­i­cal­ly-typed lan­guage (ruby, python, JavaScript, etc.) are inter­pret­ed for greater exten­si­bil­i­ty, agili­ty and pro­duc­tiv­i­ty at the cost of low­er­ing run­time per­for­mance
  • Ola Bini’s Three lay­ers – Domain lay­er (Domain Spe­cif­ic Lan­guages), Dynam­ic lay­er (JRu­by, etc.) and Sta­ble lay­er (Java, C#, etc.)
  • Script­ing lan­guages increas­es pace of devel­op­ment
  • Aspect-ori­ent­ed pro­gram­ming makes it eas­i­er to deal with cross-cut­ting con­cerns
  • Func­tion­al pro­gram­ming makes con­cur­ren­cy eas­i­er, because:
    • func­tions are side-effect free and state­less
    • noth­ing to syn­chro­nize, so no locks, sem­a­phores, mutex­es
  • Func­tion­al pro­gram­ming is cloud com­put­ing friend­ly
  • Func­tion­al lan­guages and DSLs are more declar­a­tive than imper­a­tive
  • Scala is cool!
  • Advan­tages of the poly­glot and poly-par­a­digm approach are:
    • able to use the best tool for a par­tic­u­lar job
    • min­i­mize the amount of code required and keep them clos­er to the domain
    • bet­ter decou­pling between com­po­nents
  • Dis­ad­van­tages of this approach are:
    • mul­ti­ple tools, lan­guages, libraries to man­age and learn
    • need to man­age the dif­fer­ent meta­da­ta mod­els and over­head of calls between lan­guages
  • It’s noth­ing new! For exam­ple, web devel­op­ers often have to work in dif­fer­ent par­a­digms and lan­guages on a web­site
  • High­er end-user expec­ta­tions and tighter sched­ules are dri­ving the pop­u­lar­i­ty of high­er lev­el lan­guages such as func­tion­al and script­ing lan­guages
  • Devel­op­ers have to deal con­text switch­ing between dif­fer­ent lan­guages, so as the appli­ca­tion grows larg­er and more com­plex, you have to start par­ti­tion­ing the teams (should be sec­ond nature to those work­ing in the enter­prise world!)

Parting thoughts..

As the pre­sen­ter stat­ed sev­er­al times through­out, poly­glot and poly-par­a­digm pro­gram­ming (PPP) has all been done before (despite now being men­tioned with unfa­mil­iar ter­mi­nolo­gies), and I cer­tain­ly see a lot of famil­iar­i­ty of it in my line of work where in a typ­i­cal 3-tiered appli­ca­tion you’d have:

  • the data access lay­er using SQL (rela­tion­al par­a­digm)
  • the busi­ness lay­er writ­ten in C#/Java or oth­er OO lan­guages
  • the UI can be in any num­ber of dif­fer­ent lan­guages or par­a­digms depend­ing on its form (HTML/CSS/Java/C#, etc.)

and numer­ous script­ing lan­guages (Perl, for exam­ple) are also used in var­i­ous places (hell, after all, there are over 5000 appli­ca­tions being active­ly used with­in Cred­it Suisse alone!).

Watch­ing this video has helped me iden­ti­fy with what I already know and put names (poly­glot, poly-par­a­digm) to famil­iar faces (which is why jar­gon are impor­tant and I keep blog­ging about buzz­words :-P ), watch it, and see if it can help you too.

Further readings:

Ola Bini’s blog post on writ­ing dif­fer­ent lay­ers of code in dif­fer­ent lan­guages