He fails just like almost every other OOP explanation out there. The proper way is to, once your audience knows C, explain how OOP can make programming more simple and efficient by replacing structs and pointers to functions with objects containing methods and data. That is better than pointless hand-waving about how OOP can model real-world objects.
tl;dr:
- you have one or more structures containing data
- you have one or more functions that, taking a pointer to said structures, does something with the data
- the structure definitions are the classes
- allocated structures are objects
- the functions are methods of the class
...and that is OOP.
Name:
Anonymous2008-03-19 13:31
Why the fuck do you need to explain it? -- OOP is useless!
Name:
Anonymous2008-03-19 13:32
I don't understand why people say that you can\'t do OOP with C
>>9
Actually, that's the transition from procedural to OOP.
Name:
Anonymous2008-03-19 14:31
terrible, yes.
also anyone who doesn't intuitively understand the encapsulation of state and function in creating an Abstract Data Type should stop using computers immediately.
also (examples given in Objective-C)
what
Name:
Anonymous2008-03-19 14:37
>>8
You can't, because if you're using C you should know better.
Name:
Anonymous2008-03-20 15:11
>>8
They say that because they're too weak to bother with all the manual hacks you need to keep up-to-date all around your code in order to do proper inheritance and polymorphism in C.
Name:
Anonymous2008-03-20 15:16
>>9
Actually, that's non-pure OO languages like Sepples.
Name:
Anonymous2008-03-21 0:40
Oh, fuck all of that enterprise faggotry. I'm so goddamnEXPERT I don't even document half the code I write, and its ALL in C. Fuck enterprise, fuck OOP, fuck even the ABSTRACT BULLSHITE, I'm an [sup][u]EXPERT[/sup]C programmer and I'm damn proud of it.
Name:
Anonymous2008-03-21 0:46
This tutorial is so sad. I could explain OOP better in fewer words with half my brain tied behind my back.
Name:
Anonymous2008-03-21 0:50
HASKELL. HASKELL NOMADS.
Name:
Anonymous2008-03-21 1:00
>>6
No you dope, OOP is two things: a way to make "I don't care" a good answer to the question "How does this work?", and a method to enable more extreme late binding in your programs. By describing OOP from the bottom up, you've managed to completely miss the point, and mislead who knows how many noobs.
tl;dr
- In OOP you construct programs by asking objects to perform tasks for you, and you don't need to worry about how it happens.
- Objects are so modular that they can be substituted for one another at any time, letting you more easily write programs whose behavior is decided at run-time when your program has the information it needs to decide that behavior.
>>21
This may surprise you, but Cake is a shitty band.
Name:
Anonymous2008-03-21 5:44
>>18
- In Lambda Calculus you construct programs by asking functions to perform tasks for you, and you don't need to worry about how it happens.
- Functions are so modular that they can be substituted for one another at any time, letting you more easily write programs whose behavior is decided at run-time when your program has the information it needs to decide that behavior.
>>22
This might surprise you, but why should I care about your opinion?
Name:
Anonymous2008-03-21 11:57
>>23 - In Lambda Calculus you construct programs by asking functions to perform tasks for you, and you don't need to worry about how it happens.
Same as in QBasic programming.
Name:
Anonymous2008-03-21 12:38
>>25
But then again, QBasic is pretty awesome.
In fact, I can think of only one thing that would be more awesome.
Gentlemen! I present to you... λBasic.NET
>>37
No, the putStrLn . show part transforms the list of numbers to a list of ()'s, printing a bunch of strings as a side effect. The return value is [(),(),(),()]. It's printed because ghci assumes that any non-() value is potentially interesting.
If that's not what you want, make sure that the return value is (), e.g. by using mapM (putStrLn . show) [1..4] >> return (). However, an EXPERT HASKELL PROGRAMMER would use library functions to his advantage and simply write mapM_ print [1..4] or even putStr . unlines . map show $ [1..4].
Name:
Simon Peyote Joints2008-03-21 21:13
>>41
I am a EXPERT HASKELL PROGRAMMER and agree whole-heartedly.
Name:
Anonymous2008-03-21 22:03
>>43
Same person and we have been trolled constantly.
Name:
Anonymous2008-03-22 5:45
>>32-42
GET THE FUCK BACK ON TOPIC OR I'LL REPORT YOU.
>>45
It stands for 8. Black hole register "_ quote_
When writing to this register, nothing happens. This can be used to delete
text without affecting the normal registers. When reading from this register,
nothing is returned. {not in Vi}
It stands for _ _ _ (please use lazy evaluation / tail recursion).
Name:
Anonymous2008-03-22 15:09
>>45 mapM :: (Monad m) => (a -> m b) -> [a] -> m [b]
mapM_ :: (Monad m) => (a -> m b) -> [a] -> m ()
Name:
Anonymous2008-03-22 15:31
>>49
OK, I think I understand, but what is a Monad?
Name:
Anonymous2008-03-22 15:38
>>50
Monadic methods, also known as monads, are communities of people that move from one place to another, rather than settling down in one location. There are an estimated 30-40 million monads in the world. Many cultures have been traditionally monadic, but traditional monadic behavior is increasingly rare in industrialized countries. There are three kinds of monads, hunter-gatherers, pastoral monads, and peripatetic monads.
Name:
Anonymous2008-03-22 15:39
>>51
Ahh, that explains why virtually nobody knows how they work.
>>2
The guy linked in the OP can't.
Everyone's complaining about how it's the wrong way to explain OO, but they're failing to notice that his explanation is wrong.
Name:
Anonymous2008-03-23 4:29
OO IN A NUTSHELL:
STRUCTS WITH METHODS
THAT IS ALL
Name:
Anonymous2008-03-23 5:50
>>59
Structs with data, methods, polymorphism, encapsulation.
Name:
Anonymous2008-03-23 6:41
>>60
All structs have data, and encapsulation is a natural result of having structs with methods.
Name:
Anonymous2008-03-23 6:48
Abstract data types != OOP. >>59 is an EXPERT SEPPLES PROGRAMMER.