• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How can i structure that?

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello ,

I am trying my best here to have a proper structure for something that seems somehow very simple:

Basically, i have a Model class and i want to format some of its data before fowarding it to the View.

I also would like to decorelate the view from the model.

Basically the view in this application is some XML output, so it is not interactive.

I thought of two possible patterns :

  • Adapter : the view calls the adapter method which retreives the data from the model (correct me if am wrong).
  • Factory: my controller calls a factory method which takes our model (or its interface) then creates an appropriate view.


  • Which method would you think is better, do you have another solution to this problem?


    I am opened to any suggestions...

     
    Ranch Hand
    Posts: 257
    Hibernate Oracle Spring
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hey Laurent ,

    Basically, i have a Model class and i want to format some of its data before fowarding it to the View



    Could you please let us know, what type of formatting you are refering here ?

     
    Laurent Baye
    Greenhorn
    Posts: 3
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Thank you for your reply.


    To answer your question, i am doing some formatting of the DAO data to my view beans.

    ie : date formatting, ...

    Now, i have already found my structure which is really basic and consists of having an adapter which takes up a model object and renders a view formatted as i want it.

    View <-- Iview
    ^ ^
    | |
    Adapter<--IAdapter---> Model



    I'll try to post some code later on as i know this probably doesn't make sense at all.

    Anyway, if you ever came accross such a problematic, let me know, i am always interested to see what other people try to design.
     
    reply
      Bookmark Topic Watch Topic
    • New Topic