Reply to post: Re: what a load of Tosh!

What’s the real point of being a dev? It's saving management from themselves

Bronek Kozicki

Re: what a load of Tosh!

OO is not the only way to enable decoupling (testability, dependency injection, high cohesion etc.) . However it is relatively simple to implement (in a language) and use (for programmer) with static type safety, hence its popularity. It comes at a cost of design artifacts which need to be studiously maintained, i.e. interface classes.

The alternatives are polymorphism without explicit interfaces, either in a dynamically typed language (duck-typing) or in statically typed one (generics). Since dynamic typing makes early error discovery and enforcement of design tricky, the only tools remaining for large projects are either OO (well-established) or generics (tricky to use).

Personally I am not a fan of OO, because of the maintenance effort of the interfaces it drops onto developers, enabling stupid designs (a singleton which is a factory to a ... value type because it only has getters and setters, WTFF!) and generally being misused like a very heavy hammer in the hands of 500lb gorilla. However there are (not that frequent) situations when dynamic function dispatch of few closely related functions, collected under single umbrella of an interface class makes sense - but this requires consideration and understanding of (both maintenance and runtime) costs associated! More often than not, as single function pointer (or perhaps small lambda) works better, with 10% of the associated cost in terms of lines of code which need to be read and understood every-f*g-time someone needs to touch the thing.

As for AI? Neural nets have their place, but they are not going to save us from ourselves.

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon