Re: offtopic: best way of plainng overall structure of programs/functions etc.
Re: offtopic: best way of plainng overall structure of programs/functions etc.
- Subject: Re: offtopic: best way of plainng overall structure of programs/functions etc.
- From: Uli Kusterer <email@hidden>
- Date: Sun, 5 Aug 2007 12:11:10 +0200
On 05.08.2007, at 01:40, Stephan Huebner wrote:
So, the problem ist: I've never found the perfect (or at least
elegant) way to lay out the structure of a program before sitting
on the computer. So more than once I found that the solution I
scribbled on a paper didn't work as I expected and then I sat there
in front of the computer and began to hack around until the
functions did what they should do.
The simple question is: How do the Experts do it? How do they plan
an application? Are the apps to lay out an application or objects-
structure of any use? I think there's one from the Omnigroup, but I
think I've tried it out once but did not like it enough to use it.
Or maybe I was just too impatient, who knows.
I think the two main tools in your toolkit should be experience and
refactoring. The latter when the former fails you.
What I often do when I start doing something that I never worked
with before is that I write a small prototype that does the essential
things. I make it work, and I get some things wrong. Then I sit down
and write the actual implementation with the knowledge I've learned
from my mistakes in the prototype. Of course, you need experience to
know what features to implement in the prototype, and which to leave
out because they're "easy".
So, if I realize in actual implementation that it doesn't work, I
generally start rearranging, deleting and changing code until it
works. This is what refactoring is all about, just that I bite the
bullet and rearrange all my code until it is a good design again.
Turn messy code into clean code again. Split up huge classes that do
everything and the kitchen sink into smaller, manageable classes that
have clear divisions and purposes. Merge classes that are too closely
coupled anyway, and split them up differently.
It's a bunch of work, but if you do it repeatedly and early on
during development, you'll have maintainable code in the end.
Otherwise, you'll have ... err... spaghetti.
Cheers,
-- M. Uli Kusterer
http://www.zathras.de
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden