[z3-five] Re: Some design questions
Philipp von Weitershausen
philipp at weitershausen.de
Mon Apr 18 22:38:12 MEST 2005
Andreas Jung wrote:
> --On Montag, 18. April 2005 19:58 Uhr +0200 Philipp von Weitershausen
> <philipp at weitershausen.de> wrote:
>
>> german_stopwords = zapi.getUtility(IStopWords, 'de')
>>
>> So, in short, all stop-word objects are utilities that provide IStopWords
>> and their registration name is the country/language code. The same thing
>> would most probably make sense for converters (utility name would be the
>> mime type) and the parsers (name would be the country/language code
>> again).
>
> Utilities are available in Five?
Yup. They work just like in Zope 3, simply use the <utility /> directive
in ZCML.
>>> Another problem is efficiency....if an index handles only one
>>> language then subsequent lookups for the same language dependant
>>> classes (always the german stopwords etc.) must be cached somehow (it
>>> does not make sense to re-read the same stopword files over and over
>>> again).
>>
>> I can only recommend one thing, especially when you're doing a rewrite of
>> something: Write clean code first and optimize later!
>
> Of course but I know where the problems are so it does not make sense to
> reimplement an inefficient implementation again :-)
That's true. However, if you're jumping into a whole new world of design
patterns, it's been my experience that it's preferrable to postpone the
optimization issue until you've figured out a sane API and got the
system working.
Also, I've found that I'm often wrong about what's *really* slowing down
the app. So, without serious profiling of an implementation you already
have, it is quite hard to tell what will be the biggest show stopper in
the end (Of course, I realize that you're not a total virgin on this
subject and most likely know where the bodies are buried--but you get my
point).
Philipp
More information about the z3-five
mailing list