• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

which Design pattern to use?

 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can anybody please reply?
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
lowercase baba
Posts: 13056
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 22656
126
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mahesh Bamane wrote:can anybody please reply?


PatienceIsAVirtue.
 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 1051
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi.............

is there anybody who can provide me a book on good design patterns techniques............
 
Rob Spoor
Sheriff
Posts: 22656
126
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Gang of Four - basically the one true book about design patterns.
Head First is also a possibility.
 
Rancher
Posts: 4686
7
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 2907
150
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic