6 Replies - 482 Views - Last Post: 22 April 2011 - 09:40 PM Rate Topic: -----

#1 Criel  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 128
  • Joined: 11-March 11

MVC towards the end of a project?

Posted 20 April 2011 - 07:14 PM

I've been reading up on MVC and I would like to apply it to my project. My GUI form has absolutely horrendous code. No organization, a bunch of jumble. I don't even know where it all came from. I would LOVE to organize my project however I have been trying to do little things here and there and found out it's going to take awhile longer than expected. Would MVC be smart to do on a project that I'm already thigh high in? Is MVC something you start from the beginning or is it something you do to your project after you are into it?

Any information would be great! :)

Is This A Good Question/Topic? 0
  • +

Replies To: MVC towards the end of a project?

#2 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10447
  • View blog
  • Posts: 38,690
  • Joined: 27-December 08

Re: MVC towards the end of a project?

Posted 20 April 2011 - 07:27 PM

MVC is a good design pattern to use. In fact, GregBrannon has an excellent tutorial on MVC.

In general, better to start with the design early on and proceed from there. Refactoring code later, especially if poorly designed, can be a pain.

What I do with my programs is organize my data first. I then create a DataManager or StateManager singleton class to manage my program state/data. The user interface tools then interact with the StateManager or DataManager object to get/update data.
Was This Post Helpful? 2
  • +
  • -

#3 Criel  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 128
  • Joined: 11-March 11

Re: MVC towards the end of a project?

Posted 21 April 2011 - 08:47 PM

Thanks for the tutorial. It helped a lot and my code is looking better than ever! Thanks for the help. :)
Was This Post Helpful? 0
  • +
  • -

#4 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10447
  • View blog
  • Posts: 38,690
  • Joined: 27-December 08

Re: MVC towards the end of a project?

Posted 21 April 2011 - 08:51 PM

Glad I could help! :)
Was This Post Helpful? 0
  • +
  • -

#5 cfoley  Icon User is offline

  • Cabbage
  • member icon

Reputation: 1949
  • View blog
  • Posts: 4,048
  • Joined: 11-December 07

Re: MVC towards the end of a project?

Posted 22 April 2011 - 05:33 AM

Finding out that your design isn't as ideal as you thought is actually very common. It happens a lot when your requirements change or when assumptions you made turn out to be incorrect. It can be difficult to factor your code into something more suitable.

In the situation you describe, my approach for reorganising it would be first to refactor your messy GUI methods into nicer methods. From here, you should be able to identify functionality that shouldn't be in the GUI at all and can be moved to other classes, all the time making sure your code still performs correctly at each stage.

I would be wary of trying to shoehorn what you have into MVC. It might be more effort than it is worth.

If you are interested in refactoring in general, Martin Fowler' book is excellent! See if your library has it:
http://www.amazon.co...03475319&sr=8-1
Was This Post Helpful? 3
  • +
  • -

#6 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8327
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: MVC towards the end of a project?

Posted 22 April 2011 - 09:21 PM

View Postcfoley, on 22 April 2011 - 07:33 AM, said:

If you are interested in refactoring in general

We used to call it "refucktoring" :)
Was This Post Helpful? 3
  • +
  • -

#7 DaneAU  Icon User is offline

  • Great::Southern::Land
  • member icon

Reputation: 284
  • View blog
  • Posts: 1,617
  • Joined: 15-May 08

Re: MVC towards the end of a project?

Posted 22 April 2011 - 09:40 PM

i loled at that comment
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1