Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-

An EXPERT PROGRAMMER explains OO

Name: Anonymous 2008-03-19 11:50

Because I know you were all having so much trouble with this difficult concept.

http://theunixgeek.blogspot.com/2007/11/understanding-object-oriented.html

Name: Anonymous 2008-03-19 11:55

Everyone can explain OO, try to explain nomads.

Name: Anonymous 2008-03-19 12:00

HASKELL. HASKELL NOMADS.

Name: Anonymous 2008-03-19 12:20

Well, to put it quite simply, SCHEME.

Name: Anonymous 2008-03-19 12:25

The forced usage of
Nomads to do I/O
Thread over

Name: Anonymous 2008-03-19 12:53

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: Anonymous 2008-03-19 13:31

Why the fuck do you need to explain it? -- OOP is useless!

Name: Anonymous 2008-03-19 13:32

I don't understand why people say that you can\'t do OOP with C

Name: Anonymous 2008-03-19 13:35

>>6
No, that's procedural programming.

Name: Anonymous 2008-03-19 14:27

>>9
Actually, that's the transition from procedural to OOP.

Name: Anonymous 2008-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: Anonymous 2008-03-19 14:37

>>8
You can't, because if you're using C you should know better.

Name: Anonymous 2008-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: Anonymous 2008-03-20 15:16

>>9
Actually, that's non-pure OO languages like Sepples.

Name: Anonymous 2008-03-21 0:40

Oh, fuck all of that enterprise faggotry. I'm so goddamn EXPERT 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: Anonymous 2008-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: Anonymous 2008-03-21 0:50


HASKELL. HASKELL NOMADS.

Name: Anonymous 2008-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.

...and that is OOP.

Name: Anonymous 2008-03-21 4:24

>>15
So you'll be an Austrian nobleman?

Name: Anonymous 2008-03-21 4:46

>>19
This may surprise you, but I invented that meme.

Name: Anonymous 2008-03-21 4:50

>>20
This might surprise you, but you missed the reference.

Name: Anonymous 2008-03-21 5:28

>>21
This may surprise you, but Cake is a shitty band.

Name: Anonymous 2008-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.

...and that is Sparta.

Name: Anonymous 2008-03-21 5:45

>>22
This might surprise you, but why should I care about your opinion?

Name: Anonymous 2008-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: Anonymous 2008-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

Name: Anonymous 2008-03-21 13:16

>>23
Yes, they are equivalent.

Name: Anonymous 2008-03-21 13:33

λBasic.NET++, 2008 Edition

Name: Gerald Sussman 2008-03-21 13:54

Help me solve this problem I found in an old beta version of my SICP.

Implement the car primitive using only the cdr primitive.

Name: Anonymous 2008-03-21 14:58

(def (car 'x y) (cdr (cons 'y x)))

Name: Anonymous 2008-03-21 16:51

>>30
Uhm, quote failure.

Name: Anonymous 2008-03-21 17:03

Prelude> mapM (putStrLn . show) [1..4]
1
2
3
4
[(),(),(),()]

Uhm, where did that list of empty tuples come from?

Name: Anonymous 2008-03-21 17:06

>>32
putStrLn :: String -> IO ()

Name: Anonymous 2008-03-21 17:09

>>33
So I map it along a list of one-element lists and one empty list. That's not a reason to show the last nil as empty tuples.

Name: Anonymous 2008-03-21 18:05

>>32
Nomads.  Haskell nomads.

Name: Anonymous 2008-03-21 18:07

>>34
?
The 1, 2, 3, 4 are printed as a result of calling putStrLn on each element. The [(),(),(),()] is the resulting list from your mapM call.

Name: Anonymous 2008-03-21 18:16

>>36
The [(),(),(),()] is the resulting list from your mapM call.
Huh?

The show part actually transforms the list to a list of strings and a nil at the end, right? Why would it return [(),(),(),()] ?

Name: Anonymous 2008-03-21 18:20

>>37
                  /      \
               {       ヽ
         ____   ハ     }
         ̄`>: : : : : ∨: : ー‐ --yz 、
         /: : : : : : : :/: : : : : : : : : : 、: :\
       /:_: : : : :/: : /: |: : : : : : : : : : :\: : ヽ
      / /// : :/: : :/:/:!: : :.:.|、: : : : : : : \: :.',
.      {/ // : :/: : :/_/:小:. :.:.|_ヽ__: : : : ヽ: l
        l/l : : !: : 7゙/ノ l| V:.|  \: : : :、 : : l: |
         |: :/|: :/:/  j|  ヽ|   \: : \: :!: \_
         |/ |;/l/x≡≡   |≡≡z.ハ: :.ヽl\: : : :\
        r┬z/:.:|           ∠─-ヘトr-く ̄ヽ :\
       r「「l {: : :\    ‐    ////「 { \ヽ:.:\ \ :\
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓

Name: Anonymous 2008-03-21 19:02

>>37
Haskell. Haskell Nomads.

Name: Anonymous 2008-03-21 19:26

>>38
Konachan kawaii

Name: Anonymous 2008-03-21 20:29

>>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 Joints 2008-03-21 21:13

>>41
I am a EXPERT HASKELL PROGRAMMER and agree whole-heartedly.

Name: Anonymous 2008-03-21 22:03

>>43
Same person and we have been trolled constantly.

Name: Anonymous 2008-03-22 5:45

>>32-42
GET THE FUCK BACK ON TOPIC OR I'LL REPORT YOU.

Name: Anonymous 2008-03-22 5:49

>>41
What does `_' in ``mapM_'' stand for?

Name: Simon Peyote Joints 2008-03-22 7:36

>>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}

Name: Anonymous 2008-03-22 13:44

>>45
it means it's a version of mapM which doesn't return a useful value

Name: Anonymous 2008-03-22 14:54

>>45

It stands for _ _ _ (please use lazy evaluation / tail recursion).

Name: Anonymous 2008-03-22 15:09

>>45
mapM :: (Monad m) => (a -> m b) -> [a] -> m [b]
mapM_ :: (Monad m) => (a -> m b) -> [a] -> m ()

Name: Anonymous 2008-03-22 15:31

>>49
OK, I think I understand, but what is a Monad?

Name: Anonymous 2008-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: Anonymous 2008-03-22 15:39

>>51
Ahh, that explains why virtually nobody knows how they work.

Name: Anonymous 2008-03-22 15:57

Hehe, Simon Peyote Joints.

Name: Anonymous 2008-03-22 15:57

>>53
Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo.

Name: Anonymous 2008-03-22 15:57

>>54
WUT

Name: Anonymous 2008-03-22 16:17

>>55
is a Xarn Roll

Name: Anonymous 2008-03-22 16:29

Name: Anonymous 2008-03-22 17:02

>>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: Anonymous 2008-03-23 4:29

OO IN A NUTSHELL:

STRUCTS WITH METHODS

THAT IS ALL

Name: Anonymous 2008-03-23 5:50

>>59
Structs with data, methods, polymorphism, encapsulation.

Name: Anonymous 2008-03-23 6:41

>>60
All structs have data, and encapsulation is a natural result of having structs with methods.

Name: Anonymous 2008-03-23 6:48

Abstract data types != OOP.
>>59 is an EXPERT SEPPLES PROGRAMMER.

Name: Anonymous 2008-03-23 15:58

expert programmer explains typeglobs
http://www.youtube.com/watch?v=-8qzXWKN8lE

Name: Anonymous 2008-03-23 16:15

>>63
It's official: you must be totally wasted to write perl.

Name: Anonymous 2008-03-23 16:59

>>63
http://www.youtube.com/watch?v=94t2tTHZ25M
DIRRR basically gives you all the nams in the namspace

Name: Anonymous 2008-03-23 20:38

a way to make "I don't care" a good answer to the question "How does this work?"

Ignorance considered harmful and ultimately destructive.

Name: Anonymous 2008-03-24 4:00

>>66
That's why you've memorized the source of your whole standard library, right?

Name: Anonymous 2008-03-24 6:25

>>67
Not >>66 but I know how to implement any std c function and a large portion of the POSIX ones. what now bitch?

Name: Anonymous 2009-07-21 2:03


Resultinglist from yourmapM call Huh!

Name: Anonymous 2010-11-25 22:20

Name: Anonymous 2011-02-27 15:34

[/o]

Name: Anonymous 2011-02-27 15:36

Name: Anonymous 2011-02-27 15:40


Name: Anonymous 2011-02-27 15:42

Name: Anonymous 2011-02-27 15:44


Don't change these.
Name: Email:
Entire Thread Thread List