[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

What went wrong?

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 185
Thread images: 18

File: radioative.jpg (41KB, 400x277px) Image search: [Google]
radioative.jpg
41KB, 400x277px
Is the "object model" inherently flawed?
>>
C-fags are inherently flawed
>>
>>57696818
It's POO.
>>
Nothing wrong with it

 
using System;

namespace Love
{
public class Person
{
string name;

public void love(Person someone)
{
Console.Write(name + " loves " + someone.name);
}

public Person(string name)
{
this.name = name;
}
}

class Program
{
static void Main(string[] args)
{
Person i = new Person("i");
Person you = new Person("you");
i.love(you);
}
}
}


Tell me this isn't beautiful
>>
>>57697222
Why love method is camelCase and not PascalCase?
>>
>>57697242
If the function had been private (which it should have been), the case would be correct.
>>
>>57697358
I never argue about the case or the names of private methods. Private is private.
>>
>>57697380
Stop hating on my quiet public love then. I never liked announcing my love loudly faggot.
>>
I have never found an excuse to actually use it, even in languages with OOP support.

99% of the time structs are enough to do anything you want.
>>
>>57696864
I can hear the curry running down your fat stomach from here

C is best language, everything else is a useless abstraction
>>
>>57697242
I prefer __pAjeet-CasE
>>
>>57696818
It's sort of a trade off. Thinking of solving problems is usually a good first step, but you something do so at the cost of being over verbose. It's a popular method to think about structuring problems.
>>
>>57696818
Actually, yes, and I'm not memeing. In programming you have functions and non-functions as data. Functions can be called with non-functions or functions as arguments. What OOP does, is it ties functions to one of their parameters. For instance in
a.function(b, c)
, the parameter a is given a special treatment. But why should that happen? Why couldn't you just call functions normally? What makes one of the parameters special? There's no logical justification for the practice.
>>
>>57697496
It hurts, because a lot of people use that case.
>>
>>57697521
It's grouping of information.
>>
>>57697456
>i don't know how to program very well
>>
>>57697664

> he fell for the object meme is a better way to programming
>>
>>57697706
>he doesn't use design patterns
>>
>>57697590
You can group it by just putting related functions inside modules however you feel like. Still, it's arbitrary.
>>
>>57697476
I can hear the curry running down your fat stomach from here

Assembly is best language, everything else is a useless abstraction
>>
OOP is a good way to structure your program.
Even if you don't like it personally, it is used a lot of places and you should know it and understand it.
Not all applications benefit from this, but a lot of them do.
It makes it easier to interface different parts and it allows for people to split the task of planning, implementing and using.
Having a plan is always a good thing.
Using a template for a plan is good as long as you allow yourself to adapt.

The inherit flaw with any ideology is that there is no true Scotsman. Any example of a failure means that they didn't implement it correctly or something along those lines, so arguing about whether a modeling ideology is flawed, look if there is examples of when it is good and judge it by that.

If you do not like the examples of when it is supposedly good, then it is flawed.
>>
In my language OOP is called "POO" and I always remember the poo in loo meme
>>
>>57697222
>"i loves you"

Good job pajeet.
>>
>>57698079
Now replace 'i' for something else and try it.
>>
Person No_one_can = new Person("No one")

No_one_can.love.(>>57698103)
>>
>>57697222
package main

import "fmt"

type Person struct {
name string
}

func (s Person) say(r Person) {
fmt.Printf("%v loves %v\n", s.name, r.name)
}

func main() {
i := Person{"I"}
you := Person{"you"}

i.say(you)
}


Tell me this isn't beautiful
>>
File: Q0vFcHd.png (152KB, 1948x858px) Image search: [Google]
Q0vFcHd.png
152KB, 1948x858px
>>57697222
>>
>>57698284
is this go? looks fucking retarded
>>
>>57698284
Yeah that looks dumb
>>
>>57698313
the right one is actually java, not oop in general
>>
>>57698284
>Declare functions not like in oop
>Call them like in oop
Why?

>>57698630
Even in java you don't have to write like this. This is enterprise style retarded spaghetti type coding that pajeets do.
>>
>>57698653
exactly, people hate oop because of pajeet shit code
>>
Yes, and so is every paradigm. There are also huge inherent flaws in functional programming (slow and lack of the ability to express program state), and procedural (hard to scale and maintain). But regardless if you know what your doing then any paradigm can be used in a practical and effective way.
>>
>>57696818
horrible cache safety and inevitable leaky abstractions.
it's a bad model.
>>
>>57697476
>C is best language
walking is the best form of transportation
>>
>>57698313
>oAnimal
>legs=0
horrible example of OOP

oAnimal should be an interface with getLegs() and getBrain() methods.
>>
File: Alan Kay.jpg (3MB, 4752x3164px) Image search: [Google]
Alan Kay.jpg
3MB, 4752x3164px
>>57696818
the problem is pop culture
>>
>>57697742
>design patterns
see
>>57697664
>>
>>57698284
You have no idea how much going through useless hoops like that triggers me.
>>
People don't know how touse it properly. Instead of going for emergent design they over design everything and create dependencies when they are not needed. Why are you inheriting that class? Can't you just make a separate class and call the functions you need? Probably with OOP is that it gets overdone
>>
>>57697948
>Not all applications benefit from this, but a lot of them do.
Such as GUI libraries, and.... what else?

>It makes it easier to interface different parts and it allows for people to split the task of planning, implementing and using.
Functional programming languages have interfaces too. In fact, functional programming style data declarations (variants, pattern matching based) make it easier to plan how an implementation is going to look before you even write it.

>Having a plan is always a good thing.
Opponents of OOP claim that OOP leads to premature over-specification that will bite you in the ass.

>Using a template for a plan is good as long as you allow yourself to adapt.
This is in no way specific to OOP.

>The inherit flaw with any ideology is that there is no true Scotsman.
Very true. However a simpler approach to programming means that it's easy to do things "correctly"
>>
>>57696818

http://harmful.cat-v.org/software/OO_programming/

and related:
http://harmful.cat-v.org/software/java
>>
If OOP is so bad why is so much software written in it? Why would companies hurt themselves by making products on inefficient technologies? Wouldn't one company be able to take massive advantage by choosing some other paradigm like functional?

Sometimes I think /g/ just hates shit that's mainstream and popular like some kind of weird annoying hipster.
>>
>>57701535

OOP isn't used necessarily because it produces the best programs. It's used because it's easier and makes more sense to programmers that haven't had a whole lot of training invested into them.

The best programs would be written directly in assembly. They would be fast as hell and would would still work on operating systems released decades later. But if you're a company you need to compromise on stuff like that, so they use OOP.
>>
>>57701406
>http://harmful.cat-v.org/software/OO_programming/
The Dijkstra quote is fabricated. And quoting Carmack is a bit weird since he also said that if you don't see the value of oop for things like ui you're a luddite.
>>
// which is it?
nail.insert(plank)
plank.insert(nail)

// it's neither
insert(plank, nail)
>>
>>57701654
Yeah, I wouldn't take anything on cat-v too seriously.
>>
>>57701097

>what else?
Pretty much anything you can split into semi-discrete parts. Games, pretty much any type of web-application, online storefronts, search engines. Basically anything.

It's a big hammer: It's not necessarily best for things that need a sharp knife, or a surgeon's hand, but a lot of tough problems can be solved by a big hammer.

>Functional programming works
Yup.

>Opponents of OOP claim that OOP leads to premature over-specification that will bite you in the ass.
Okay, I'll argue with those guys. Lemme know if you see any.

>This is in no way specific to OOP.
Yup.

>Very true. However a simpler approach to programming means that it's easy to do things "correctly"
Until you realize that there were costs to the simple choices that make it harder to grow with lots of people.

This is, by analogy, the reason people care about time complexity: its use basically doesn't matter for small cases; when you've got n=50 things to manipulate, just fucking do it however, no one cares. It's when you have n=10^10 things, that's when how fast things are really matters.

Object oriented programming is for the second case, for projects of sufficient complexity organizationally (>1000 people over decades, rather than several hundred or less) because if you let enough people do things "simply", things become an ad-hoc mess of functions without shared and generalized interfaces, code duplication, and generally grinds huge projects to a halt while people try to figure out how the fuck all the interrelated functions work.

OOP at its core is a tool to mentally manage that complexity by limiting the scope of ways to interact with the codebase and the number of things you need to keep in your head at any time. More often than not it helps. This is why big tech companies use it.
>>
>>57701748
You can do all 3 with C#
>>
>>57701797
Interesting. I'm not a C# expert, but does it simply allow you to call object methods as if they were free functions by placing the object as the first parameter?
>>
>>57697222
Get on with the times grandpa.
namespace Love
{
public class Person
{
string name;
public Person(string name) => this.name = name;
public void love(Person someone) => Console.WriteLine($"{name} loves {someone.name}");
public static implicit operator Person(string name) => new Person(name);
}

class Program
{
static void Main(string[] args) => new Person("i").love("you");
}
}
>>
It can be a useful pattern but people who use it exclusively create abominations
>>
>>57701792
Makes sense
>>
File: 11-26-22-36-12.png (29KB, 777x571px) Image search: [Google]
11-26-22-36-12.png
29KB, 777x571px
>>57701822
No, but it provides enough sugar to do pretty much anything you want.
>>
File: game_theory.png (24KB, 679x225px) Image search: [Google]
game_theory.png
24KB, 679x225px
>>57697222

Checked!
>>
>>57702134
Oh, kinda shame still
>>
>>57701748
But you'd have to name it
plank_insert(plank, nail)

to avoid collision with insert methods for other types.
>>
>>57702138
Thank you for posting this hilarious comic!
>>
File: 11-26-22-55-44.png (44KB, 971x769px) Image search: [Google]
11-26-22-55-44.png
44KB, 971x769px
>>57702173
Well, there are 2 ways to go about what you want in C#, write all your methods as extensions, or use reflection to get the method pointers, which then would require the object on which to invoke the method as the first parameter.
>>
>>57696818
OOP is in fact *human* oriented programming in how it lets the programmer reflect human perception of reality in their code. Some say it helps large projects be more manageable and come to reality faster, which is mostly what sales and management want. I don't like how OOP makes writing compilers way more difficult due to the addition of new, complicated optimization scenarios. I suppose though that finding less autistic people for hiring as developers is cheaper and for that reason people will long for the easier way.

The procedural approach is more raw and abstract in how it practically only provides the fundamental means for defining algorithms, like arithmetics, functions/procedures, etc. In a language like C, we also have structures which let us avoid long function parameter lists, save memory and time spent on creating local copies of a function's parameters and organise large sets of tightly related variables. They differ from classes and their objects in the lack of inheritance, public/private keywords, compile-time OOP data structures (like vtables) and some other things. I love C, it's elegant and has basically everything I need. I find writing in it very rewarding.
>>
>>57702405
Just to illustrate, the static Insert() method is an infinite loop.
>>
>>57701748
It should be plank = insert(plank, nail);
>>
>>57702227
Gotta put it in its own module

>>57702405
Oh, extension methods seem nice for this. It's probably a hack to use them, but it would serve the purpose. Dat reflection tho.

>>57702475
Why would it _have_ to be?
>>
>>57701748
Too much noise, this is better:
nail plank insert
>>
File: java.jpg (63KB, 500x600px) Image search: [Google]
java.jpg
63KB, 500x600px
Reminder.
>>
>>57702552
If you give "insert" the discretion of assigning the result, you remove the choice of passing the result onto a different variable. Maybe you want plank to remain unnailed, but you want to create a new plank that's like the first plank, but nailed. Maybe you just want to evaluate the nailed plank without actually nailing it. Etc.
>>
>>57696818
OOP is shit, I agree.
>>
>>57697521
>what are static funtions
>what is building class libraries where the same object contains its parameters and the functions to work on the object itselfs
>what is the possibility to acces private proprierties of an object just with a function

yeah, no, your answer is shit
>>
Has anyone here who makes fun of OOP ever held a job making front-end software that had any relevance to any market whatsoever?
>>
File: 1420359084069.jpg (57KB, 500x600px) Image search: [Google]
1420359084069.jpg
57KB, 500x600px
>>
>>57702713
That's a separate issue from how the function/method is called. If you go with copying a la functional programming, you should also not be using variables but constants, so you'd do
newPlank = insert(plank, nail)
>>
>>57702801
really cool meme memester. you get a score of meme/meme

>>57702666
>>
>>57699642
You can't compare C to walking as walking is the safest form of transportation while C is the least safe language.
>>
>>57702772
>>what are static funtions
The best type of functions

>>what is building class libraries where the same object contains its parameters and the functions to work on the object itselfs
A module does the same thing

>>what is the possibility to acces private proprierties of an object just with a function
You really don't need to hide data. If you have a collection of methods to operate on plain records, its the users fault if he messes with the raw data in ways he shouldn't.

Why the hostility?
>>
>>57697948
>what else?
I don't know if it's relevant, but the programming challenge "program an Enigma clone" considered "hard" in the /g/ programming roulette took me half a day by heavily relying on OOP.
Implementing:
-the object "disk" to mimic the disks of the enigma machine, which had as properties the switching pattern and the initial position
-the object "enigma" which proprieties are 3 different disks objects and their order
-having the disk contain the function simulating the passage of current from one entrance of the disk to the curresponding exit
-having enigma contain the method to simulate the physical action of the disk rotation

Literally half a day, plus half an hour for the gui.

I don't know how long it would have taken and how ugly the code would have been with functional programming.
>>
>>57702859
Statistically speaking, you're dead wrong. Way more people are killed walking and being struck by cars or attacked by animals than people are killed by airplanes every year.
>>
>>57702666
>>57702801
>dragon
looks like a kite to me
>>
>>57701822
Sure, you just need to define the function as static in the class.

E.g. I make a class cls_math, and in that class I make a method Add
public static int Add(int a, int b)
{
return a+b;
}


then I can just call it with
int x = 1;
int y = 2;
int c = cls_Math.Add(x,y);


You just need to add the static part when writing the method.
>>
>>57697222

Get on my level..

class Person
def initialize() @i = "" end
def to_s() @i end
def method_missing(i)
@i << " #{i.to_s}"
i[-1] == "!" ? @i : self
end
end

Person.new.I.love.you!
>>
>>57701822
yes, you can define methods that way, and use them as if they were part of the object. It's called extension methods.
>>
>>57703144

Oh wait, this version is better:

class Person
def initialize() @i = "" end
def to_ary() [@i] end

def method_missing(i)
@i << " #{i.to_s}"
self
end
end

puts Person.new.I.love.you!
>>
File: handshake.gif (402KB, 400x252px) Image search: [Google]
handshake.gif
402KB, 400x252px
>>57697222
>>57703222

>222
>222

C# and Ruby confirmed for same power level.
>>
>>57703332
Well, both are shit
>>
>>57703430

(;__;)

You must be either a LISP or C guy.
>>
File: hahehhehehe.jpg (74KB, 640x629px)
hahehhehehe.jpg
74KB, 640x629px
>>57699642
/thread
>>
>>57701822
You mean like this?
public class Thing {
private string str;

public Thing(string str) {
this.str = str;
}

public void print() {
Console.WriteLine(str);
}
}

Thing t = new Thing("fuck");

t.print(); // normal
print(t); // what you mean
>>
>>57697186
Literally reversed POO
>>
>>57696818
It's fine the problem is that it doesn't play well with concurrency and asynchronous patterns.

The problem is the pajeets trying to sell you Java 8 is good for concurrency
>>
Is so hard to figure out that nobody can even do it correctly
>>
OOP is a meme
>>
>>57703076
In other languages it's called dragon
>>
>>57699642
Agree. Busfags kys.
>>
OOP is good but only when it's used correctly and sparingly, i.e. only when it improves code readability. Fuck Java and other such shit tier OOP languages for making EVERYTHING an object, though. There's no fucking need for that and it completely fucks up the way programmers approach problems. Instead of thinking about how to actually solve it they think about how their class diagram should look.

Java should've done it like C++ does and not enforce OOP on EVERYTHING but simply provide it as an available tool, as it should be.
>>
>>57704322
You literally can not make a complex, full-featured software without OOP.
>>
>>57704322
What are static class
>>
>>57704542
kek
>>57704544
a needlessly verbose language construct?
>>
What about OOLO?
>>
>>57704593
#include "math.h" // C++
using static Math; // C#


where Math is a static class containing math functions.

How are those 2 different?
>>
>>57704544
That's a work-around. It's like pissing on someone and then proudly handing them a poncho to protect them from your piss. Point is you shouldn't have been pissing on him in the first place.

>>57704542
You definitely can, but that's not the point. I said OOP is good. It's just that some languages and a lot of programmers go full retard with it, which is wrong.
>>
>>57704659
one will give you segfaults
>>
> ITT: people using OOP languages
> not using actual message passing as smalltalk or erlang convey
> claiming to say they know OOP

kill yourself /g/
>>
Is there a language doing OOP right? People defending OOP always say that Java/C#//C++ are doing it wrong. What language is doing it right if any?
>>
>>57704659
you needed to define a class and put "static" in front of every """method"""
>>
>>57698284
Don't listen to the shills this is much better than java. Go is actually a really good language.
>>
>>57704918
Another go example, but with channels, which most people on /g/ will never be able to understand:

package main

func main() {
names := make(chan string, 2)
names <- "Herman"
names <- "Stacy"

println(<-names, "loves", <-names)
}

>>
>>57705075
Then why don't you explain what they are, I have never seen go before in my life, my guess is that you're creating a stack or a queue and then populate then pull. What's so special here? it's inherently thread safe or something?
>>
>>57704918

Go is actually a really retarded language that looks good unless you do some serious work with it.
>>
>>57704677

if you couldn't even deal with pointers,then you shouldn't even on programming in the first place.
>>
>>57705320
I'm almost exclusively using Go at work. It's pretty amazing to work with. We're doing microservice architecture though. I guess I can imagine that building monoliths in it might be a pain.
>>
>>57705320
>get paid lots of money
>work remotely
>fun to write gocode
>fastest growing programming language

you're just jealous that you wasted your life learning a bastard language like java or c++.
>>
>>57705508
>using "fastest growing unironically
>>
>>57705375

For small tasks it might be an interesting option, I don't know. I have to say I'm not an expert of Go, I just realized some shortcomings I didn't like at all. See:


>>57705508

I'm not really jealous, rather sad about some wasted opportunities in Go.

Is it fun to write Go? Yes and no. I think the lego-like way of putting things together is funny. The syntax is cute. But it's super annoying that you have to do everything yourself in such tiny steps. In a world where most modern languages have simple yet powerful tools from functional languages it's just a pain in the ass if you want some list iterating/processing and crawl through a pile of code.

But my main concern are the channels. They are a great idea. When I first heard about Go I really found the language amazing. But then I realized when it's getting more and more complex channels have some limitations that I'm not willing to take.


If you want my uneducated opinion:
Make Go much faster (C-like), add some better ways to process things (without extra libraries) and give the go-channels a powerup and better concurrency model and you can count me in.
>>
>>57696818
>Oh you want a Donut?
>Time to drag the whole Universe in so that you can take a .Bite()
>>
what went wrong is that servers started to have more than 256mb of ram. nobody gives a shit about your wrong on purpose hipster opinion grandpa. stay unemployed
>>
>ITT: people who don't have the IQ or education to grasp OOP

Seriously. All the OOP complaints I ever read on /g/ can be solved by having a more intelligent programmer and/or a programmer who has actually studied good design patterns and good examples of software engineering.

OOP is not a solution for everything. But it is the better solution for most things. If you can't get it, maybe get a job fixing shit at Geek Squad and leaving software engineering to people who can actually engineer.
>>
>>57698313
>Leggable
>AbstractInterfaceFactory
>subHuman
Every time
>>
>>57697521

My theory is that the OOP method call feels easier to people who think in English.

English is a Subject-Verb-Object language. (e.g. You are a fag). This maps to the syntax S.V(O).

Normal function calls read like V(S, O) and are Verb-Subject-Object, which is extremely uncommon throughout the world.
>>
>>57706120
that's pure functional programming
world' = update(world)
>>
>>57697456
>t. /g/ autist that never wrote maintainable/extendible code
>muh successor must sift through my spaghetti code to understand how to patch this shit
This is neither about pattern overuse nor about indian-tier loss of abstraction, you don't build a house on a flimsy foundation and neither you bolt down furniture everywhere.
>>
>>57699738
>https://qt.vidyagam.es/IcDmsJb.jpg
more precisely, it's an perfect example of a poor developer. Sure OOP will LET you be an idiot, doesn't mean one should take advantage of that fact.

This example was terrible implimentation
>>
>>57706120
>tfw you just want a banana but you are given a gorilla holding the banana in a jungle.
>>
>>57696818
The OOP fags don't even have any formal definition for the crap they churn. What a pitiful bunch of souls
>>
>>57701881

lambda expressions ftw.

I love that they're implementing the null conditional operator in 6.0.

C# really is a beautiful language; and was the language via which I learned OOP.

I spend most of my time writing PS scripts of 500 less lines these days though. Still try to implement OOP when its advantages (and don't tell my boss, but sometimes when it's not just for the practice so I don't lose the skill. No one else on my team learned OOP. I'm the resident software dev in a devops team)
>>
>>57706834
This

Most OOP criticism is made by unskilled amateur programmers who either don't have the experience or are too stupid to understand it. Whenever I hear specific complaints it's always something ridiculously retarded or simply wrong. Have fun getting jobs in the real world with this kind of attitude kids, noone will want to work with you.
>>
>>57702134

>No, but it provides enough sugar
Quality reference to syntactic sugar. +1

But I hate your indent style.

Stroustrup 4 lyfe
>>
>>57702134
Where is my union then?
>>
File: 11-27-04-19-29.png (7KB, 307x167px) Image search: [Google]
11-27-04-19-29.png
7KB, 307x167px
>>57707281
Or did you mean something else?
>>
>>57705302
Yeah, and go has syntactic sugar for it. Retarded, isn't it?
>>
>>57696818
most of it's bretty OK, but you can easily nitpick some of the core aspects.

> rigidity and fragility of APIs and library ABIs
> -- god forbid you ever try shipping a C++ library and ever needing to change basically anything
> -- name mangling to maintain C linker compatibility, which is entirely vendor specific in C++

> exceptions - an awful abstraction in both theory and implementation.
> -- "zero-cost" (tables) implementation bloats the fuck out of binaries
> -- are basically invisible parts of method signatures
> -- union types would probably have been smarter
> -- can't be universally applied because of double faulting in e.g., destructors
> -- which in turn weakens RAII since destructors can't be allowed to carry information for any error, much less N errors

> rigid member layout can be bad for high performance scenarios
> -- arrays of objects are slower to process than arrays of just the fields of interest, even with strided HW prefetch
> -- vtables are slower than directly (redundantly) stored function pointers when memory isn't too constricted

> ...
>>
File: 11-27-06-10-32.png (23KB, 652x457px) Image search: [Google]
11-27-06-10-32.png
23KB, 652x457px
>>57708691
wow, could add some locks to mimic go, if the one in go is thread safe.

what is the point of this?
>>
>>57697222
ONE

NOTHING WRONG WITH IT
>>
>>57696818
Yes.
>>
>>57708958
>> rigidity and fragility of APIs and library ABIs
This is a fundamental problem of code calling external code. OOP helps you manage it, but it never goes away under any paradigm.

>> exceptions - an awful abstraction in both theory and implementation.
They're awful because of how professors teach people to use them. You should either catch an exception immediately because it's expected and can be easily resolved allowing the task to continue, OR at a very high level. Not in between. Organize your code into atomic tasks or actions that need to complete or report a problem and the picture becomes clear.

Personally I also hate the tendency to make a subclass for every dumb fuck error that can happen. IMHO an exception should just carry info for recording/reporting. 99% of the time you don't need a specially named class.

> -- are basically invisible parts of method signatures
THAT is actually a damn good complaint. But I still prefer exceptions to returning a damn error indicator from every function (the old way).
>>
>>57705302
>>57708691

Are both of you incapable of understanding concurrency? Do you honestly think go routines are nothing but a simple stack that you push and pop from?
>>
>>57707118
We do though. Babby is taught the four OOP principles in his second week of CS.
>>
The problem really stems from bad programmers using classes for absolutely everything, other rather than using polymorphism. I think a lot of OOP programmers would benefit if they learned OOP Design Patterns.
>>
cat dot v
cat dot v
>>
File: 1474462418010.png (552KB, 1936x5960px) Image search: [Google]
1474462418010.png
552KB, 1936x5960px
>>
>>57702935
>I don't know how long it would have taken and how ugly the code would have been with functional programming.

I wrote a gameboy emulator in C that basically mimicked C++ by using structs with pointers/function pointers, and surprisingly it wasn't ugly at all.
>>
>>57706489
Data does not act. Thinking of data as an actor is asinine. It should just be V(O). No subject needed. Thinking in terms of a subject corrupts one's understanding of what the computer is actually doing.
>>
>>57702984
So if i cut my legs off i'm fine?
>>
>>57710811
This is really a shit implementation regardless of OOP.
The problem lies in the guy writing the uml being a retard, not In OOP design.
>>
>>57697910
I can hear the curry running down your fat stomach from here
If you're not thinking in terms of how electrons are displaced by transistors you're making useless abstractions
>>
>>57701612
>The best programs would be written directly in assembly.
If you have a million years to do it and don't figure you'll need to make any significant changes to it at any point in the future, sure.
>>
>>57715623
That was his point
>>
>>57701748
you insert a nail into a plank

i find where OOP gets retarded is when you move away from real-world modelling
>>
>>57702405
>>57707469

Is that on Visual Studio?

If so, what font is that and how do you make it look so smooth?, I've tried all kinds of fonts and tweaks and everything looks like shit, I gave up a long time ago and settled on Consolas. Shitty font rendering is the only thing I hate about developing on .NET
>>
>>57696818

I think hybrid FP OOP is interesting, I'm currently writing a majority of my code in this style. It's hard to get right, and I do miss C, but not enough to look back. Maybe when scala native becomes good I can incorporate more C code when it fits.
>>
File: OOP strikes back.jpg (67KB, 1006x692px) Image search: [Google]
OOP strikes back.jpg
67KB, 1006x692px
>>
>>57696818
>Is the "object model" inherently flawed?
Yeah, it's literally broken, that is why nobody uses Java , C++, C#, they're practically dead languages, everyone is moving to C! C is becoming THE enterprise solution.
>>
>>57716718
>assigning instance to variable and then assigning a new one on the constructor
>improper overriding of toString method
>unnecessary use of Integer.toString when you can print the int directly
>you already have a different method to do the addition in it anyway
>dem comment segregation
LITERALLY PAJEET
>>
>>57698284
Go could be excellent if it wasn't for its retarded and too formal syntax
>>
File: oop p2.png (57KB, 682x473px) Image search: [Google]
oop p2.png
57KB, 682x473px
>>
File: OOP.png (69KB, 1210x467px) Image search: [Google]
OOP.png
69KB, 1210x467px
>>
>>57698284
> Person is a struct
> copies/clones of people everywhere made accidentally from everyday trivial interactions

Imagine if real life was like that.
>>
>>57717198
it is
>>
>>57700826
this, some people over-complicate the code just to say that they're "really using oop, and not old bad funcional programming, look at me, I'm so hip and new"
>>
>>57703607
explains everything desu
>>
>>57697706
In group projects, oop makes working on code significantly easier.
>>
>>57702134
How is that called, "binding" static methods to object parameter methods ? With the "=>" symbol
>>
>>57717110
Bridge Pattern?
>>
>>57707195
idk about c# tho

It feels very bloated if you're not familiar with it. Especially that public and private stuff. The next problem is that Visual Studio does so much work in the background that you miss a lot of short cuts which makes everything less understandable.

What would recommend for tackling c#. Probably some ps scripting. Is it possible withouth the entire .net framework pulling strings?
>>
>>57717977
yes, it has a lot of names.
>>
>>57718034
What about that public and private "stuff" is bloat? If you don't understand the fundamental principle of oop why are you even voicing an opinion
>>
>>57718612
I looked at c# in the summer. This is the only thing I can really recall of 1 month looking into it. It made sense back then but expects more planning in advance than you'd need when you just write a few lines of code.

However, the main motivation of my post what the question and everything before was leading to this question.
>>
>>57718034
>public/private
>bloat
Encapsulation is one of the defining pieces of OOP....
>>
>>57718714
A lot of OOP languages were never meant for scripting, it defeats the purpose of OOP.
>>
>>57718799
you've got that backwards
>>
Polymorphism is a great feature of OOP that lets you make cleaner and more maintainable code.

Doing something such as
Person you = new Faggot();
Person me = new NotFaggot();
milkMuseum(you);
milkMuseum(me);

can save you a lot of time and refactoring.
>>
>>57696818
As it turns out, not many things in the world of programming can be modeled with objects

OOP however, is perfect for UI programming
>>
>>57716718
Why in hell do you initialize Die1 and Die2 both in the properties and in the costructor?
Is this some Java retardation?

Also what's the need to define a group of two dices by grouping two dices.
Create a method where you can initialize N dices with M facese and you can set the method for a group of dices.
If you want 1d6 you can simply create a group with 1 die with 6 faces.

This approach makes literally no sense.

Also why the fuck 3 different methods, one for die1, one for die2 and one for both of them.
Holy shit that code is retarded and has zero reusability.
>>
>>57720457
OOP
>>
>>57720588
No, POO in LOO programmer.

OOP doesn't mean you have to reproduce reality 1-1.
It means you can recreate some aspect of reality to simplify the mental approach to a task.
That approach is retarded, and the implementation too.
>>
>>57718850
This. OOP-focused languages like Java are great for polymorphism.
>>
>>57720622
>OOP doesn't mean you have to reproduce reality 1-1.
because reality isn't object oriented
>>
File: IMG_6914.jpg (30KB, 403x403px) Image search: [Google]
IMG_6914.jpg
30KB, 403x403px
>>57696818
Smalltalk is great, that's how object oriented programming should be done.
>>
>>57696818
No, just overused. It's good when handling multiple stateful components. You should avoid computing with state when possible, and when state is necessary you should use objects and classes to formalize the safe handling of state and abstract it in a way that other stateful procedures cannot modify it in an unsafe way.

It's not inherently flawed, it's just that most programmers have zero knowledge of how to use their models of programming correctly, or think you can only use one at a time.

Opinion: OOP is a great model for highly dynamic and interactive models, but the most popular OOP-focused languages are static and non-interactive by default, so most programmers don't have a clear idea of the strengths of OOP or how to use OOP in a way that leverages its strengths and they end up trying to work against the model. Then they end up as either bad programmers or as people who think that "OOP is evil/flawed!!" instead of just another tool available for them.
>>
>>57720645
But java misses the next important part: operator overloads.
It leads to the most unreadable code if you use any form of math or you want logic based functions in your objects.
>>
What's the point of putting it in an object?

data Person = 
Person { name :: String }

loves (Person name1) (Person name2) =
putStrLn (name1 ++ " loves " ++ name2)

main =
Person "I" `loves` Person "you"
>>
>>57721505
The example is too simple to apply any meaningful structure to it.
If a class only holds one value or has one function, it should not be a class.
>>
>>57715359
>>57710811
UML is fucking retarded.
>>
>>57716867
>>unnecessary use of Integer.toString when you can print the int directly
Aren't you supposed to return a string in a toString method?
>>
>>57696818
Simula-derived OOP that is implemented in C++ is flawed. Smalltalk-derived OOP implemented in CLOS, Objective C, Ruby is actually useful.
>>
>new SOLID fad followers trying to cling onto OOP
>every function in its own class
>tfw they're just writing overly verbose functional programming at this point

I love seeing

new FooDoer.doFoo(bar)
.
>>
>>57721308
One of the major downsides of Java is that there is no operator overloading which is fucking retarded.

object.add(object2);


is fucking retarded.
Why can't they just allow
object = object + object2;
?
Thread posts: 185
Thread images: 18


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.