Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 21

Thread: Procedural v.s Object oriented programming?

  1. #11
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25
    I sort of do both really. I use the structure of OOP to make all my game objects (player or players, enemies, pick-ups, etc) and the game world (map ro level) into an object. And inside of those I create functions and procedures that do the majority of the manipulation of those objects to control that game mechanics.

    Then my main code block is a single loop (no real multi-threading for me like this unfortunately) where I check for what game mode state the game is in and place all my objects' functions in there. I may also have supporting functions which are placed above the main game loop, such as the game reset/initialization block, program startup (init all my SDL, OpenGL, textures, input options, menus, etc...) and clean up after quitting code too.

    Unless you are working for a professional development company, there is no set rule that you have to be all OOP or all procedural, it's all up to you and what is availible with the tools you use. As an indie game rpgrammer, it's about doing it the way YOU want.
    Jason McMillen
    Pascal Game Development
    Co-Founder





  2. #12
    I use OOP mainly. Just something like math unit contains functions and i have no desire to make them classes.. nor should anyone. There are millions of benefits from using classes and i'm pretty sure they're discussed through plenty of times

  3. #13
    Legendary Member NecroDOME's Avatar
    Join Date
    Mar 2004
    Location
    The Netherlands, Eindhoven
    Posts
    1,059
    To work OO with procedures, you can make something like List.pas. This has a function CreateList(): Pointer;
    From this on you can make functions like
    ListAdd(ListPointer: Pionter; item: Pointer);
    ListRemove(ListPointer: Pionter; item: Pointer);
    List...();
    NecroSOFT - End of line -

  4. #14
    Quote Originally Posted by virtual View Post
    i've seen some big projects using procedural programming like Blender and Quack .. , personally i like procedural in C/C++ ,and OOP in delphi
    Now that is interesting. Does anyone know any other big opensource projects that are using the procedural paradigm? I would like to browse through the code to see how they solve problems (that are otherwise solved using Inheritance or other OOP techniques).

    @NecroDOME: Yes, I know what the idea is. OpenGL uses that kind of routines. I kinda like it, but I also like OOP.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  5. #15
    In my personal projects I tend to use OOP as much as I can, although probably not good enough .

    On the other hand, In my current work I can not do that (although I try hard) since most of our codebase (1.2 million loc approx) is made in procedural and drag-and-drop-onto-the-form style.

  6. #16
    Thats quite nasty! I've been getting increasingly more and more OOP orientated with my projects as I go along. My older stuff was a horrible mess of procedures in each unit.

    After the last 2 year's experience with actionscript, php and java (in java "everything is a class" is a fundamental rule), I put each class in it's own file and use a pure OOP paradigm for everything.

    At my work, all my projects are OOP and even use MVC (model view controller paradigm) on top of the OOP structure...
    My site: DelphiTuts.com (coming soon)...

    Download Font Studio 4.21 here.

  7. #17
    I didn't read everypost you wrote, but I think there is a "problem" whith the "Object-Oriented Programming" concept.

    I mean, Many people think that OOP is a feature of certain programming languages. I don't think so. I think that OOP is a way to face a problem.

    Actually it's possible to do OOP in plain C, including encapsulation and inheritance! (And I mean plain C, not C++ nor Objective C). An actual example; there you have the Allegro library, written in C and Assembler but using an "Object" approach to define lots of objects. If you see the description of the BITMAP structure you'll see it has a virtual method table to define functions as drawing primitives, blitting, sprite drawing, etc.

    On the other way, use a language that has classes doesn't guarantee that you're using OOP. Actually most Visual Studio, Delphi and Lazarus programmers I meet use objects but they don't use OOP! They just drag'n'drow some components to the form and program responses to some events and... what? Is that OOP? Can't you do it with pure procedural programming?

    Just thinking about this.
    Last edited by Ñuño Martínez; 07-10-2010 at 07:39 AM.
    No signature provided yet.

  8. #18
    I didn't read everypost you wrote, but I think there is a "problem" whith the "Object-Oriented Programming" concept.
    Yes, there are more people who feel the same way. Just google for some OOP v.s procedural articles. You'll find that there are people who see OOP as a non-productive overly complex way of writing software. Those articles made me create this thread.

    I think it would be interesting If i did a small non-OOP project (something like pacman or so). I'm especially interested in how inheritance is done with procedural programming. You mentioned a virtual method table. I have to look into that.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  9. #19
    Quote Originally Posted by chronozphere View Post
    You'll find that there are people who see OOP as a non-productive overly complex way of writing software.
    Strange... I see things like MVC has a non-productive, overly complex way of writing software, whereas OOP is just like a fundamental. It's a given. I wonder if I'd feel that way about MVC if I was involved in hectic multi-person projects...
    My site: DelphiTuts.com (coming soon)...

    Download Font Studio 4.21 here.

  10. #20
    OOP is a way to think about software. Some people never got used to OOP (the oldschool coders) and others just love the C-feeling of procedural code. I can understand this, because the C language is very easy to understand, yet powerfull (The same can be said about pascal because you can consider it a superset of C, functionality wise). The problem with OOP is that it restricts your way of thinking about your code. The constructs in OOP are flexible at the beginning, but as a project progresses, you may run into all kinds of problems. For example, if you heavily rely on complex things like polymorphism, generics or operator overloading, it will be very hard to understand what's going on.

    About MVC, I think it has some good potential. For example, I'm working on a PHP web project, where I am using an MVC framework (KohanaPHP). I must say that for this kind of application, it works great.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

Page 2 of 3 FirstFirst 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •