Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Better for beginners: OOP or procedural (with structs)

  1. #1
    Senior Member
    Join Date
    Jul 2013
    Thanked 121 Times in 105 Posts

    Default Better for beginners: OOP or procedural (with structs)

    Hi there everybody.

    In my spare time I am working on developing a Game Developement Suite which is aimed at people with no background in programming.
    The idea is to give them a basic framework and an easy to use scripting syntax which is tailored specifically towards the design of simple 2D games. It should be simple enough to be used by kids but also be powerful enough to not be boring or restricting to more advanced users.

    But right now I can not decide whether I should try to go with an object oriented approach or keep it simpler with procedural programming. (for the games that is, not for my software suite)

    I think a procedural scripting syntax would be easier to understand for beginners and easier to learn. It would also make it a little bit simpler for me and thus improve the general quality of the product because I can put more effort into testing and other features.
    The users could create "templates" for game objects (which are basically like structs in C and C++) and then create as many game objects of this kind as they like.
    The users would also write Scripts which can call each other or read and manipulate the data of game objects. Everything would be public, everything would be global.
    The benefit of this is that not much thought would need to be put into scopes or accessibility. There would only be one way to do it and thus you dont have to compare your alternatives.

    On the other hand, procedural programming languages are slowly dieing out and many people in my personal surroundings (me included) believe, that OOP languages are going to be the most used languages in the future. (for video game developement that is)
    Since I would like the software to be (at least a little bit) educational I am not too sure whether a procedural concept is the best idea. Maybe OOP might be more difficult to understand at first, but perhaps it would be more beneficial for the users in the long run if it turns out, that they are actually interested in programming and want to learn more about it after using my software.

    Furthermore the OOP design has some significant benefits in video games since these applications are naturally structured around objects interacting with each other. So perhaps the stability of the games would benefit as well.

    I would really really love to get some opinions on this.
    Thank you very much.

  2. #2
    Member Ada Lovelace's Avatar
    Join Date
    May 2014
    South England UK
    My Mood
    Thanked 61 Times in 55 Posts

    Default Re: Better for beginners: OOP or procedural (with structs)

    What a great idea!

    This is just my own person view on this:

    I would say - if possible - develop part of your application which can start off with the basic bare-bones of procedural
    programming, with video game syntax. Use an easy to use script (Python?) and give then the general feel about
    what a program is, what a variable is, how video games are made in industry (i.e why they use C++ and scripting
    languages like Lua).

    A basic introduction program might be (C example):

    #include <stdio.h>
    #include <stdlib.h>
    int main(int args, char *argv[])
       puts("Welcome to game programming 101 - " G A M E O V E R");
       return EXIT_SUCCESS;

    Obviously C is a difficult example to understand from a beginner, but you get the idea.
    When you have created all that, I would suggest slowly introducing OOP into the projects.
    One good way to do this, is using whatever script your using - explain what "real world" object
    the user is talking to using the script. Then, when you develop your OOP part of it - (e.g.: Java)
    They will know off hand "Oh yes this is an object - this is how it is broken down".

    I really like the idea of using structure-like methods to bind together pieces of code that have the
    "look and feel" of an object too.

    typedef struct
       char player[100];
       short int hp;
       short int xp;
       short float levelGain;
    } ClientTalker;

    Some closing thoughts:

    1. Are you going to explain the possible pitfalls of using global and public objects and namespaces in programming?
    2. A good point might be to explain the difference between a managed OOP language and a manual OOP language (C++)
    3. Are you going to (or ever) introduce pointers?
    4. Perhaps using a "visual" template for each project when moving into OOP game design (Java Swing?) might be a fun way to go.

    Great idea, and I hope I helped you. Best of luck with the project.

    Wishes Ada xx
    If to Err is human - then programmers are most human of us all.
    "The Analytical Engine offers a new, a vast, and a powerful language . . .
    for the purposes of mankind
    Augusta Ada Byron, Lady Lovelace (1851)

Similar Threads

  1. Help with beginners code?
    By noongsaao in forum What's Wrong With My Code?
    Replies: 1
    Last Post: September 23rd, 2013, 03:46 AM
  2. [SOLVED] Procedural programming veteran, Java OO newbie question, first time poster
    By feelingroovyslc in forum What's Wrong With My Code?
    Replies: 3
    Last Post: March 3rd, 2013, 01:44 PM
    By javabeginners in forum Java Theory & Questions
    Replies: 13
    Last Post: November 15th, 2011, 12:50 PM
    By Olenger in forum Java Theory & Questions
    Replies: 1
    Last Post: October 18th, 2011, 07:06 PM
  5. YAY for beginners
    By derbya in forum Member Introductions
    Replies: 2
    Last Post: August 16th, 2011, 04:54 AM