Live data from Hacker News

Object Oriented Programming is an expensive disaster which must end

smashcompany.com

111–120 of 123 posts

Re: Object Oriented Programming is an expensive disaster which must end

#111
post #56
post #36

Earlier quoted context omitted.

I think there is a similar flaw in your argument as follows. You: OO is flawed because of x Me: But OO language a doesn't have a problem with x You: Ah but language a has problems with y Me: Yes but language b doesn't etc... You conclude OO is inherently flawed I conclude that there are now languages without flaws...

Exactly. If you look for a language without flaws, you may as well give up programming. On the other hand, if you say "I'm trying to do X - what's a good language to use?" then we can have a conversation. Some of the flaws are irrelevant in some projects, but roadblocks in others. Debating the pros and cons of languages without the context of a project is like discussing the best form of transport without having any…

Assembler! /thread #rekt #kidsthesedays

Re: Object Oriented Programming is an expensive disaster which must end

#112
post #15

Having programmed a lot of OO in Python and PHP (yeah, yeah, I know, but its OO implementation is actually rather good), I always felt OO was a pretty good way of doing things... Until I hit the Java scene. Boy, is it a big mess. There I found some of the worst unreadable, unmaintainable, ungrokable, complex and brittle code I've ever seen. And that's not an exception, rather it's the standard. I suddenly understood…

What are examples of a good approaches to generic logging? In the past I've found log4j and the python stdlib logging to be frustrating to work with. But when I had a shot at writing my own approaches, I found it to be one of those domains that's harder to deal with than it looks. Someone will have though - interested to know of a good approach.

There are multiple approaches (my favs being dependency injection or aspect oriented). The actual case of a dependency affecting an entire application is called a "cross cutting concern", there is great literature to be found under that term that explains it better then I ever could. It highly depends on the use case though, just have it in your toolbox (and dont get in the habit of argueing when you are tasked to build a house whether you should use the hammer OR the saw like some peeps in this thread. Select the right tool for the right circumstance dont just limit yourself to one).

Re: Object Oriented Programming is an expensive disaster which must end

#113

Earlier quoted context omitted.

I've written large systems in Java, C++ and yes, I have never ever used DI. Nor even seen any kind of AbstractFactory in Java.

I don't believe you. Are you mistaking DI for meaning a full blown IoC framework? DI is merely the abstract computer science concept. In FP land we call it partial application or P/A. But it is essentially the same thing. I honestly cannot fathom how a large project would look without DI. It must be hideous with massive amounts of coupling all over the place i.e. not something to be proud of. Refactoring must be very…

I'm pretty sure it's impossible to write a non-trivial program without ever using DI, even if just by accident.

Re: Object Oriented Programming is an expensive disaster which must end

#114

Earlier quoted context omitted.

I don't believe you. Are you mistaking DI for meaning a full blown IoC framework? DI is merely the abstract computer science concept. In FP land we call it partial application or P/A. But it is essentially the same thing. I honestly cannot fathom how a large project would look without DI. It must be hideous with massive amounts of coupling all over the place i.e. not something to be proud of. Refactoring must be very…

I'm pretty sure it's impossible to write a non-trivial program without ever using DI, even if just by accident.

Agreed. If you've not used DI after 15 years as a "professional" developer, and you are also happy to "boast" about this fact on the Internet, then it means you are very likely an utter shit developer.

Re: Object Oriented Programming is an expensive disaster which must end

#115
post #44

Earlier quoted context omitted.

Functional has not much to do with object oriented. Scala for example is both functional and OO. I think you mean the competition between imperative and functional languages.

It's not clear where the line is to me.I mean,it's obvious fr Erlang or Haskell.But isnt clojure imperative to some extent? While I understand the notion of pure FP.Shouldnt we say that FP is more of a toolbox that can be used in many languages,some making it easier than others. I mean FP in Java 7 is a pipe-dream while any language that has lambdas can be considered as functional? or should lazy evaluation be anothe…

It seems practical to say a functional language has first-class functions and a purely functional language has first-class functions and no mutable state -- purely functional -> functional and not imperative.

I would identify a language as distinctly imperative if it has mutable state and has statements, e.g. operations with side-effects that have no return values (ex: loops, if's, void methods) -- not to be confused with expressions, which may have side effects, but always have return values.

So, if you look at the matrix of possibilities based on these classifications, a language can be any combination of (OO or not OO) and (functional and/or imperative).

It is trickier yet when many languages support multiple paradigms but encourage a subset. Or if you choose to restrict functional to require anonymous functions _without_ syntactic sugar.

Does that help though?

Re: Object Oriented Programming is an expensive disaster which must end

#116
post #20

Mate, you should learn Scala before writing about it... scala> def hasUppercase(s: String) = s.exists(_.isUpper) hasUppercase: (s: String)Boolean scala> hasUppercase("Charlie Brown") res2: Boolean = true scala> hasUppercase("schmuck") res3: Boolean = false

This blew my mind. The "scala" example he used was literally a java code snippet pulled from here http://batsov.com/articles/2011/05/12/jvm-langs-clojure/

IT'S LITERALLY JAVA SYNTAX, COMPLETELY INVALID SCALA.

Re: Object Oriented Programming is an expensive disaster which must end

#117
My main problem with the proposition that "OOP is awful" is that the argument is basically "it's not the best so it's the worst".

The expression problem is not solved by every language, but basically because Lisps and Haskell solve it in their own ways, it is concluded that OOP is worthless.

There are a number of practical reasons OOP could be liked, other than the marketing of it to the Enterprise. It's a natural way to model real things. The syntax lends itself to things like auto-complete (foo.ba). And being liked is enough to make it not-awful if the people who like it are skilled enough -- it's sufficient even to say it can be better than other paradigms for some people.

Don't mistake that for me saying that OOP is the best at anything, but it's not the worst at everything.

Re: Object Oriented Programming is an expensive disaster which must end

#118
post #79

Earlier quoted context omitted.

You don't come across well in this at all. 200 classes in a OO project is pretty small really. And you've never used DI ever? Really?

I've written large systems in Java, C++ and yes, I have never ever used DI. Nor even seen any kind of AbstractFactory in Java.

Are you sure you know what DI is? It just means you pass an object's dependencies to it, instead of it constructing them itself. You don't need a framework to do DI.

Re: Object Oriented Programming is an expensive disaster which must end

#119
post #20

Mate, you should learn Scala before writing about it... scala> def hasUppercase(s: String) = s.exists(_.isUpper) hasUppercase: (s: String)Boolean scala> hasUppercase("Charlie Brown") res2: Boolean = true scala> hasUppercase("schmuck") res3: Boolean = false

From TFA: Please note that, below, when I refer to a multi-paradigm language, such as Scala, as an OOP language, I am specifically referring to the OOP qualities in that language. And I would like you to ask yourself, if you use a multi-paradigm language to write in the “functional” paradigm, are you actually gaining anything from the OOP qualities of that language? Could you perhaps achieve the same thing, more easi…

> are you actually gaining anything from the OOP qualities of that language

Yes.

> Could you perhaps achieve the same thing, more easily, using a language that is fundamentally “functional”, rather than object oriented?

No.

(That was easy. :-D)

Post reply on HN