Less is More in Coding

There is a saying within eBay that the lines of codes of eBay is more than Windows and Linux combined. Well… It is not a compliment from where I stand. The less the code is, the more powerful it can be.

With OOP (Object Oriented Programing), and the right level of abstraction, code can be very simple, very concise, easy to read, but remain more flexible and powerful. I spent the last few weeks rewriting some code with one principle in mind – just to push the limit to have less code. I have successfully turned a 2000 lines code into 250 lines, and another few thousands into 250 lines. I just feel 250 lines of code is a magic number to accomplish a lot. My goal of writing PHP code is, put less than 7 lines (ideally 3 lines or 1 line) into a function, and as less function as possible, while still maintain a very high level of flexibility and functionality. I believe one day I will share some sample codes.

1 thought on “Less is More in Coding

  1. I agree. I think this is the paradox of design: the more time you spend refining a design, the simpler it becomes. And in the end, it is so simple that it appears that you spent very little time on it. But simpler is superior to complex.

    I think it is the same with writing. It is easy to write many words, more difficult to write concisely. The famous author Mark Twain supposedly said this:

    “If I had more time, I would have written you a shorter letter”.

Leave a Reply

Your email address will not be published. Required fields are marked *