I don't know how many advances might be happening recently on some underground Smalltalk mailing-list, but in general, OOP has remained the same for decades.
Does everybody think it's good enough? Does nobody want new features that will make your code more expressive somehow? Watcha think?
Name:
Anonymous2012-05-06 2:09
Does nobody want new features that will make your code more expressive somehow?
What does this have to do with object-orientation?
Name:
Anonymous2012-05-06 2:12
OO is one way of designing your system. It has strengths and weaknesses for different types of problems. You're supposed to use OO design when the strengths of OO design to the problem are more valueable than the weaknesses of OO design to the problem.
Name:
Anonymous2012-05-06 2:12
OOP is not only about code reuse (I take it you're thinking about it?); it's also about modelling the real world problem in a coherent way inside a program.
I know. I'm going to admit I haven't studied many other paradigms, but I surely believe there are improvements that could be made to OOP.
For example, not all relationships in the world can be expressed as HAS-A / IS-A, and I shouldn't have to dump OOP just because of that.
I personally consider something I call "private IS-A"; basically that would be an interface to an object that can only be acquired under certain circumstances.
The whole point is, I don't usually see people talking about what could be improved in OOP or added to it. People just talk about using OOP. Where's the metathinking?
Name:
Anonymous2012-05-06 2:21
>>5
All the mental effort is dedicated to solving problems using the tools available instead of doing analysis to the tools.
Is that just an observation on reality or is it the way you think things should be?
Name:
Anonymous2012-05-06 2:30
>>7
It's an observation. There are too many things to do if we spend time analysing the tools we use. This is why there we focus our efforts on a couple of disciplines: theoretical computer science, software engineering, electrical engineering, computer engineering, IT administration, etc. It's quite possible to create all sorts of tabulated data regarding the tools we use, but that sort of work is generally a theoretical field of study. People do theoretical work so that other people can take the lessons of that study and solve practical problems with it.
There are lots of wildly different paradigms for wildly different problem domains. But not so much overlapping (you'd have noticed if you really read that page). Are you telling me the amount of information on that page scares you so much you believe it's *gotta* have all the solutions to all the problems I might have encountered?
You'll notice... if you look closely, that I'm talking about OOP here, and stuff close by (Aspect-oriented programming, for one). The philosophy of functional programming won't help me (much); so that cuts a lot of possibilities, and the remaining ones I at the very least know the philosophy... but it also didn't help. That's why I'm talking about enhancing OOP.
Name:
Anonymous2012-05-06 4:15
>>11 Does everybody think it's good enough? Does nobody want new features that will make your code more expressive somehow?
The point is that the general population are taught to use tools, not think about them. This is also applicable to skilled fields like programming and system design.
The philosophy of functional programming won't help me (much)
you might have a different viewpoint if you were more familiar with functional programming. Even if you aren't using a restrictive language that forces no side effects, you can still apply the philosophy in other normally non-functional languages. And it can have very nice pay offs. For example, it may be nice to keep some data structures immutable if they are going to be accessed concurrently. And it may pay off to think in terms of mapping and reducing with higher order functions if you are going to take advantage of parallelism for crunching data. But this all depends on what problem you are currently trying to solve. The perks I mentioned wont be relevant if the application is single threaded, for example.
Yeah, some functional functions are really interesting, and I like mixing imperative languages with them. It's really bliss. But that doesn't really solve object-oriented programming problems (they solve and express algorithmic stuff really neatly, but it's completely unrelated to object-oriented architectures, which is what I'm aiming).
Name:
Anonymous2012-05-06 6:43
>>14 But that doesn't really solve object-oriented programming problems
So the object orientation actually creates more problems instead of helping you solve them?
OOP is useful when it works well. In excess, or superfluousness, it becomes mental masturbation.
I see programming as the bridge between the problem and the solution. Thus, all code you write should be directly to get you to the solution and not anywhere else.
I think it's naive to believe you're going to solve a complex problem just walking a straight line. Try that, and you'll end up like Rasmus: "I just kept adding the next logical step". That's the main reason why PHP is such a shit.
If your system is complex and you don't take the time to architect it well, you won't go too far before regretting that mistake. Or just being stupid and thinking that "well, programming is really hard, right?"... >__>
Why does this thread even have any replies? >>1 took a semester of Java at his community college and think that makes him qualified to talk about programming paradigms. Things should have ended with that realisation.
>>21
This is one of the endless shit threads. It's worse than homework threads, because at least the people posting those are trying to do their homework. This guy just decided he was better than his teachers and stopped paying attention entirely.
>>24
Yes, saying PHP is shit is SO BRAVE and many people on /prog/ are going to disagree with it. Clearly.
Go back to /r/programming (or /pr/, if that still exists; I hope not).
Phew, well, I'm happy you agree then. You see, a lot of stupid people believe PHP is good, and given the sudden shitstorm I thought I might've hit some idiot like that.
Btw, as I'm sure you've noticed I'm a newfag, so I really don't know what people like or don't around here just yet.
Name:
Anonymous2012-05-06 11:12
>>1
Roles/Traits/Mixins are the solution. Scala, Perl6, Ruby, D and many others are supporting class composition, some even at runtime.
What I would love to see is something very simple: syntax for message composition, a la Smalltalk's semi-colon, so that I could do this:
// hypothetical java extension in which the pipe is a method composition operator
RacialStereotype nigra = new RacialStereotype();
// instead of
// nigra.setFavoriteMusician("Lil Wayne")
// nigra.setFavoriteFood("watermelonz an da fried chickenz")
// nigra.setFavoritePasstime("smokin bluntz wif muh niggaz");
// we can do
nigra.setFavoriteMusician("Lil Wayne")
| setFavoriteFood("watermelonz an da fried chickenz")
| setFavoritePasstime("smokin bluntz wif muh niggaz");
Is that so much to ask from an "OO" language?
>>34
Just define your void methods so that they always return self. Then you can do shitty_example.stupid_pattern1('a').stupid_pattern2('b').stupid_pattern3('c'). You could even do that in Java, I'm pretty sure.
Actually it is dumb programmers who think everything should be solved through inheritance. Where I work, almost everybody thinks that way (or just do it without thinking at all).
However I do agree that OO should have more advanced ways to relate concepts. Inheritance and composition are just not nuff'.
Name:
Anonymous2012-05-07 1:51
And why didn't my quote work, beyond myself being undeserving?
>>50-52 doyoufeelintimidatedby power of my BBCode skills?
Okay, okay, use "> " as the first thing on the line to make it a comment. Good luck getting multi-line comments, though.
I find that OOP is great for small projects. If you need a WindowsTM dialog that requires the user to enter some values into text boxes and then click an OK button, OOP is a great way to go. You can even try/catch/throw some exceptions and bask in the warm and fuzzy feeling of RAII, if you want.
But when a project is large, OOP just becomes a tremendous burden. It actually makes development slower at that stage of development. You'll spend all your time in meetings about how the singleton-factory-observer is too tightly coupled with your composite-command-decorator.
Well, a GUI library is a large project. But it is easier to use for a small project if the GUI library is object oriented. Do you see the paradox here?
Name:
Anonymous2012-05-07 4:18
>>54 But when a project is large, OOP just becomes a tremendous burden. It actually makes development slower at that stage of development. You'll spend all your time in meetings about how the singleton-factory-observer is too tightly coupled with your composite-command-decorator.
I always felt like OOP was actually interesting FOR large projects and useless for small ones. What do you think is good for large projects like e.g. game engines then?
>>18
PHP may be "a shit" to you but does that change the fact that it's become the ubiquitous language for dynamic webpages?
Many people don't understand the reason behind all of these things they view as flawed. PHP evolved to fit a certain niche and it has evolved well. It was not designed by language experts or theoreticians, but rather by people who had their goal in mind and approached the problem pragmatically. And pragmatism always wins in the real world. In the time it takes for you to find the most "elegant" design for your new web framework and before even writing a single line of code, your competitor has already gotten a site up and running with visitors.
The same argument can be applied to many other things, like the intricacies of the x86 architecture. PHP is not my favorite language, but something has to be said for its practicality and the popularity it's enjoyed. Thus, in much the same manner that I respect and admire the x86 for its longevity and personality, I can do the same for PHP.
tl;dr: Horses for courses, don't let idealism get in the way of practicality.
Name:
Anonymous2012-05-07 4:26
>>59
Cudder I noticed that you have now added a whitespace between your name and the tripcode, you are no longer silly Cudder.
Name:
Anonymous2012-05-07 4:31
>>60
The whitespace is sillyness, he is still silly Cudder.
If he posts with an e-mail you will notice that the whitespace is highlighted as well, such is unacceptable.
PHP may have become the ubiquitous language for dynamic webpages but does that change the fact the it's "a shit"?
Many people don't understand the reason behind all of these things they view as Just Working. PHP evolved to fit a certain niche and it hasn't evolved well. It was definitely not designed by language experts, but rather people with a goal in mind and approached the problem in a Go Horse way. And Go Horse always wins in the real world when the timespan is short. In the time it takes for you to get a PHP site up and running and before even thinking anything (which PHP developers don't do until they bump into a wall), your competitor has already started to think how to approach the problem correctly.
tl;dr: Don't let *blind* practicality get in the way of rational thinking.
>>60,61
My name has had that trailing space since 2008.
>>62,63
You might want to finish off whatever you're smoking and go for a break before trying to organise your thoughts.
Name:
Anonymous2012-05-07 6:47
>>35
I think he meant the "method composition" part, which the extent of its flexibility wasn't shown in that example. Its at least more flexible than simple method chaining over a specific object.
(define superfun (compose fun1 fun2 fun3))
(equal? (superfun "input")
(fun1 (fun2 (fun3 "input"))))
; => #t
In light of the number of parenthesis in Lisp, the benefits of composition is apparent. The problem with "method composition" though is that it assumes prevalent immutable style of OO, but OO is very dependent on ad-hoc conventions.
>>65
If that's what he meant, he's dumb to want it. Function composition makes obvious sense if you look at it from the perspective of data flowing through a chain of mutators, but if you use methods like that, you're just trying to crowbar functional style into OO to the detriment of both.
Use interfaces as typeclasses (obviously not in java) and read up on multidimensional separation of concerns and its predecessor subject oriented programming.
>>58 large projects like e.g. game engines
Hah!
Game engines are almost by definition not large projects. They get written quickly by a small group of people, comprise relatively little code (except when compared to your factorial or bubble sort implementations, I guess), and don't have to consider long-term maintenance at all.
Game development is easy; that's why there's so much crap out there. If web developers didn't exist, game developers would be the very bottom of the hierarchy.
Name:
Anonymous2012-05-08 14:10
OOP is seriously retarded, it breeds programmers that all they want to do is obfuscate their code even more, i've been told the perfect OOP code is the one where each method only has one line of code
>>78
You're easier to spot than you think.
First-year students have no business posting on programming boards. Lurk, and don't post until you're in your third year and have come up with an interesting graduation project.
>>34
You can do that in C++ with operator overloading. Also you can use the period thing instead of the inclusive-or operator.
Name:
Anonymous2012-05-08 17:23
>>82
I'm not >>81, I'm >>78, and your assumptions about my background were really off, I suggest you kindly halt and catch fire OOP-cock-sucker OOP-cock-sucker OOP-cock-sucker OOP-cock-sucker OOP-cock-sucker OOP-cock-sucker OOP-cock-sucker OOP-cock-sucker OOP-cock-sucker OOP-cock-sucker OOP-cock-sucker OOP-cock-sucker OOP-cock-sucker OOP-cock-sucker OOP-cock-sucker OOP-cock-sucker[/sub][/sub][/sub][/sub][/sub][/sub]
Name:
Anonymous2012-05-08 17:46
>>84
No you can't. Kindly show one code example that does that without making every method return a reference to itself.
I don't want to be like one of those people that gets really mad and calls you names and shit, but I just want to put it out there that you are wrong, so that other readers not familiar with game engines wont be deluded. You are right about some things, like frogger would be pretty easy to make entirely from scratch. But game engines for non trivial games are very complex. Even the doom game engine an impressive piece of work.
Many games don't implement an engine. They'll either use an existing engine and add only content, or they might take a predecessor engine and hack in the extra needed features. Game engines aren't easy. You will have to get low level to get the performance you need. The algorithms used will need to scale well if the game is to handle large environments and large amounts of entities. Realistic and reliable physics. Work all of this into networking for internet play. Sound and doppler effects. Efficient and good looking graphics for large levels. Culling areas that don't need to be drawn. Realistic and not stupid AI, which must also be fast enough to not drop the framerate. And then there's the art and general media. And the game itself. Even with all this work, you might fail to make something that is fun to play.
>>90
This is what gamers really believe.
Your view of what's difficult and what constitutes a large project will change quickly once you enter the real world.
>>91
I bet you think ``the real world" means make this billing system abusing Java design patterns
Name:
Anonymous2012-05-09 21:01
op you are a faggot.
do we abandon physics cuz it's old? no.
go suck a dick.
Name:
Anonymous2012-05-10 7:36
>>4
In theory, possibly, but in practice there are many different ways to model a problem domain. Actors / use cases are fundamentally procedural thinking with frills.
>>73
oh wow it's only getting this shit 10+ years after every other language
seriously? a gc language and it's just now getting weak reference support? js is shit
Name:
Anonymous2012-05-12 2:28
>>73
Const? Private/public? Classes? They're turning JavaScript into interpreted C++!
Name:
Anonymous2012-05-12 4:00
>>104
There was no real need for it until now. Rust on the other hand has gone full retard with unique pointers.
Only a handful of new languages have been introduced in the past 30 years that I can truly appreciate, and two have come from people working at Mozilla.
>>105
Chill, const is just a let. Introducing classes rather than just fixing protos seems a bit pointless to me though.
Game development is a special domain of realtime computing. Managing computational and physical resources in a scalable manner in this domain is far more complex than enterprise software. How do I know? After 10 years of working on AAA titles, I quit and took on the easy route of doing enterprise crap (less work, better pay!).
>>73 useful
While it may be correct to say that that statement may possibly have a likelihood of containing elements of truth, this introduction of numerous novel functionality to a language provides the desired beneficial effects exclusively to the subset of users who possess the capabilities to effectively employ said functionality, and likewise via comparison to other relatively well-known programming languages to which features have similarly been added with little consideration to factors not commonly present in the context of said additions, one such illustratory example that comes to the mind being Perl, by extrapolation of this deliberation it can trivially be shown that the utility of said features has a "flip side" that should also be properly ruminated upon by the totality of the stakeholders involved, lest they become a greater liability to efficiency and an appeasal of the minority in contrary to the majority than genuine overall improvements. In particular it must be noted that implementation costs both for the machines and the humans, which most certainly should not be trivialised, may serve as a strong deterrent and impetus against gratuitous proliferation, resource wastage, and in general non-sustainable growth of "anti-infrastructure" ecosystem that bears purpose in solely supporting its own self-centered consumption to the exclusion or marginalisation of the primary underlying issues and concerns for which we have conceived these creations ab initio.
>>35
There is a problem with that, sometimes you need the result, sometimes you need the object again. Take .pop(), suppose you want to write (for whatever reason):
var foo = bar
.pop()
.pop()
.pop();
...to end up with the 3rd last item in an array?
There is a clever solution: katy.js provides K and T combinators on the object and return value. I have used it, it's incredibly convenient if you ever need it. Since it's a mixin you don't need to write protos especially for it and it works on the standard ones as well.
Actually, a lot of C++11 features are supported by GCC, and in fact were supported before the standard was even finished. VC++ also supports a few things, I believe.
Name:
Anonymous2012-05-12 22:14
>>118
Clang implements all of C11 and is almost done with C++11 support.
Unfortunately, only Mac OS X's libc implements the C11 library functions in the latest Xcode beta. glibc is lagging, thanks to Ulrich Drepper being a late adopter.
>>116-120
Um, fuck, looks like I've been confined in my basement for a long time. I didn't know C11 was already supported by the mainstream compilers.
Name:
Anonymous2012-05-13 0:33
>>121
Don't feel too bad. C11 as a complete standard is supported almost nowhere (though Clang is becoming more and more viable, yay.) There are C11 features here and there, but MS's official line is "if you're not writing ANSI C, go find another compiler."
>>120
While Clang is totally awesome, glibc is not. I should probably have clarified that. You can't reliably write C11 code and expect it to work anywhere except the most bleeding edge "I replaced my glibc with something actually good" people's machines. That and GCC is really far behind on the C11 support.
Name:
Anonymous2012-05-13 7:15
>>34
No that doesn't work because | is taken fucking deal with it.
What if besides the setFavouriteMusician method there were setFavouriteFood and setFavouritePasstime functions that returned ints for example?
But the best bit is when you realise that maybe:
RacialStereotype nigra = new RacialStereotype("Lil Wayne", "watermelon an da fried chickenz", "smokin bluntx wif muh niggaz");
makes you look fucking retarded because it turns out your feature already exists.
Name:
Anonymous2012-05-13 10:24
>>120 Clang implements all of C11 and is almost done with C++11 support.
That's just bullshit, they're not even close to implementing C11.
Name:
Anonymous2012-05-13 16:50
>>123 You can't reliably write C11 code and expect it to work anywhere except the most bleeding edge "I replaced my glibc with something actually good" people's machines.
So my debian machine is probably fine then.