Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Model view controller

  • 18-08-2009 5:12pm
    #1
    Closed Accounts Posts: 32


    Ok guys I need help implementing a model view controller type program in java.

    Basically I want the program to connect to my database allow the user to enter, update and delete information into the various tables in the database through a nice java GUI. The problem is I am having a lot of trouble trying to code it and any online tutorials I have found so far have been too basic and not very helpful. I am short on time. Can anyone offer any good websites, books etc..

    Many many thanks for any help.


Comments

  • Registered Users, Registered Users 2 Posts: 1,821 ✭✭✭Skud


    Gang of Four - Design Patterns is a good book, covers MVC.

    Coreservlets.com is a good site too. Covers MVC in different parts. This is Advanced MVC with Swing - http://courses.coreservlets.com/Course-Materials/pdf/java5/14-Advanced-Swing.pdf


  • Moderators, Technology & Internet Moderators Posts: 1,336 Mod ✭✭✭✭croo


    hmmm... Gang of four sounds a little steep for someone who doesn't know MVC!

    Actually, this is not so common a requirement because in the real world few projects are starting from scratch but rather building upon some framework or app already there.

    I have not actually tried it myself... but griffon looks interesting
    http://groovy.codehaus.org/Griffon+Quick+Start

    It's grails for swing! If that makes any sense.


  • Registered Users, Registered Users 2 Posts: 569 ✭✭✭none


    Actually, I don't think Gamma et al covered MVC, at least, I never saw any reference to their book in the MVC context. I didn't read it, of course;)
    The classic 23 patters are explained well here: http://www.dofactory.com/Patterns/Patterns.aspx#list. I know it's C# but the concept is the same.
    For Java, this could be useful: http://www.patterndepot.com/put/8/JavaPatterns.htm
    But if you use Swing, you don't have to reinvent the wheel, just use anything like JTable, JTree or JList, as suggested.
    In my opinion, however, MVC is one of the most over-hyped and under-realised terms. :confused:


  • Registered Users, Registered Users 2 Posts: 981 ✭✭✭fasty


    none wrote: »
    In my opinion, however, MVC is one of the most over-hyped and under-realised terms. :confused:

    The biggest problem with it is that sometimes people try to shoehorn design patterns into their projects when they're not needed.

    For simple apps, the model is often just the database and a few helper functions to get and set data and the view and controller are the same class.

    For my Win32 apps, My controller class encapsulates a Windows message loop and a view will encapsulate a Window handle but for something that's just one or two controls, a direct 3D window or a form or something... what's the point in forcing it all to be separate?

    To the OP. Split data access and display for sure, but don't make it MVC because you think it should... But don't take my word for it, look up MVC a bit more, try and implement your app like that and see if it works for you that way!


  • Moderators, Technology & Internet Moderators Posts: 1,336 Mod ✭✭✭✭croo


    none wrote: »
    Actually, I don't think Gamma et al covered MVC, at least, I never saw any reference to their book in the MVC context. I didn't read it, of course;)
    Well MVC is not a pattern they define if that is what you mean but they actually start with a look at the concept of MVC which is the basis of smalltalk-80 (and just about every GUI based system since - there are not many alternative ideas) they then breakdorwn MVC to describe the patterns used in its creation (I did read the book - but not since the late 90s).
    just use anything like JTable, JTree or JList
    These would of course be part of the View but they are not a alternative to the MVC design itself.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 569 ✭✭✭none


    croo wrote: »
    Well MVC is not a pattern they define if that is what you mean but they actually start with a look at the concept of MVC which is the basis of smalltalk-80 (and just about every GUI based system since - there are not many alternative ideas) they then breakdorwn MVC to describe the patterns used in its creation (I did read the book - but not since the late 90s).

    These would of course be part of the View but they are not a alternative to the MVC design itself.
    Well, you can find MVC pretty much anywhere if that's what you mean :p I said they didn't mention it and I think this still holds true. MVC is so generic that any common sense GUI mechanism will have some resemblance to it.
    Those components would be not alternatives but sample implementations.


  • Moderators, Technology & Internet Moderators Posts: 1,336 Mod ✭✭✭✭croo


    none wrote: »
    Well, you can find MVC pretty much anywhere if that's what you mean :p I said they didn't mention it and I think this still holds true. MVC is so generic that any common sense GUI mechanism will have some resemblance to it.
    Those components would be not alternatives but sample implementations.
    No, they specifically mention it (on page 4!). It is just not one of their patterns.
    It's easy to be dismissive of MVC now when it is "obvious" and common sense.. but it wasn't always so!


  • Registered Users, Registered Users 2 Posts: 569 ✭✭✭none


    croo wrote: »
    No, they specifically mention it (on page 4!). It is just not one of their patterns.
    It's easy to be dismissive of MVC now when it is "obvious" and common sense.. but it wasn't always so!
    Ok, Ok, I raise my hat to your memory/literacy :) I didn't read it so if they did mention it, let it be so. Still, referring to their book as a good source of information on MVC would be a bit of an exaggeration, wouldn't it?


  • Moderators, Technology & Internet Moderators Posts: 1,336 Mod ✭✭✭✭croo


    none wrote: »
    Ok, Ok, I raise my hat to your memory/literacy :) I didn't read it so if they did mention it, let it be so. Still, referring to their book as a good source of information on MVC would be a bit of an exaggeration, wouldn't it?
    Well as it happens it was sitting on my bookshelf so it was not great feat of memory, on my behalf, to confirm :)
    And yes, you be correct, it is not a book I would recommend to learn about MVC. Which is why I said it does not address MVC per se... but rather as a subject to show what patterns were used in the smalltalk-80 MVC design specifically. Also, as I said; it is not a book I would recommend to someone starting out.

    I think what the OP really needs is a something like grails or rails that provides a basic framework or scaffolding in terms of grails (or rails? no experience there).. but one that is swing based which is why I suggested maybe griffon. But having looked closer at it since, it seems to be very early days for it.

    Personally, I think I would find a nice open source app that does something close to what I need and then enhance it... not point re-inventing the wheel!


  • Closed Accounts Posts: 32 SoItsMe


    Thanks to everyone who responded to me. I really appreciate your help.


  • Advertisement
Advertisement