MVC (I'm gonna get it right this time)

When I started my project, I didn't even know what Model-View-Controller was. Now it's all to clear that my app is totally convoluted because I didn't use it. So I want to get it ABSOLUTELY right this time. I'm hoping to get a better idea of the responsibilities of each part
the closest thing to my project would be a midi sequencer.
What I know,
the model objects should contain all the data of where notes appear, velocities, tracks etc.
The view contains the code to draw to the screen and interpret user input.
What I want to know
� How to split responsibilities between the view and the controller?
� Should a list of the currently selected notes be stored in the view or controller?
� When the user clicks and drags some selected notes, What should the message from view to controller be?
ie "clicked and draged" or "change pitch of selected notes" or "change pitch of these specific notes????
� Should the view remember all the notes on a track or just the ones currently in view?
� Which part should do the reading/sending of notes the controller or the model?
Obviously the view objects shouldn't be as "stupid" as my computer monitor, but I'm still a bit confused... can anyone shed some light on the subject or provide some good reading? all the examples I see use simple 3 button apps which aren't very educational in terms of concepts
thanks all,
-matt
ps(I wont be using the included midi sequencer objects)
Edited by: Mat on Nov 7, 2007 2:55 PM

Your question requires a whole session on MVC pattern but to summarize the explanation to understand it practically, here are the components and where they fit in MVC.
Database - Model
JSP - View
Java/EJB/etc - Controller
Lets take an example for the above 3:
You have a user registration page, once the user enters his details, they will be validated and stored into a database table.
So the user registration page will be our JSP page and will be the view, this JSP page will invoke the controller which is nothing but a java class that handles or validates the data inserted by the user on the JSP page. This controller will then insert this data into the database table. Once it is successfully inserted, the controller java class will send a message to another JSP which will again display that message to the end user.
So this is how MVC works.
I hope this helps you a bit.
Choicest Regards
Amit Singh Rathore
www.proamit.com

Similar Messages

  • You'd Think They'd Get It Right This Time

    As the owner of a 2-day old sleek...
    My mother" " headphone jack is loose.
    Creative, WTF?!?!?!?!?!?!
    How are you continue to be this ignorant. You make an AMAZING player, and go ahead and let something little like a headphone jack mess it all up. You've seen these hundreds of people complain. DO SOMETHING ABOUT IT!!!!
    Makes we wonder if its worth getting another one...

    Rockin, didn't you post in another thread that you were playing ball while wearing the SleeK?
    "my sleek is amazing and highly recommended. unfortunately, the headphone jack just came loose about 20 seconds ago. i just came on to check if this is a common problem. it might be since i played b-ball with it "
    http://forums.creative.com/creativel...ssage.id=83296
    It is not a good idea to play ball while wearing any music player, especially one with a hard dri've.
    MP3 players are not intended for such rugged use.

  • Is this true that iphone 5 is gonna get released by this year end??

    Is this true that iphone 5 is gonna get released by this year end??

    Only Apple knows if and when the next version of the iPhone will be released and what that will be called.
    No one here knows as we are just users like yourself.
    Anyone that may know is bound by a non-disclosure agreement.

  • How can I get rid of this time code bar at the top of my rendered/exported video?

    This is the video after I rendered:
    This is the setting I used:

    That problem has nothing to do with format settings. It is a burn-in, which is set in the view settings (timeline panel), and also you can deactivate in the render settings.

  • FUNCTIONS (maybe I got it right this time)

    Sheesh! Not being able to use the "reply" on the list is a pain, but not near the pain & embarrassment of posting a non-functional function as I did earlier.
    Copied below, with sqlplus results documenting the test efforts, is a function that will return the number of quarters between two dates.
    CREATE OR REPLACE FUNCTION quarters_between (
       early_date date, late_date date)
    RETURN number
    IS
       first_date  number;
       last_date   number;
       interim     number;
       difference  number;
    BEGIN
       first_date := to_char(early_date,'yyyy');
       last_date  := to_char(late_date,'yyyy');
       interim    := nvl(last_date - first_date,0);
       IF (interim != 0) THEN
          interim := interim * 4;
       END IF;
       first_date := to_char(early_date,'q');
       last_date  := to_char(late_date,'q');
       difference := (last_date - first_date) + interim;
       RETURN difference;
    END quarters_between;
    SQL> SELECT quarters_between('27-AUG-03','19-FEB-04')
      2  FROM dual;
    QUARTERS_BETWEEN('27-AUG-03','19-FEB-04')
                                            2
    SQL> SELECT quarters_between('27-AUG-03','07-NOV-02')
      2  FROM dual;
    QUARTERS_BETWEEN('27-AUG-03','07-NOV-02')
                                           -3There. Now I can sit down and shut up.

    Heyy.. you dont have to start a separate post for each reply.. There is a button named "Reply"... Use that......
    If you are trying to add the two arrays then what you have done is wrong....
    Try this
    //declare c
    int [][]c=new int [2][2];
    for(i=0;i<2;i++) /// its a 2 dim array so i<2..
    for(j=0;j<2;j++)// again 2 dim array
    c[i][j]=a[i]+b[j];
    //print
    //you do it

  • Can I get an answer this time around?...

    Im looking for an inexpensive mountable video light for on the fly interviews. It just has to able to be dimmed, not just have the average on/off switch. I dont mind lugging around the battery packs and Im only looking to spend less than $150 on the lights/package. Links and reasons would be well appreciated.
    Thanks!
    Trollsy

    Alright, Scratch the old budget, how bout less than $300. Im doing on the fly interviews and I want them to come out looking superb. I have came across a whole bunch of bescor but Ive only used them once or twice, not enough time to really establish whether they are good or not. I noticed their low price range and was just curious if there are other similar lights that would be comparable, if not better. and how they stacked up against other pro lights. Thank you, and I am sorry I dont know that much!
    Trollzy • •

  • How do I get rid of a timer symbol in the middle of my screen ?

    Someone please tell me how to get rid of this timer symbol that stays in the middle of my screen ever since I installed the HP software for my Deskjet F2280 printer, this symbol still appears when I close the software and/or disconnect my printer and its really annoying at times and I thank anyone who helps me with this.
    This question was solved.
    View Solution.

    Zigglos, welcome to the forum.
    Here is an guide that may help solve your problem.
    Please click "KUDOS Thumbs Up" if I have helped you and click "Accept as Solution" if your problem is solved.
    Signature:
    HP TouchPad - 1.2 GHz; 1 GB memory; 32 GB storage; WebOS/CyanogenMod 11(Kit Kat)
    HP 10 Plus; Android-Kit Kat; 1.0 GHz Allwinner A31 ARM Cortex A7 Quad Core Processor ; 2GB RAM Memory Long: 2 GB DDR3L SDRAM (1600MHz); 16GB disable eMMC 16GB v4.51
    HP Omen; i7-4710QH; 8 GB memory; 256 GB San Disk SSD; Win 8.1
    HP Photosmart 7520 AIO
    ++++++++++++++++++
    **Click the Thumbs Up+ to say 'Thanks' and the 'Accept as Solution' if I have solved your problem.**
    Intelligence is God given; Wisdom is the sum of our mistakes!
    I am not an HP employee.

  • HT204053 Me and my daughter had been using the same apple id, she was triyng to change it now all of my iphone contact are gone, what can i do ti get it back , this is very important to me.

    Me and my daughter had been using the same apple id, she was triyng to change it, now all of my iphone contact are gone, what can i do ti get it back , this is very important to me.

    Your contacts are helpd on the server, so if you sign out from your iCloud account and sign into another one they will disappear. If you sign back into the original account they will reappear.

  • I have Iphone 4 and its lock from at&t, but my contract is getting over in short time. And no longer i want to use this service. So after contract gets over its my right to get factory unlock my iphone 4. so help me

    I have Iphone 4 and its lock from at&t, but my contract is getting over in short time. And no longer i want to use this service. So after contract gets over its my right to get factory unlock my iphone 4.

    jatpri1730 wrote:
    I have Iphone 4 and its lock from at&t, but my contract is getting over in short time. And no longer i want to use this service. So after contract gets over its my right to get factory unlock my iphone 4.
    Unfortunately, AT&T does not provide unlocking.
    Stedman

  • I was using my notes earlier today and now for some reason they are all gone. How does this happen and is there anything I can do to get them back, the new ones also that haven't been synced.

    I was using my notes earlier today and now for some reason they are all gone. How does this happen and is there anything I can do to get them back, the new ones also that haven't been synced.

    See Recover your iTunes library from your iPod or iOS device.
    tt2

  • When I access AOL on Firefox a "plug in tool bar" appears on the right side of my screen obliterating my scroll bar. How do I get rid of this annoying plug in bar?

    AOL says it's your browser that is causing this, not AOL and it makes AOL pretty useless to use on Firefox. Much easier to use Windows Explorer. Can you get rid of this "browse or add plug in" bar? How do I get around this? Using Firefox on a Windows Vista operating system.

    Opening in the sidebar is the default for bookmarks that are created via a link or button on a website.
    You can check the properties of a bookmark via the right-click context menu in the sidebar (Ctrl+B; Command+B on Mac).
    In the Bookmarks Manager (Bookmarks > Show All Bookmarks) you can click the More button in the Details pane at the bottom right.
    Make sure that "Load this bookmark in the sidebar" is not selected.

  • I do not want to update to Lollipop right now.  How can I get rid of the notification that wants me to install.  It says 'Install Later' or Install Now. I don't want to do either so how can I get rid of this notification that keeps popping up?

    I do not want to update to Lollipop right now.  How can I get rid of the notification that wants me to install.  It says 'Install Later' or Install Now. I don't want to do either so how can I get rid of this notification that keeps popping up?

    You cannot stop it from popping up.
    it will continue every few minutes until its installed.
    just keep using the back button near right side of home button.

  • I am complete novice as far as ipad air is concerned I have got lots working but Ihave gone to app store again but now the page is greyed out with a bright centr to get a game i do not want how do i get rid of this please

    I am having trouble understanding my ipad going to the app store it comes up with  a greyed out page withe a bright centre for installing a program i do not want
    How can I get rid of this? it is bugging me
    Herbette

    I'm not exactly sure what you are seeing and what is happening, but try closing the App Store app, and then reset the iPad. See if that takes you out of that screen and allows you to navigate freely again.
    Double tap the home button and you will see apps lined up going left to right across the screen. Swipe to get to the App Store app and then swipe "up" on the app preview thumbnail to close it.
    Reboot the iPad by holding down on the sleep and home buttons at the same time for about 10-15 until the Apple Logo appears - ignore the red slider if it appears on the screen - let go of the buttons. Let the iPad start up.

  • After purchasing the Photoshop cs6 update for my Mac, the download page says for "Windows". Will this still work? How do I get the right download without purchasing again

    After purchasing the Photoshop cs6 update for my Mac, the download page says for "Windows". Will this still work? How do I get the right download without purchasing again?

    no.
    you need the update for a mac, not windows.
    Product updates

  • HT1212 guys!!!! i forgot my itouch password and now it's totally disabled... what else i can do?? i mean my itouch5 is never been sync to any computer... pls help me to get rid of this passcode!! and do all my data and apps will be gone or will it be ther

    guys!!!! i forgot my itouch password and now it's totally disabled... what else i can do?? i mean my itouch5 is never been sync to any computer... pls help me to get rid of this passcode!! and do all my data and apps will be gone or will it be there?? pls

    Forgotten Screen-Lock Passcode
    Connect the iOS device to your computer and try to make a backup
    iOS: How to back up
    Then restore via iTunes. The iOS device will be erased. Place the iOS device in Recovery Mode if necessary to allow the restore.
    If recovery mode does not work try DFU mode.
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    For how to restore:
    iTunes: Restoring iOS software
    To restore from backup see:
    iOS: Back up and restore your iOS device with iCloud or iTunes
    If you restore from iCloud backup the apps will be automatically downloaded. If you restore from iTunes backup the apps and music have to be in the iTunes library since synced media like apps and music are not included in the backup of the iOS device that iTunes makes.
    You can redownload most iTunes purchases by:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store    

Maybe you are looking for