Object Oriented, Garbage collecting ect.

Content and general development discussion, including quest scripts and server code. TMW Classic is a project comprising the Legacy tmwAthena server & the designated improved engine server based on evolHercules.


Forum rules

This forum houses many years of development, tracing back to some of the earliest posts that exist on the board.

Its current use is for the continued development of the server and game it has always served: TMW Classic.

Ardaen
Peon
Peon
Posts: 24
Joined: 01 Jul 2004, 18:51

Object Oriented, Garbage collecting ect.

Post by Ardaen »

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
Founder
Founder
Posts: 2526
Joined: 13 Apr 2004, 19:11
Location: Italy
Contact:

Post by ElvenProgrammer »

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: 01 Jul 2004, 18:51

Post by Ardaen »

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

Post by ElvenProgrammer »

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: 01 Jul 2004, 18:51

Post by Ardaen »

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: 23 Aug 2004, 19:41
Location: Netherlands
Contact:

Post by VDM »

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
Novice
Novice
Posts: 96
Joined: 15 Jun 2004, 01:36

Post by Shura »

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
Novice
Novice
Posts: 52
Joined: 13 Nov 2004, 22:07
Location: Calgary AB. Canada

Post by MathGeek »

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
Novice
Novice
Posts: 96
Joined: 15 Jun 2004, 01:36

Post by Shura »

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
Founder
Founder
Posts: 2526
Joined: 13 Apr 2004, 19:11
Location: Italy
Contact:

Post by ElvenProgrammer »

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
Novice
Novice
Posts: 52
Joined: 13 Nov 2004, 22:07
Location: Calgary AB. Canada

Post by MathGeek »

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
Novice
Novice
Posts: 52
Joined: 13 Nov 2004, 22:07
Location: Calgary AB. Canada

Post by MathGeek »

I'm on IRC and MSN, is anyone has suggestions.
User avatar
ElvenProgrammer
Founder
Founder
Posts: 2526
Joined: 13 Apr 2004, 19:11
Location: Italy
Contact:

Post by ElvenProgrammer »

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
Novice
Novice
Posts: 52
Joined: 13 Nov 2004, 22:07
Location: Calgary AB. Canada

Post by MathGeek »

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
Novice
Novice
Posts: 52
Joined: 13 Nov 2004, 22:07
Location: Calgary AB. Canada

Post by MathGeek »

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