Re: design pattern for a file converter...
On 11-12-2010 08:57, Tom Anderson wrote:
On Fri, 10 Dec 2010, Stefan Ram wrote:
Tom Whittaker <ojasrege@yahoo.com> writes:
Does anyone have any insight into the best design pattern(s) to use
for this feature?
I tend to write such code in a more procedural manner first.
Then, I see the patterns in the code.
Then, I refactor to make the patterns explicit if this seems
to be of any use at all.
This is what i do too. When i was younger, i used to start with a lovely
objecty design. I think what broke that habit was spending a few years
in Python instead of Java, mostly writing very simple, procedural
programs, because of the nature of the work i was doing. When i came
back to Java, i found myself in the same mindset as Stefan - start
simple, and refactor out the objects and patterns as they become obvious.
I think it depends on the problem.
I don't think starting a 500 KLOC project procedural and then
refactoring to OO later will work.
For small apps it may work fine.
The goal is to solve the problem and to get source code
that can be read and maintained easily - it is not to apply
design patterns.
Perfectly put.
When design patterns serve that purpose,
they impose themselves on the experienced programmer during
the development.
They can do, but do not inevitably do so. If you apply the right pattern
at the right time, it reduces complexity from then on; that moment can
come at any point in development. But there's no sense trying to
shoehorn in a pattern before it does.
Yep - over applying patterns is a known anti-pattern.
Arne