• Post Reply Bookmark Topic Watch Topic
  • New Topic

Object Oriented Programming Applications  RSS feed

 
Prasanna Raman
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I understand all the object oriented concepts well, and know how to create classes that demonstrate the use of polymorphism, inheritance, interfaces etc. individually. But, if I am asked to design an application, I am not able to come up with the right design - what classes to build, when to use interitance, composition etc.

I thought I'd start with a simple game like tic-tac-toe (2-player game over the internet). I am working on it but I find myself spending quite a bit of time working on UI and the networking parts. Is this the right place to start or am I better off starting with applications that doesn't involve any UI or networking but only involves object oriented design, like library management or payroll processing?

Kindly suggest some applications that I can start working on.

Thanks,
Prasanna
 
Brian Kellytt
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I were you I would start at the beginning doing the easier exercises and work up to this.
That should help you to understand what classes, methods and objects to use, whether to use inheritance, interfaces etc...

I understand your problem and that's what I am doing and it has really helped a lot.
 
Prasanna Raman
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Brian,

Thank you for your response. Can you please explain what you mean by easier exercises? What exactly should I start with?

Do you have any simple applications in mind?

Thanks,
Prasanna
 
Brian Kellytt
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do not know what your level is but I would google java exercises for beginners. There are loads and also some projects on here. If you find some of them too easy you can always skip them and move on to the next section.

I would start at the beginning with exercises on classes. If they are too easy for you have a look at inheritance and so on.

But doing the exercises on classes on the web or elsewhere will sharpen you up and give you a better idea as to what getters and setters and other methods to use when you start on the more advanced projects I think.

It is working for me anyway.
 
Prasanna Raman
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, OK. Yes, I've actually done a few exercises and am pretty comfortable with them. I wanted to start designing a few applications myself and so I started with tic-tac-toe. But I want to know if this a good place to start or if there are other small applications that I should try?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66307
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that starting with Tic-Tac-toe is fine. But.... forget about UI, forget about networking.

Develop the model of the game. That is, the classes that model the game, it's behavior and state.

Do this completely independently of any UI. Your model should work with any UI: a command line, a Swing GUI, a web GUI. If not, you've done it wrong.

The game should not be mixed up with UI code, and not with networking code.

Start with just the game model.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66307
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also a good exercise in testing. How do you know that ti works without a UI?
 
Prasanna Raman
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Bear. Unfortunately, I realized this only after I started coding and that's why I asked the question I've got UI completely mixed up in my code now. I'll try to fix it so that it works with any UI.

Could you please suggest a small application that I can start working on after I finish this?

Thanks,
Prasanna
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66307
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Prasanna Raman wrote:I've got UI completely mixed up in my code now.


Right, this is the trap that's easy to fall into when you try to do it all at once. As hard as it may seem to be, I advise to drop it all and start from scratch.

Could you please suggest a small application that I can start working on after I finish this?


What's wrong with Tic Tac Toe? Just sit back. Take a deep breath. And start over.

P.S. Back in 1978, Tic Tac Toe was one of my first programs (in BASIC).


 
Campbell Ritchie
Marshal
Posts: 56599
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you should spend all day thinking about the TicTacToe example. Once you have done so, you can write the entire model for a game in half an hour.
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Prasanna Raman wrote:Could you please suggest a small application that I can start working on after I finish this?

If you want an app (as opposed to a game), one that I quite like - and is very popular in classrooms - is a Bank or an ATM machine.

The nice thing about it is that you can start out very simple: just a Bank/ATM with one type of Account, and a Customer who is allowed to make deposits and withdrawals.
After that you can move on to different types of accounts, multiple branches/customers, PINs, transfers, statements, tax reports... - basically, anything that takes your fancy until you get fed up with it. It'll also give you a good handle on how applications are built incrementally.

But the main point, as everybody else has said, is to start simple. Forget GUIs (unless you particularly want to practise those), and don't try to take on the whole world at once. Concentrate on specific problems.

HIH

Winston
 
Prasanna Raman
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much, Winston, Bear and Campbell.

I've completed tic-tac-toe and just posted it. Kindly do review and post comments. It should give you an idea of where I stand. So, please also let me know what applications I need to start working on now.

http://www.coderanch.com/t/620503/java/java/Tic-tac-toe-Design#2834800

Thanks,
Prasanna
 
Prasanna Raman
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell, Winston - Sorry to be posting in this old thread, but I'm not sure if you follow threads in other forums. I am very confused at this point. You might have seen my banking thread and some of the questions I've posted for Junilu there. I wanted to come back to where I started and check if the understanding I had from your advice was wrong or it's just that Junilu's approach is different.

Keeping in mind all the advice I got from you prior to starting the Noughts and Crosses game and while working through it as well, I really thought that I'd started my banking design decently, at least much better than how I started Noughts and Crosses. I wanted to get your comments on that as well to see if I've made a better fist of my initial banking design. Now, which way should I really go now? Are these 2 really different approaches or I didn't understand something right in the first place? If these are different, which approach should I take now? Kindly help.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!