Subj : Re: Change Patterns (was: Polymorphism sucks) To : comp.programming,comp.object From : Chris Sonnack Date : Fri Aug 12 2005 02:12 pm Robert Maas, see http://tinyurl.com/uh3t writes: >> Most professional programmers learned long ago not to code for the >> 'here and now'. > > IMO that position is overstated. Can we agree on: > Que sera sera, whatever will be will be, the future's not ours to see. No, because we're not idiots, and we *can* make certain determinations about the future, based on past experience. > We have to code for the present in order to get anything out the door. > But we should code with an idea what future needs might be. What I was referring to is that programmers shouldn't design solutions that address a specific problem in a specific way, but should abstract the problem and solve it in the most general way possible. That's the best hedge against future needs. One approach that does that is designing "engines" driven by data or parameters. For example, if your task is to create a program that, given a CAD/CAM file, draws a title block and borders dependent on your division or department, you do NOT build, essentially, a giant "select" that picks one and draws it....you design an engine that can draw *any* type of border or title block given a set of parameters. >> There's really three things here to talk about. Programming with >> Objects (encapsulated "things" that bind data and code to manipulate >> that data), > > Anyone who has given a second thought to today's serious OOP languages > (Java, C++ for example) knows that code aren't bound in the instance > objects, they are bound in the classes. That is how *those* languages are implemented, yes. *Conceptually*, which is the whole point of OOP, code and data are bound, and there are languages that don't work that way. JavaScript doesn't really even HAVE classes, yet you can create objects. > So is OK if I re-interpret what you wrote to mean the correct thing > instead of the way you worded it? No, because you misunderstood my point. >> and programming with hierachical Objects. > > Are you referring to hierarchial data structures, such as nested lists, > objects with pointers to other objects, etc.? As I thought was evident from context, yes. >> The simple fact is that heirarchical organization is common in many >> areas of human experience. Genetics, Organizations, Animals and many >> forms of data are naturally hierarchical. > > Um, Genetics are only *approximately* hierarchial. [...] > Animals of the commonly known types are mostly sexual, which means > *every* animal of such types has two parents, totally breaking the > hierarchial idea from the get-go. You're upside down. (-: Think of a given animal as the root. Two parents, who have two parents, each of whom have two parents, etc. With most humans, you need to go (one hopes) very far "down" the (upside down) tree before you get to any branches that reconnect. >> OOD is harder, and does require a higher skill set, than simpler >> forms of programming. It very much requires you to fully understand >> what you're doing, and it very much requires that you do the upfront >> analysis and design that WE'VE BEEN SAYING FOR DECADES SHOULD BE DONE >> ON ALL PROGRAMMING PROJECTS. > > Your expectation that at the start of any programming project we > already know exactly what we will end up with, is unrealistic. It would be, if that's what I'd said. The fact that you can't fully spec out any non-trivial project DOES NOT mean that you don't do as much analysis as possible up front. > Apparently you've never done any R&D, where you explore various ways of > solving a problem, doing experiments.... Gee, what's another word for R&D.....oh, yeah: analysis. > Here's a good mantra for all software people: REFACTOR It's a great mantra and one I apply to my personal projects. In the business world, things move too fast, so you need to get it as right as possible up front. Odds are very much against you revisiting it again (unless you really screwed it up the first time). -- |_ CJSonnack _____________| How's my programming? | |_ http://www.Sonnack.com/ ___________________| Call: 1-800-DEV-NULL | |_____________________________________________|_______________________| .