🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

C++ Workshop - Project 1

Started by
193 comments, last by me_minus 14 years, 9 months ago
This question most probably relates to chapter 6-11 thread, but ill post here cuz it also concerns this project.

Im having a hard time learning and remembering the steps of Object Oriented analysis/design. Since i am currently not really planning out for myself some big project, whatever i read in chapter 11 sounds all the same in all phases: "Just get it straight what is this thing in the real world, and how do we need it to interact with users, and make it that way". whatever, I just cant get chapter 11 in my head.
Therefore, if finnishing the analysis phase is part of project 1, then im in trouble. And, uh, if OO Analysis/Design is part of being a C++ programmer (duh), then im in REAL trouble...

Any suggestions?
Advertisement
Quote: Original post by kingIZZZY
This question most probably relates to chapter 6-11 thread, but ill post here cuz it also concerns this project.

Im having a hard time learning and remembering the steps of Object Oriented analysis/design. Since i am currently not really planning out for myself some big project, whatever i read in chapter 11 sounds all the same in all phases: "Just get it straight what is this thing in the real world, and how do we need it to interact with users, and make it that way". whatever, I just cant get chapter 11 in my head.
Therefore, if finnishing the analysis phase is part of project 1, then im in trouble. And, uh, if OO Analysis/Design is part of being a C++ programmer (duh), then im in REAL trouble...

Any suggestions?


I know what you mean. I've done a few games in c++ and OO design never really made sense to me. All 4 of my games were done procedurally. I tried this exercise to work on my design and it was like BOOM! everything about OO started to click.

My advice is to not get wrapped up in making sure everything is OO. Use OO when it helps you, and if it's becoming a hindrance, don't use it. After using the language for a while it will begin to make more sense.

The important thing is to never let any one thing about coding keep you from doing it. It's better to write bad code that you understand then to sit on your hands until your design is flawless. The more you code the more your design will improve and the more you will understand things that you don't get right away.
Well, I got the book last week and have been playing catch up. The last thing I ever programed was in BASIC on a comador64 back in 1985. I dont count the strite drawing I did on an Apple II/E in 7th grade.

So, this has been an experiance. I have been able to grasp most of the logic (functions, if then else, while... etc) But have been struggling with the class/object relationships. I was dissapointed with the books approach of doing everything for you and not giving you exercises in the form of "write a program that does X" that builds from chapter to chapter. I learn more from doing than reading. Not sure if you included exercises of this type in the chapter threads, still going through them.

However, I am trying to tackle this project none the less. My main question at this point is about the menu. Making a menu that sends you to other menus and comming back again is pretty straight forward, but this being OO would you make the menu its own class and then define it as an object with the menu logic working outside of main{} or do the entire menu within main{}?

I think I'll give this a go too to hone in on my C++ skills.
Quote: However, I am trying to tackle this project none the less. My main question at this point is about the menu. Making a menu that sends you to other menus and coming back again is pretty straight forward, but this being OO would you make the menu its own class and then define it as an object with the menu logic working outside of main{} or do the entire menu within main{}?


This is of course the million dollar question for the menu. And it is strictly a design choice. Ultimately, it's up to each individual how they implement the menu system. One choice is to create a menu class, which has a few functions for handling menu logic. Another choice is to simply store the display of the menus in the main function and then show different text and process different menu choices depending on what the current menu being displayed is.

The important thing to remember is that BOTH are perfectly valid choices. You'll find however, as you become more familiar with the language and object oriented design that creating classes is generally pretty effortless and often times has unforeseen rewards. At the very least, the class can be picked up and used again elsewhere with ease, while function main() doesn’t move from application to application very well.

The other thing to remember, as was pointed out by another poster, is that you need to keep moving. Spend some time thinking about what you believe is a *good* design and then move forward with it. If you spend all of your time trying to find the *best* design, you'll never write a line of code. Often times as you're implementing you'll encounter a problem that was unforeseen or an unnoticed benefit to a specific implementation. This often leads to changes in your original design and is the natural flow of software development. That's why it's "Soft." (ie. its flexible, malleable, changeable)

Cheers!
Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints
Quote: I use Dev-cpp 4.9.9.2 (latest version, i think).


Version 5 is available, but it's the beta version. If you want it, go here:

http://www.bloodshed.net/devcpp.html

Hope that helps in any way :)

John
Seems that the version 5 beta IS the 4.9.9.2

westond: I also did Apple IIgs BASIC programming years back, And true, the booklet i had back then teaching me BASIC was alot more fun and self-discovering than the "Sams C++ in 21 days" way of teaching... I think there could have been more explanations along chapter 6 about classes, not just putting it all as a given about set and get functions, and variables, etc. it would have been alot more fun and easily understood if book would have let student guess whats best way to manipulate variables of the class... same about member functions.
Quote: If the user selects roll for stats, then he will enter a loop where he can continue to “roll for stats” until he finds a suitable distribution.
This means that Strength, Dexterity, and Constitution of player are defined randomly (8-20) at this point of the game, and that player can re-randomize these stats' values untill he is satisfied with their values. Correct?
I have been implementing some of my classes yesterday and I realised we didn't handle Strings or Arrays yet.

I saw that there is a std::string, but is this the preffered String implementation? I could, of course, create an Array of characters for my weapon and armor names, but this doesn't seem like a good solution.
Yes, use std::string. For arrays, use std::vector.

This topic is closed to new replies.

Advertisement