Loading ...
Sorry, an error occurred while loading the content.

107823RE: [XP] Design Agility? (was: Duplication vs Intention Revealing code)

Expand Messages
  • Charlie Poole
    Jun 1, 2005
    • 0 Attachment
      Hi Ron,

      > > It wouldn't be a big problem in this case to rewrite all the code
      > > since it's a relatively small function. This issue can also
      > apply to
      > > larger programs when I18N is added after an initial implementation
      > > (rather than being specified up front). Rewriting a large
      > application
      > > might not be considered an acceptable solution for some (many?)
      > > customers.
      >
      > But rewriting an entire application in order to
      > internationalize it seems extremely unlikely, especially if
      > it has any reasonable design structure at all, n'est pas?
      > Nicht wahr? Eh?

      I wonder if it isn't confusing the issue to refer to this as I18N.

      Normally, the term refers to changes that are incidental to the overall
      purpose of the application. This particular function has a linguistic
      purpose
      at it's heart: performing a limited sort of natural language generation.
      It
      isn't at all unreasonable to expect that we might need a different
      algorithm
      for different languages - ones we don't know for example.

      In a large application, I would probably expect to deal with such a
      function
      through a Strategy pattern, at least for some languages. I'd implement
      it as
      soon as I needed to create a second function. And like you, I'd probably

      create a second function for the second language. If we had two or three
      langues implemented and I saw a chance to remove duplication, I'd
      probably
      do so, but at that point, I might keep the Strategy pattern, for the
      time when a
      language I don't know about came along.

      That said, it's a fun problem. I've used it as an exercise in C++
      classes and
      I think it had the highest variance in terms of length of code needed to
      solve
      the problem of any exercise we did.

      Charlie
    • Show all 17 messages in this topic