From: Dean M. B. <mik...@gm...> - 2008-10-27 13:11:35
|
Hi Kim, On Mon, Oct 27, 2008 at 4:15 PM, Kim Gräsman <kim...@gm...> wrote: > > On Sun, Oct 26, 2008 at 16:04, Dean Michael Berris > <mik...@gm...> wrote: >> >> It's really more about avoiding as much of the decisions from reaching >> runtime -- and putting in the decisions in the design. For instance, >> an HTTP URL has waaaaay different parts from an email address (where >> both can be depicted as a URI). Another thing you can think of is the >> conversion from one URI type to a different URI (or URL) can happen >> with explicit compile-time rules: > > Sure, I can understand the motivation, but sometimes I think the code > gets too "artificial" to warrant the effort. I think that's primarily > because I don't recognize the idioms, patterns and practices the way I > do in the OO world. > In the beginning, I used to think so too -- that this "artificial" approach to doing something that traditional OO and runtime dynamic polymorphism and runtime checks and switches etc. have "straight forward" solutions to. However remember that one of the goals of the project is to move as much of the logic and decision making at compile-time as much as possible because doing things at runtime is usually inefficient, cumbersome, error-prone, and worst of all inflexible as far as design is concerned (object hierarchies are a little evil if you start thinking generic). I wish though that there was a single book/resource that deals with this subject matter (generic programming and template metaprogramming) but unfortunately there isn't one -- but there are quite a few. Let me try and list the two books that have greatly influenced my thinking here: Modern C++ Design: Generic Programming and Design Patterns Applied (by Andrei Alexandrescu) http://www.amazon.com/Modern-Design-Programming-Patterns-Depth/dp/0201704315 C++ Template Metaprogramming: Concepts, Tools, and Techniques from Boost and Beyond (by David Abrahams and Aleksey Gurtovoy) http://www.amazon.com/Template-Metaprogramming-Concepts-Techniques-Depth/dp/0321227255/ref=sr_1_1?ie=UTF8&s=books&qid=1225112272&sr=1-1 If you have the time (and patience? :D) maybe you'll pick up the idioms and patterns/practices faster than I did. :) > I'm going to give up on the URI feature. It's evident that we are > thinking in diametrically different directions, and I have no way of > expressing myself in these terms. > Give it a little time, it just may grow on you. :) We're not on a (strict) schedule (yet) anyway, so there's still time for experimentation and "getting things right". I'm still just "filibustering" and just presenting a possible way of doing things. I may be wrong in the way I'm thinking about it and maybe the approach you will come up with will be better -- or the synergy of our approaches might come up with something different and eventually better. :) > I did learn some interesting techniques along the way, though, thanks > for the help. No problem, and I do hope you keep contributing! Your efforts have been and continue to be definitely appreciated. -- Dean Michael C. Berris Software Engineer, Friendster, Inc. |