lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Sat, Apr 15, 2017 at 12:52 AM, Andrew Starks <andrew@starksfam.org> wrote:
> knew that there was. The lazy model that he admitted to having was some sort
> of hierarchy like: first came spaghetti  code, then procedures, then OOP
> fixed everything.

Heh, leading to the so-called Lasagna model of programming - layers
all the way down. It's still Pasta.

This is all excellent advice - look at the structure of the problem,
and find whatever abstractions that needs to make that structure
appear in the solution. That is, abstraction is the handmaiden of
functionality.  This is difficult advice, if you want a handbook of
pre-solved solutions. Education can sometimes be harmful (as Andrew's
C# programmer shows) and gets in the way of thinking creatively.  I do
use OOP for big jobs but rarely use inheritance - because that's a
solution to a static-typing problem (if Cat is-a Animal, then Cats may
be passed to an interface expecting Animals). I don't need subtyping
or implementation inheritance (my classes may just use private
functions to keep common functionality).  And here is something: I've
found myself using closures more and more, where a traditional OOP
model would need a class for implementation. And abstract or pure
implementation classes would be a good example of patterns that aren't
essential to the problem, they are an artifact of a programming model.