The Artima Developer Community
Sponsored Link

Design Forum
Witch design pattern would you use in this problem?

1 reply on 1 page. Most recent reply: Sep 19, 2008 1:12 PM by adi ian

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
maryian nenchev

Posts: 1
Nickname: mnenchev
Registered: May, 2008

Witch design pattern would you use in this problem? Posted: May 21, 2008 5:52 AM
Reply to this message Reply
Advertisement
Hi all, i am new in the design patterns. Actually i am visiting a course! We were given some school problem to sovle using programing language that we want(I prefer java for now, but that is other topic)! So i decided to ask in this forum how would you solve this problem(please if it is possible give reasons why)
Here is the problem:
Create simple system for constructing and calculating mathematical formulas.
1. It have to be possible to read formulas that can be a single variable(it is formula too), combination between varables and math operations (like +-*/) and random combinations between them. The priority is specified by ().
Example:
Formula is :
- variable: a, b, c …
- expression : 5 * a, 5 * 5, т.е. <variable> <operation> <variable>
- complex expression: <formula> <operation> <formula>
2. The formulas are read form the console
3. The user can set values to the variables so it can be evaluated.
4. The formulas can be saved in file.
5. The formulas can be combined each other.
So i think that i can use composite pattern of course with some factory.
What do you sugest?
I will be very thankfull pls help me:)


adi ian

Posts: 5
Nickname: adiian
Registered: Jul, 2006

Re: Witch design pattern would you use in this problem? Posted: Sep 19, 2008 1:12 PM
Reply to this message Reply
I think interpreter pattern will fit well:
http://www.oodesign.com/interpreter-pattern.html

Flat View: This topic has 1 reply on 1 page
Topic: Realizing Practical vision of the IT systems with Enterprise Architecture, SOA & MD Previous Topic   Next Topic Topic: A masters in software engineering program with no background in CS?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use