Object Oriented Design

OOP considered harmful ?

A dose of anti oop

Guowei Lv

1 minute read

I have no intention to start flame war here. Just over the years of exploring, I have collected some materials that are not supporting the mainstream OOP paradigm. I just list them here, in no particular order. Stop Writing Classes This is a great talk, I think people will agree most of what’s in this video. The Third Million Line Problem This is slightly off topic, but interesing to watch.

2 minute read

While reading Effective Java Item 21: Use function objects to represent strategies, something hit my mind and now I’m writing it down. All these new lambda thing is really what is called the Strategy pattern in the OOP world, or would it be more appropriate to say that the Strategy Pattern in Design patterns is really what lambda is. The essence of all these, can be boiled down to one simple idea, pass functionalities around.

3 minute read

I have been working on some Clojure project at work for several months now, one little thing bothers me now and then is that it doesn’t allow dependency cycle in project. For example if a.clj requires b.clj, b.clj requires c.clj, then c.clj cannot require a.clj, in other words, c.clj cannot use anything inside a.clj. At first, I thought this is a bit odd, java doesn’t have that. And once in a while we have to solve such problems by creating a new namespace and move the common function into it.

3 minute read

One of uncle bob’s videos talks about how to design a coffee maker, I think he nailed it. The problem is to implement a software component that controls a coffee maker. Requirement The Mark IV Special makes up to 12 cups of coffee at a time. The user places a filter in the filter holder, fills the filter with coffee grounds, and slides the filter holder into its receptacle. The user then pours up to 12 cups of water into the water strainer and presses the Brew button.

1 minute read

Recently at work we has been talking about implementing some kind of Analytic interface for all the analytic libraries we are using, like Localytics and Firebase and so on. Basically it is just a fat interface with a long list of event logging functions, like logSignIn(), logSignOut(), logSellProduct(), logOpenMap() and so on. There are about 40 such methods in that interface. So this is how we implemented it in the first place.