Two Laptop Bag*
The moose likes OO, Patterns, UML and Refactoring and the fly likes Need some help with desicion making. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Need some help with desicion making. " Watch "Need some help with desicion making. " New topic
Author

Need some help with desicion making.

Yucca Nel
Ranch Hand

Joined: Nov 20, 2008
Posts: 147

Seriously I am not in need of coding tutorials. But I need help with program layout. I am studying at home and this is my 1st real pitfall. I have read about MVC and here is my understanding so far...
Model= Buisnees Layer?
View = GUI?
Controller = ..... stuck here?

Is anyone willing to supply an example of a program that uses this logic?

Secondly...

Is there a common approach to how to layout a progam? What should I call a class that does the calculating? Should my data reading and updating be kpt in a seperate class from the Buisness layer? I see many people have a controller class. What is teh function of such a class?

I dont expect answers to all my question and appreciate any help.

Regards
Yucca


SCJP 6.0, SCJD (400/400), SCBCD for JEE 5, SCWCD 1.4 I do videos for development at
http://www.youtube.com/user/thejartender?feature=mhee
I am probably the only developer ever to have had an orange sized brain tumor in my brain while learning development!!
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11405
    
  81

Ok, here's a few MVC links for you:
  • What is MVC by Cameron McKenzie - a nice conceptual description of MVC
  • Model-View-Controller - another description of what the MVC is trying to achieve. Personally I prefer Cameron's description
  • Confused with MVC - a topic here on the ranch, with a code example.


  • I would suggest that you read through those documents first, then come back with any questions you still have (possibly in their own thread - it can get very confusing if you have multiple questions on topics that are only semi-related). I think reading through some of those topics may answer some of your questions.

    Regards, Andrew


    The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
    Yucca Nel
    Ranch Hand

    Joined: Nov 20, 2008
    Posts: 147

    Thank you. Very good explanations. I only have 1 more question. Out of the 3 which run on the server in normal every day programming? My guess would be that the B layer/model should be on the server with the database. The control obviously needs to run on the client machine or am I wrong? The View is obvious :P
    Balu Sadhasivam
    Ranch Hand

    Joined: Jan 01, 2009
    Posts: 874

    My guess would be that the B layer/model should be on the server with the database. The control obviously needs to run on the client machine or am I wrong? The View is obvious :P


    What do you mean by Client machine ? End-user machine ? or another server which is client to bussiness component in another server ?

    I m afraid if you consider End-user machine. All components in MVC layers should be in the same server or different server ( in Distributed env) . And when the end-user requests for the page only the rendered HTML is parsed by the Browser.
    Yucca Nel
    Ranch Hand

    Joined: Nov 20, 2008
    Posts: 147

    Sorry for confusion.

    Here is what I want to do...

    1) The database is on a server in the companies office.
    2) The company uses the database and CRUD's it
    3) The company offer the online users to acees the same database after hours
    and some other random stuff...

    I have decided to put my limited knowledge of MVC to use here and here is what I plan to do..

    1) Create 2 GUI one for office employees and 1 for web users. (Here is my view part of the MVC completed).
    2) Create a Model to do all the work I now need to know something... can I/should I put my model on the server with my database?
    3) Provide a controller for my web users and office users.

    Does it sound doable?
    Balu Sadhasivam
    Ranch Hand

    Joined: Jan 01, 2009
    Posts: 874


    3) The company offer the online users to acees the same database after hours
    and some other random stuff...


    To be honest , not clear what do you mean by this.

    But i get the point that there are two kind of access ( office /web users )

    If you consider to give roles to office/web users , then can use the Login kind of module and use Controller to redirect to correct pages . Otherwise if you have planned to host completely 2 differnt applications separately for office and web users and then go with your assumptions.

    " Am i fishing in unknown waters " without any idea of your enironment/server/container details
    Andrew Monkhouse
    author and jackaroo
    Marshal Commander

    Joined: Mar 28, 2003
    Posts: 11405
        
      81

    Hi,

    This forum is for talking about the OO, Patterns, UML and Refactoring forum so you can talk about design patterns at a level that is more suited to your project.

    Regards, Andrew
    Andrew Monkhouse
    author and jackaroo
    Marshal Commander

    Joined: Mar 28, 2003
    Posts: 11405
        
      81

    This is very doable, and may in fact be a very good use-case for MVC.

    If I were designing this, I would probably only have a single Model for both use cases.

    You haven't really explained what the difference is between the use cases for office employees versus web users, but from reading between the lines (which could be 100% wrong), I think you are talking about having a thick client in-house, and a web client for outside users.

    In which case, you would probably have a View and a Controller built into the thick client. You would also have a Controller built into the web server, and the web browser would display its View.

    Regards, Andrew
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Need some help with desicion making.
     
    Similar Threads
    Design Dilemma
    New Web Application using HTML5
    Design flow question ?
    Observable/Observer and MVC
    Exception chaining