• Post Reply Bookmark Topic Watch Topic
  • New Topic

which Design pattern to use?  RSS feed

 
Mahesh Bamane
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am developing one standalone application in java. where i am reading two text files as i/p.
I hve to generate a report based on the i/p. have to perform some calculation after retrieving the record frm file.
Please advise which design pattern can be used?
 
Mahesh Bamane
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can anybody please reply?
 
Amu mathi
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I don't think we can just pull a design pattern from the shelf and use it, design patterns should not be approached as instant noodles,

I suppose you need to start the work from fundamental oops philosophy something very roughly one need to think in these lines:-

1.) Divide your application into different modules [ such as input/data cleansing, report generating, printing, error handling and reporting and so on ]

2.) Then for each of the modules identify different services it performs and their interfaces.

3.) draw a high level architecture { Systems and sub-systems diagram} of your application, identify functional and non-functional requirements,

4.) Refer the Internet/books and journal for best practices employed by earlier hackers[aka programmers/solution architects etc ] for handling a specific functionality, select well defined patterns for your proposed systems and its modules.

5.) Refine the patterns to your needs, and further work on modules identifying the classes, objects interfaces etc.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12563
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your question is along the lines of "I have to prepare some food. What cooking techniques should I use?". The answer, like almost all questions in computer science, is "It depends".

If you're going to make a souffle, you'll use a very different technique than grilling asparagus.

You need to figure out what you want to do first, start to design how to do it, then see if any design patterns could work with what you need to do.
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mahesh Bamane wrote:can anybody please reply?

PatienceIsAVirtue.
 
zahid zubair
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
have to perform some calculation after retrieving the record frm file.


You can try recruiting Decorator pattern to perform the above task. Again, as our friends said, you have to think about based on the requirements and keeping future extension of your implementation in mind.
 
Shanky Sohar
Ranch Hand
Posts: 1051
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi.............

is there anybody who can provide me a book on good design patterns techniques............
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gang of Four - basically the one true book about design patterns.
Head First is also a possibility.
 
Pat Farrell
Rancher
Posts: 4686
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Prime wrote:Gang of Four - basically the one true book about design patterns.

Except that the Gang of Four is old, and recommends some ideas that are now deprecated. For example, Singletons are now considered Dangerous.

But as a place to get ideas, its still a valuable resource.
 
salvin francis
Bartender
Posts: 1660
37
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pat Farrell wrote:Singletons are now considered Dangerous.

Man you still hate singletons...

@ OP,
You have just given us the problem domain and not the problem itself. Design patterns are ideas to be used while programming stuff. What is the logical flow of classes you plan to have to solve your issue ?
 
Pat Farrell
Rancher
Posts: 4686
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
salvin francis wrote:You have just given us the problem domain and not the problem itself. Design patterns are ideas to be used while programming stuff. What is the logical flow of classes you plan to have to solve your issue ?


Right. Or more succinctly: What problem are you trying to solve?

There is no pattern that solves all problems. Think of them as tools in a mechanic's tool chest. Many mechanics have thousands of dollars worth of tools, dozens of screwdrivers, and perhaps a dozen tools that can loosen a 10mm nut. Its true that you can sometimes use a pair of pliers to loosen a nut, but a wrench is better. The mechanic has lots of tools for the 10mm nut, open end wrenches, box end wrenches, 10mm sockets, etc.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!