Exforsys

Online Training

Spaghetti Code

This is a discussion on Spaghetti Code within the Software Patterns forums, part of the Testing category; I've got a class with about 1029 lines of code - obviously I want to refactor this, but the first ...


Go Back   Exforsys > Testing > Software Patterns

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-07-2005, 02:36 PM
Jenski
 
Posts: n/a
Spaghetti Code

I've got a class with about 1029 lines of code - obviously I want to
refactor this, but the first thing I need to do (I think) is separate
the GUI from the logic stuff. Anyone know of any sites or links to show
how to do this?

Thanks

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 12-07-2005, 03:12 PM
Robert Waters
 
Posts: n/a
Re: Spaghetti Code

If I understand your question, you are looking for the Model-View-Controller
pattern. Just google on those three words together just get you a bunch of
hints on what functionality should go where.

Bob
"Jenski" <jenski182@aol.com> wrote in message
news:1133984167.920588.221120@g44g2000cwa.googlegroups.com...
> I've got a class with about 1029 lines of code - obviously I want to
> refactor this, but the first thing I need to do (I think) is separate
> the GUI from the logic stuff. Anyone know of any sites or links to show
> how to do this?
>
> Thanks
>



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 12-27-2005, 01:34 PM
pitdog@gmail.com
 
Posts: n/a
Re: Spaghetti Code

What you need is a MVC pattern. A Model View Controller. keep in mind
that there are 3 major types of a MVC. You have a Front Controller, a
Page Controller or a Application Controller. There maybe more but I
have not used any others.

If your app is small and web based I would almost always go with a Page
Controller. And if you are using .NET this is the default behavior so
that makes it even easier as it is built into the Visual Studio. If you
are using Java Apache Struts is a very nice Front controller.

Good Luck it is really fun stuff,
PitDog

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 12-29-2005, 09:54 PM
Nick Malik [Microsoft]
 
Posts: n/a
Re: Spaghetti Code

There is a good book that provides names to the various techniques needed to
take a 'bad' bit of code and rework it until you get a good bit of code.
That book is called 'Refactoring' and I believe it was written by Martin
Fowler. Excellent for advice on how to clean up your code.

MVC is probably not the pattern you need (based on statistics: there are
hundreds of patterns. both responses picked one without any foundation
whatsoever for selecting it. Odds are, they are wrong!)

Not only is MVC a particularly vague pattern, it is nearly useless in
event-driven systems like we usually face today. It's derivatives like
Front Controller are useful, but your problem could be solved by an entirely
different combination of patterns. It is hard to tell based on the limited
info you provided.

Check out the 'Refactoring' book. It will help.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Jenski" <jenski182@aol.com> wrote in message
news:1133984167.920588.221120@g44g2000cwa.googlegroups.com...
> I've got a class with about 1029 lines of code - obviously I want to
> refactor this, but the first thing I need to do (I think) is separate
> the GUI from the logic stuff. Anyone know of any sites or links to show
> how to do this?
>
> Thanks
>



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new questions
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 09:39 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2004 - 2007 Exforsys Inc. All rights reserved.