On Programming

Discussion in 'C++' started by JoeC, Apr 14, 2007.

  1. JoeC

    JoeC Guest

    I am a self taught programmer and I am starting to get better and
    create larger and more complex projects. Mostly I write games because
    they keep me interested. I have done some reading with directX but
    mostly I am more comfortable with win32. I only use win32 as a way to
    show something on the screen. I am more interested in design patterns
    and trying to find the best tool for a problem. I don't have a
    specific question but like the abstract discussions on how others
    approach programming and what kind of tips I can gain from other
    people. What is the best way to create an object because I have
    objects that tend to get very big is that OK? I don't use pointers
    very much and try to use standard libraries as much as I can. I tend
    to use pointers if I have objects that hold other objects. For
    example if I have a player object then I will have weapons class
    pointer. The player might have a spear or a club and they will act
    differently or there may not be any weapon at all. I tend not to use
    dynamic binding very much never have the right problem although for
    one of my games I did create a handle for units. I was planning to
    have land air and sea units but only actually created the land units
    but the handle worked great if I had wanted to create more kinds of
    units.

    I am just writing some Ideas of how I program and if you like and have
    something to say I would be interested in your thoughts if not that is
    OK too feel no need to respond unless you want to get into the more
    abstract way you approach programming.
     
    JoeC, Apr 14, 2007
    #1
    1. Advertising

  2. JoeC wrote:
    > I am a self taught programmer and I am starting to get better and
    > create larger and more complex projects. Mostly I write games because
    > they keep me interested. I have done some reading with directX but
    > mostly I am more comfortable with win32. I only use win32 as a way to
    > show something on the screen. I am more interested in design patterns
    > and trying to find the best tool for a problem. I don't have a
    > specific question but like the abstract discussions on how others
    > approach programming and what kind of tips I can gain from other
    > people. What is the best way to create an object because I have
    > objects that tend to get very big is that OK?


    Depends. Usually a large class without enough base classes from which
    it inherits all the stuff means that you may have not identified all
    the abstractions, which would otherwise help narrowing down their
    functionality. Abstraction helps subdivide the problem domain into
    manageable pieces, implement them better, test them better, reuse them
    better.

    > I don't use pointers
    > very much and try to use standard libraries as much as I can. I tend
    > to use pointers if I have objects that hold other objects.


    By itself it doesn't necessarily sound like a bad idea.

    > For
    > example if I have a player object then I will have weapons class
    > pointer. The player might have a spear or a club and they will act
    > differently or there may not be any weapon at all. I tend not to use
    > dynamic binding very much never have the right problem although for
    > one of my games I did create a handle for units. I was planning to
    > have land air and sea units but only actually created the land units
    > but the handle worked great if I had wanted to create more kinds of
    > units.
    >
    > I am just writing some Ideas of how I program and if you like and have
    > something to say I would be interested in your thoughts if not that is
    > OK too feel no need to respond unless you want to get into the more
    > abstract way you approach programming.


    If you're interested in exploring OO side of C++, I'd recommend the
    old and still valid "Advanced C++ : Programming Styles and Idioms" by
    James Coplien.

    V
    --
    Please remove capital 'A's when replying by e-mail
    I do not respond to top-posted replies, please don't ask
     
    Victor Bazarov, Apr 14, 2007
    #2
    1. Advertising

  3. JoeC

    JoeC Guest

    On Apr 14, 1:10 pm, "Victor Bazarov" <> wrote:
    > JoeC wrote:
    > > I am a self taught programmer and I am starting to get better and
    > > create larger and more complex projects. Mostly I write games because
    > > they keep me interested. I have done some reading with directX but
    > > mostly I am more comfortable with win32. I only use win32 as a way to
    > > show something on the screen. I am more interested in design patterns
    > > and trying to find the best tool for a problem. I don't have a
    > > specific question but like the abstract discussions on how others
    > > approach programming and what kind of tips I can gain from other
    > > people. What is the best way to create an object because I have
    > > objects that tend to get very big is that OK?

    >
    > Depends. Usually a large class without enough base classes from which
    > it inherits all the stuff means that you may have not identified all
    > the abstractions, which would otherwise help narrowing down their
    > functionality. Abstraction helps subdivide the problem domain into
    > manageable pieces, implement them better, test them better, reuse them
    > better.
    >
    > > I don't use pointers
    > > very much and try to use standard libraries as much as I can. I tend
    > > to use pointers if I have objects that hold other objects.

    >
    > By itself it doesn't necessarily sound like a bad idea.
    >
    > > For
    > > example if I have a player object then I will have weapons class
    > > pointer. The player might have a spear or a club and they will act
    > > differently or there may not be any weapon at all. I tend not to use
    > > dynamic binding very much never have the right problem although for
    > > one of my games I did create a handle for units. I was planning to
    > > have land air and sea units but only actually created the land units
    > > but the handle worked great if I had wanted to create more kinds of
    > > units.

    >
    > > I am just writing some Ideas of how I program and if you like and have
    > > something to say I would be interested in your thoughts if not that is
    > > OK too feel no need to respond unless you want to get into the more
    > > abstract way you approach programming.

    >
    > If you're interested in exploring OO side of C++, I'd recommend the
    > old and still valid "Advanced C++ : Programming Styles and Idioms" by
    > James Coplien.
    >
    > V
    > --
    > Please remove capital 'A's when replying by e-mail
    > I do not respond to top-posted replies, please don't ask


    Thanks for the recommendations. I will look for them.
     
    JoeC, Apr 14, 2007
    #3
  4. JoeC

    Daniel T. Guest

    "JoeC" <> wrote:

    > I don't have a specific question but like the abstract discussions
    > on how others approach programming and what kind of tips I can gain
    > from other people.


    You might want to start following the comp.object newsgroup.

    > What is the best way to create an object because I have objects that
    > tend to get very big is that OK?


    My personal rule is, "most of the methods must use most of the fields
    most of the time."
     
    Daniel T., Apr 15, 2007
    #4
  5. JoeC

    James Kanze Guest

    On Apr 14, 8:10 pm, "Victor Bazarov" <> wrote:

    > If you're interested in exploring OO side of C++, I'd recommend the
    > old and still valid "Advanced C++ : Programming Styles and Idioms" by
    > James Coplien.


    A very useful book, but the title doesn't lie. Many of the
    idioms rate as very advanced. I'd recommend a general OO text.
    (I learned using Booch, but I don't know if it is still
    considered up to date.) I'd also recommand The GoF book on
    patterns, and the Barton and Nackman (which has some very good
    discussion on the trade offs between templates and inheritance,
    as well as when to use the different types of inheritance).

    --
    James Kanze (Gabi Software) email:
    Conseils en informatique orientée objet/
    Beratung in objektorientierter Datenverarbeitung
    9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
     
    James Kanze, Apr 15, 2007
    #5
  6. JoeC

    JoeC Guest

    On Apr 15, 6:56 am, "Daniel T." <> wrote:
    > "JoeC" <> wrote:
    > > I don't have a specific question but like the abstract discussions
    > > on how others approach programming and what kind of tips I can gain
    > > from other people.

    >
    > You might want to start following the comp.object newsgroup.
    >
    > > What is the best way to create an object because I have objects that
    > > tend to get very big is that OK?

    >
    > My personal rule is, "most of the methods must use most of the fields
    > most of the time."


    Thanks, I will look in other places. I was hoping to try to see how
    other programmers approach programming. I am writing programs that
    are too big and complicated to post and I wouldn't expect anyone to
    weed through all the code I write. Not having gone to school or have
    a job where I can meed other programmers I would like to have
    discussions on the topic. I want to get better and I learn from my
    experiences but I would also like to see if I can find other ideas or
    some approach I might have overlooked.

    So far I have written several games lately using win32. I have
    written a maze game, I use bitmap graphics as well as a binary library
    that I have created myself. I finished two map games. One was very
    simple the next one a bit more complicated. I create a map and have
    four kinds of units. The goal of the second game is to capture all
    the cities. You get point from the cities you control to buy more
    units. I created a dialog box to buy the units and they randomly get
    placed in controlled cities. I have no idea how to do a computer
    player so I created an email system where after each turn the game is
    saved and you can send it to the person you are playing.

    Now I am working on something much more complicated; a civilization
    type of game. I have created a random map with water land hills and
    mountains. I can save the map in a binary file. Right now I am
    trying to create a way to create random rivers but I have having
    trouble getting that to work. Also I am challenged on how the game
    will actually be played. That is a challenge I am still trying to
    figure out with pencil and paper.

    This is where I am. I am trying to use more inheritance and objected
    oriented techniques I have read about. I try to break my programs
    down into logical objects. It seems that big objects like my map and
    spaces do grow large because they do quite a bit. My units in my last
    game were large and held other objects. A unit for example had
    attack, defense, graphics, colors, movement, how much moved as well as
    other status variables. I try to understand what I know and try to
    create something just beyond what I think I can do. I keep learning
    lessons and try to implement those lessons.
     
    JoeC, Apr 16, 2007
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. James Lapalme

    Attribute programming

    James Lapalme, Jul 7, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    1,283
    James Lapalme
    Jul 7, 2003
  2. Salisha Khan
    Replies:
    1
    Views:
    11,695
    JohnFol
    Aug 1, 2003
  3. Matt
    Replies:
    35
    Views:
    10,732
    George Neuner
    Jul 22, 2004
  4. Casey Hawthorne
    Replies:
    4
    Views:
    1,051
    Jarek Zgoda
    Aug 4, 2006
  5. Joe Mayo
    Replies:
    168
    Views:
    3,490
    David Thompson
    Oct 22, 2007
Loading...

Share This Page