Beginner Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsOtherBeginner Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 5th, 2012, 04:21 AM
kosie99 kosie99 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2010
Posts: 4 kosie99 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 15 sec
Reputation Power: 0
OO Design

As someone fairly new to OO programming, I was wondering how more experienced programmers follow the design process. As an example, let's say you want to code a simple tetris game clone in Java or Python, how do you go about determining which classes to define and whether it makes sense to declare some as abstract classes, etc.

Letting my inexperience show, I would identify the following classes:

1.) Screen or playable area on screen
2.) A square
3.) A shape (consisting of more than one square as in 2.)
4.) a keyboard key (should this even be a class?)
5.) Some text (title, scoreline, etc.)

How will you approach this design?

Reply With Quote
  #2  
Old June 5th, 2012, 05:32 AM
MrFujin's Avatar
MrFujin MrFujin is offline
Lord of the Dance
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Oct 2003
Posts: 3,161 MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level) 
Time spent in forums: 2 Months 2 Weeks 1 Day 14 h 10 m 21 sec
Reputation Power: 1736
I answer regarding my knowledge about java.

1. 2. and 3.
- This should be ok.

4.
- In java, you will implement a Listener on the part that require user action. In this case teh gamearea in 1.
With a (simple) game like this, I don't think I would create a class for it.

5.
Regarding text like the titel, i would place this in the gamearea
You could argue whether there should be created a Player class to keep score and that kind.
Similar to point 4. i doubt it will give any extra benefits, except from a learning POV.

Reply With Quote
  #3  
Old June 5th, 2012, 05:52 AM
kosie99 kosie99 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2010
Posts: 4 kosie99 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 15 sec
Reputation Power: 0
Thanks for your reply. I must say that deciding what to make into classes is the biggest stumbling block for me to get into OOP

Reply With Quote
  #4  
Old June 28th, 2012, 06:19 AM
bob_tylor bob_tylor is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2012
Posts: 3 bob_tylor User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 34 m 49 sec
Number of bans: 1
Reputation Power: 0
Thanks..it is really great information about the OO classes which helps me to solving many problems related to java..It also helps in web design .

Reply With Quote
Reply

Viewing: Dev Shed ForumsOtherBeginner Programming > OO Design

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap