Object Oriented, Garbage collecting ect.

Content and general development discussion, including maps, quests, and server code from the development team.
Ardaen
Peon
Peon
Posts: 24
Joined: Thu Jul 01, 2004 7:51 pm

Object Oriented, Garbage collecting ect.

Post by Ardaen » Sun Jul 11, 2004 5:54 am

All right, what are your opinions?

How many people here have really worked with object oriented programming and can define what it means in thier own words? What does everyone think about oop?

How about garbage collection, how do you all feel about it and similar automatic and semi-automatic methods of memory management?
User avatar
ElvenProgrammer
TMW Adviser
TMW Adviser
Posts: 2526
Joined: Tue Apr 13, 2004 8:11 pm
Location: Italy
Contact:

Post by ElvenProgrammer » Sun Jul 11, 2004 9:07 am

I've learned Java at school, I had many courses on it, so I have a good experience with oop and I pretty know how garbage collecting daemon works in the JVM. Unfortunately I have no experience with C++, but if it's like in Java then it is not very useful in games because you have to keep memory usage as low as possible. In most cases that is acceptable and surely also in this one.

What I feel about oop? Well I like it because it helps a lot in writing code: it's more ordered and easy to understand!
Ardaen
Peon
Peon
Posts: 24
Joined: Thu Jul 01, 2004 7:51 pm

Post by Ardaen » Sun Jul 11, 2004 11:52 pm

Elven Programmer wrote:you have to keep memory usage as low as possible
Errr...?
User avatar
ElvenProgrammer
TMW Adviser
TMW Adviser
Posts: 2526
Joined: Tue Apr 13, 2004 8:11 pm
Location: Italy
Contact:

Post by ElvenProgrammer » Tue Jul 13, 2004 7:04 am

Well in Java memory is freed when you don't have a pointer referring to it, but is freed when the garbage collector decides to do that not immediately, so there are moments in which memory is wasted..
Ardaen
Peon
Peon
Posts: 24
Joined: Thu Jul 01, 2004 7:51 pm

Post by Ardaen » Tue Jul 13, 2004 5:31 pm

It all depends on which java vm you use.

But on most I'd assume the garbage collector runs reasonably often, mostly when the program is idle, or when the program is trying to allocate more memory.

So, if you set your garbage collector to run when the program is idle or more memory is requested, what does it matter that memory isn't freed immediately?

Its better than manual memory management in my opinion. Ofcourse I may only have that opinion because of the number of programs with large memory leaks that I've had to work with. Atleast with a garbage collector it eventually frees the memory, unlike a leaky program with manual memory management.
VDM
Peon
Peon
Posts: 13
Joined: Mon Aug 23, 2004 8:41 pm
Location: Netherlands
Contact:

Post by VDM » Wed Aug 25, 2004 10:53 pm

I like both. What do you want to use it for?
It depends on the job that needs to be done.

C/C++ is cool (by my opinion), but takes more time and mainly couses different kinds/types of bugs, errors. just because you have to keep track of all memory allocations by yourself. Again it all depends on the job that needs to be done. If you can write good programs in C# or java and faster then then in c/c++ what would keep you from doing so when it saves you money? It eliminates a layer of complexity wich is a good thing most of the time. This also saves the less experianced programmers a bit and let them do what they want more easly.
To bad mono and monodevelop are not (that) stable yet :(

The only drawback from Java is the Sun issue and the virtual machine.
Before i started with Java i wasnt real optimistic about it, yet once i got the hold of it i started to like it and see the benefits.


Ofcause this is completely subjective, and you might experiance it otherwise :wink:
Posts++
User avatar
Shura
Peon
Peon
Posts: 96
Joined: Tue Jun 15, 2004 2:36 am

Post by Shura » Thu Aug 26, 2004 7:49 am

what does all this have to do w/ oop? gc is a common thing to do even w/o any advanced prgram-architecture! i don't see the point in that question...
doing classes in c++ does not necessarily mean that you're programming object oriented, as well as not using classes is not always non oop. ;)

btw, you should only use java when you want to hide your source-code and still keep the program platform independent to some degree (usually only between windows versions). java is always slower, whatever you do b/c of the fact that the bytecode needs to be interpreted !again! even though cou compiled it previously! on top of it, it's a non-free development language as long as you need comercial sdks in oder to be able to take advantage of all features. my suggestion is using php5 if you don't want to worry about low level stuff. :)

anyway, most people do not seem to understand that they don't need to do all that low-level stuff over and over again. there are so many libraries already premade! you get the whole stl out of the box w/ gcc so why worry about memory allocation when u don't want to? it's always a good idea to outsource as much as you can, like using mysql if you need a db instead of implemeneting your own file db, using libogg to play ogg in your media-player, sdl/allegro when you want to do gfx and so on. if you do it right you save much time.
Don't argue with idiots. They drag you down to their level and beat you with experience.
MathGeek
Peon
Peon
Posts: 52
Joined: Sat Nov 13, 2004 11:07 pm
Location: Calgary AB. Canada

Post by MathGeek » Mon Nov 15, 2004 4:45 am

I've done a lot of OO Programming in C++, and I'm familiar with UML design and implementation. I'd like to see some OOP because:

- It is easier to Document using UML, which allows new programmers to see the overall project.
- It divides the project into seperate layers, and allows restrictions to operations between classes.
- I'm more comfortable in it.

I'd like to use C++ because:

- It allows more control, but requires more attention.
- I like it.

That's about it. I'd like to see a C++ version of the game that could work with the C version. I'd be willing to put some time into this.

Any thoughts?
User avatar
Shura
Peon
Peon
Posts: 96
Joined: Tue Jun 15, 2004 2:36 am

Post by Shura » Mon Nov 15, 2004 9:49 am

i cannot agree more with many things you came up with, still. OOP's greatest features turn it into the greatest nightmares most of the time as well. i personally did not see one project that did not talk itself almost dead before it even started. secondly the amount of work until a new programmer can work on your code efficiently stays the same.
there's nothing like a proof of concept which gets updated to a live piece of software. for me UMLs are a waste of time unless you got a bunch of idiots around you which do not understand conversations anymore or cannot interpret their own notes about interfaces etc.

usually i tend to write dummy code which i hand out to the others to fill with life. this way UML is completely obsolete and interfaces stay 100% defined.
Don't argue with idiots. They drag you down to their level and beat you with experience.
User avatar
ElvenProgrammer
TMW Adviser
TMW Adviser
Posts: 2526
Joined: Tue Apr 13, 2004 8:11 pm
Location: Italy
Contact:

Post by ElvenProgrammer » Fri Nov 19, 2004 6:42 pm

Eheh Alex is always a bit rude, anyway I'm studying UML these days and I think it can be a quite useful tool for big projects (Alex: you never studied software engeneering right?).

About OOP, I'm familiar with it since I studied Java (Please don't try to say Java is not OO) and I think sometimes it can be really useful (for instance in the beings code). The problem is I'm not so familiar with C++, but if someone wants to convert some parts of the code to C++ is welcome.
MathGeek
Peon
Peon
Posts: 52
Joined: Sat Nov 13, 2004 11:07 pm
Location: Calgary AB. Canada

Post by MathGeek » Sat Nov 20, 2004 9:45 pm

I'm fairly experienced with C++ OO Programming, so I think I'll try and start something. I'm going to start with a Doubly linked list, and Binary Tree. I'll try and post an example of it's use, and if people like it then we'll go from there.

The only thing I need to know is how I get the code on the CVS, or who I give it to so they can review it.
MathGeek
Peon
Peon
Posts: 52
Joined: Sat Nov 13, 2004 11:07 pm
Location: Calgary AB. Canada

Post by MathGeek » Sat Nov 20, 2004 9:46 pm

I'm on IRC and MSN, is anyone has suggestions.
User avatar
ElvenProgrammer
TMW Adviser
TMW Adviser
Posts: 2526
Joined: Tue Apr 13, 2004 8:11 pm
Location: Italy
Contact:

Post by ElvenProgrammer » Sun Nov 21, 2004 10:12 am

Mmm doubly linked list and binary trees to do what?
After you've done you can give the code to me and I'll take a look at it. Then we could think of a cvs account...
MathGeek
Peon
Peon
Posts: 52
Joined: Sat Nov 13, 2004 11:07 pm
Location: Calgary AB. Canada

Post by MathGeek » Wed Nov 24, 2004 4:39 pm

Doubley Linked Lists are just like the style you are using for NODE, but have a previous pointer aswell. This allows you to move backward in the list very easily, but complicates some of the basics.

Binary Trees are a structure that allows for really fast searches, but are tricky to walk through one my one. I'm not going to bo into depth on them, but if you want to know more contact me and I'll explain.

I'm trying to take care of all the basics and allow other people to use my base Class files, so they can use these with very little effort.
MathGeek
Peon
Peon
Posts: 52
Joined: Sat Nov 13, 2004 11:07 pm
Location: Calgary AB. Canada

Post by MathGeek » Wed Nov 24, 2004 5:39 pm

Doubley Linked Lists are just like the style you are using for NODE, but have a previous pointer aswell. This allows you to move backward in the list very easily, but complicates some of the basics.

Binary Trees are a structure that allows for really fast searches, but are tricky to walk through one my one. I'm not going to bo into depth on them, but if you want to know more contact me and I'll explain.

I'm trying to take care of all the basics and allow other people to use my base Class files, so they can use these with very little effort.
Post Reply