Search

Twitter

Domino Upgrade

VersionSupport end
5.0
6.0
6.5
7.0
8.0
8.5
Upgrade to 9.x now!
(see the full Lotus lifcyle) To make your upgrade a success use the Upgrade Cheat Sheet.
Contemplating to replace Notes? You have to read this! (also available on Slideshare)

Languages

Other languages on request.

Visitors

Useful Tools

Get Firefox
Use OpenDNS
The support for Windows XP has come to an end . Time to consider an alternative to move on.

About Me

I am the "IBM Collaboration & Productivity Advisor" for IBM Asia Pacific. I'm based in Singapore.
Reach out to me via:
Follow notessensei on Twitter
(posts)
Skype
Sametime
IBM
Facebook
LinkedIn
XING
Amazon Store
Amazon Kindle
NotesSensei's Spreadshirt shop

« (Browser) Client side XSLT transformations | Main| Mastering XPages released - in Chinese »

If you think decomposition is from CSI, stop writing code!

I like coaching developers to write better code, but sometimes it is too much. So here it goes:

If you think decomposition is from CSI, STOP writing code!

So, it is off my chest. Simples rule of thumb:
  • if a function doesn't fit on a printed page, it is too long
  • A function does one thing. If you loop through a document (or record) collection call a function with the individual document as parameter
  • Use objects and inheritance with a factory class instead of monster case structures with copy/paste code duplication
  • Refuctoring was meant as a joke
  • The functions that declare a variable clean it up, not the called functions
  • Global variables are evil unless you have 7 good reasons to have them
When you write your code in JavaScript use JSHint (someone port this to SSJS please), when you write Java, look at Crap4J. Unfortunately there is no free one for LotusScript, but you could use Visustin to visualize your functions - 3m image size would definitely be too long.

Want to improve? Attend a computer science 101 class at a good university and some programming lessons. This is the 21st century, it won't cost you (other than your time): Keep in mind: for every function line you write over 100 lines a kitten must die.

Comments

Gravatar Image1 - Great advice. I learned a lot on this subject by reading "Clean Code" from Robert C. Martin It's hard to follow his advice to the letter and I can't say I'm doing that, but it has made me a better programmer.

Gravatar Image2 - Excellent post, lots of resources to pick over. One minor point: Crap4J seems to be a project in the doldrums, no updates for a long time and its plugin doesn't work in any of the recent versions of Eclipse, alas.

Gravatar Image3 - Stop warning. NO kitten is going to die. Or children in Africa are going to starve to death.

Disclaimer

This site is in no way affiliated, endorsed, sanctioned, supported, nor enlightened by Lotus Software nor IBM Corporation. I may be an employee, but the opinions, theories, facts, etc. presented here are my own and are in now way given in any official capacity. In short, these are my words and this is my site, not IBM's - and don't even begin to think otherwise. (Disclaimer shamelessly plugged from Rocky Oliver)
© 2003 - 2014 Stephan H. Wissel - some rights reserved as listed here: Creative Commons License
Unless otherwise labeled by its originating author, the content found on this site is made available under the terms of an Attribution/NonCommercial/ShareAlike Creative Commons License, with the exception that no rights are granted -- since they are not mine to grant -- in any logo, graphic design, trademarks or trade names of any type. Code samples and code downloads on this site are, unless otherwise labeled, made available under an Apache 2.0 license. Other license models are available on written request and written confirmation.