|
Re: Benefits of Laziness... and other stuff
Laziness does not always mean unstructured and unreadable programs that are hard to modify. When I write programs I am lazy and do what requires the least amount of work overall.
Last semester in my Computer Science class we had five projects to do over the course of the semester. These involved keeping a database of movies and the showtimes of these movies. The first would just read in from a file, storing them in an array, and writing them back out when the program was told to. The next 3 programs involved a different way of storing the movies (linked lists, simulated linked lists, and binary trees), with a little more added functionality (e.g. add, delete, search, save back to file, etc.). The final project was to put a GUI on this program.
I took the lazy way of writing this by designing my program so that I could just swap out the storage code with any of them and it would function the same. It was a little more work for the first project, but for the following projects, I just rewrote the storage mechanism with the same public API, and added a couple of functions for the additional features in the assignment. By doing this, it only took me a couple of hours to write a new storage class, and a quick addition of some functions for the additional functionality while others in the class who did not structure the program and mix the storage code with the logic code had to nearly completely rewrite their program.
By writing a well structured program, I was able to maintain and debug the code with much less work, thereby taking the lazy way out.
__________________
5! * (4! - 3! - 1!) / 2!
|