← servoy magazine

[Video] Coding Weekly #7: Reusable Code Considerations

In this coding session I talk about what makes effective reusable code. Whether we think about it conciously or follow our gut instincts, the following considerations come into play when we code reusable methods:


1 Not a one-off, expected to be reused
2 Does a discrete, focused task
3 Returns consistent results
4 It is adaptable
5 It handles defaults gracefully
6 It handles errors gracefully
7 It is documented
8 It is easy to find


Due to YouTube 15 minute upload limit, in 2 parts:

Part 1: http://www.youtube.com/watch?v=cGTH6MBAihE&list=UUjROBqo6n8EIPVummJC7kpQ
Part 2: http://www.youtube.com/watch?v=uoOLMEL04iM&list=UUjROBqo6n8EIPVummJC7kpQ

Comments (1)

Tom Parry
David, I like your video on the reuse aspect. Ont eh documentaiton side perhaps you want to look at the "@return {Object}" as a possible way to enhance the documentation. I find this especially useful when hovering over the method signature and examining the arguments and the return types. I am not sure that Servoy/javascript is there yet fully for the @return, but it certainly helps.