Results 1 to 3 of 3
Thread: Design pattern question
- 06-06-2012, 07:47 PM #1
Member
- Join Date
- Sep 2011
- Posts
- 17
- Rep Power
- 0
Design pattern question
I have a java-based simulation model of a floor with a lot of people agents that go on to different floors (I have around 3-5 floors) with several elevators. I am in the process of writing the elevator class and decided to take a step back and ask the big boys which design pattern would they recommend. First thought is state design pattern. The elevators will have a capacity, max load, and different states such as moving, idle, or Needs Maintenance (deactivated).
Should I create the Elevator.java as an abstract class and have other states extend it?
thanks
- 06-06-2012, 08:01 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,413
- Blog Entries
- 7
- Rep Power
- 17
Re: Design pattern question
There is no need to extend anything: an elevator is an elevator; maybe it's its algorithm that can be extended but a simple 'elevator seek' (<--- Google tip) could do the job fine. If you only have one single elevator in your system you can implement the elevator as a singleton (<--- pattern tip)
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 06-06-2012, 08:03 PM #3
Re: Design pattern question
What would extend Elevator? It seems to me there is only one kind of Elevator, each with different attributes. No real need to extend there.
Honestly though, I really wouldn't worry too much about it. There is such a thing as overthinking a problem. Go with what fits into your head the best.How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
Similar Threads
-
design pattern question
By urbanleg in forum New To JavaReplies: 2Last Post: 12-18-2011, 12:16 PM -
A little design (pattern?) question...
By raindog308 in forum New To JavaReplies: 1Last Post: 01-26-2011, 09:12 AM -
question on j2ee design pattern
By Minu in forum Advanced JavaReplies: 1Last Post: 01-06-2009, 07:50 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks