Any information would be great!
MVC towards the end of a project?
Page 1 of 16 Replies - 348 Views - Last Post: 22 April 2011 - 09:40 PM
#1
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!
Any information would be great!
Replies To: MVC towards the end of a project?
#2
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.
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.
#3
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.
#4
Re: MVC towards the end of a project?
Posted 21 April 2011 - 08:51 PM
Glad I could help!
#5
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
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
#6
Re: MVC towards the end of a project?
Posted 22 April 2011 - 09:21 PM
#7
Re: MVC towards the end of a project?
Posted 22 April 2011 - 09:40 PM
i loled at that comment
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote










|