On 31 May 2013, at 01:43, Jens Alfke <j...@mooseyard.com> wrote: > > On May 30, 2013, at 3:52 AM, Ian Joyner <ianjoy...@me.com> wrote: > >> What I am trying to point out though is that there is a misapprehension that >> premature optimization means writing structured code early on so don't >> structure it because you can always go and clean it up later. Rather I think >> we should write well-structured code as we go. > > I agree 100% with that. Structured code is easier to benchmark and optimize > later on, anyway — as I said, if you repeat a piece of code ten times, none > of the ten instances may show up individually as hot spots, whereas if you > called a common function/method in ten places, it may show up and then be > easy to fix. > > I would add, though, that the perfect structure (class hierarchy, API, > factoring…) may not be apparent right away, especially since you’ll often end > up refactoring as you go along. So trying too hard to structure code as > you’re initially writing it can end up being a rathole.
Absolutely. It's often the case that we try to get everything ultra-structured before writing any code. This can be a writer's block. We often have to use the process of coding as an exploratory process. That is the very essence of software. It also means that software can be refined as we go. But often we need to know when to stop. Structured (and OO) languages directly support the paradigms. This seems not well understood since we attempt to structure code (code is a term I don't like) by the use of diagrams because we treat the act of programming as translating this into a machine-oriented artefact. But in fact a text-based programming language is often more malleable than such diagrams (in terms of both tool and mental attitudes that a diagram is fixed, even if a programmer comes up with better designs). _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com