Skip to main content
GameDev.net gamedev.net
🔒 Locked

what is object oriented programming?

Started by -F- Apr 11, 2002 at 12:25 PM 5 replies 350+ views
Original Post
-F-
-F-
i dont catch the point, what object oriented programming is and what advantages it has. i write what i think it is: -very less global variables -collect functions in classes ...
blahpers
blahpers
You're listing physical attributes of an object-oriented program. Object-oriented programming is the natural implementation of object-oriented design, which is a philosophy, a way to organize everything your program is and does into separate components that interact with each other. That's the best way I can explain it in 100 words or less, anyway.

This isn't the kind of question that can be fully answered on a message board. Pick up a good book on the subject (preferably without the words "Teach Yourself in X Days" or "for Dummies" in the title) and curl up with it. It takes a while to get the hang of it, especially if you've written a lot of structured programs (e.g., C and Pascal programs).

[edit]punctuation foobar[/edit]

---
blahpers


[edited by - blahpers on April 11, 2002 2:44:59 PM]
---blahpers
bob_the_third
bob_the_third
In my opinion the best way to learn object-oriented programming is to learn Java. If you want more info on the benefits of OOP...well actually it's more difficult to explain why you should use a development methodology than it is for you to learn why on your own by experimentation. Here are some books I would suggest:

For C++
1. Object Oriented Programming in C++, Third Edition by LaFore ISBN: 0-57169-160-X
2. hmm...I can't seem to find the second one. If I do I'll post that one too...


For Java:
1. Thinking in Java, Second Edition by Bruce Eckel ISBN: 0-13-027363-5
You can download a free (and legal) copy of this book online from the website www.BruceEckel.com.
This is an excellent instructional book but you'll probably want another one to use as a quick reference.
2. Okay, so I don't have any other Java books...
Don't forget to check out Sun's documentation for Java at java.sun.com.

Anyhow, that's my two cents. Hope it helps.

[edited by - bob_the_third on April 11, 2002 6:39:37 PM]
blahpers
blahpers
quote:
Original post by Anonymous Poster
The weakness of this analogy is that cartoon animals don''t wear pants, whereas this kind of OOP likes to hide its privates.

If I''d been drinking milk when I read this, I''d''ve shot it out of my nose and all over my nice NEC monitor. *LOL*

---
blahpers
---blahpers
Chem0sh
Chem0sh
Games tend to lend themselves very well to OOP. Most of the time, it''s more natural to think of a game as a collection of interacting objects rather than a collection of functions and data structures. It can really speed up your design because you don''t have to mold your programming paradigm around a type of problem that it doesn''t naturally fit. I had to write a game for a computer science class in pure C. I know that if I could have used C++ or Java the whole design phase would have been considerably shorter.

In other words, OOP is excellent if you have the right kind of problem. But it definitely isn''t the "Be all, end all" of programming paradigms.
/*=========================================// Chem0sh// Lead Software Engineer & Tech Support// http://www.eFaces.biz=========================================*/
granat
granat

I''m going to try to answer your question..

The point of OOP is to divide your code into seperate boxes. Let''s imagine a shoot''em up game.

You have on box filled with code for the spaceship. Then a box containing code which can draw stuff to the screen.

You update the sprite based on keyboard and when it''s time to show it on the screen the sprite box calls the drawing box and tells it to draw a spaceship on the screen.

The spaceship can not look inside the Draw-Box. It can only call certain functions allowed by the Draw-Box.

Why is that cool ?

1. You can keep all the gfx code in one box making it easier to alter later.

2. When you do alter the drawing code you can alter the "secret" code inside the box without having to alter the spaceship code ( provided you don''t alter the certain functions available to the spaceship). You could change API from Direct3D to OpenGL without having to change the gamecode.

Why don''t you people understand danish? It would be so much easier..

-------------Ban KalvinB !

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.