Author: chipsquips

Slashes on the dash

The engineers who designed the dashboard controls for our VW Eurovan must have loved fractions.  The tachometer (a questionably useful feature on a van equipped with an automatic transmission) is marked in large increments labeled “10”, “20”, ‘”30”, etc.  In the lower-left corner, this system is explained by the legend: “1/minute x 100”.

If they had simply marked each increment “1000”, “2000”, etc. then they could have simplified the legend to “1/minute” or even the generally recognized “RPM”.  And if the extra zeroes were deemed inefficient, then why not label them “1”, “2”, etc., and change the legend to “1/minute x 1000”?

Perhaps an appreciation for this feat of German engineering lies beyond my lights.

One day, my wife called home on her mobile phone while driving (which is now illegal in Washington) to tell me that the Eurovan was almost out of fuel.  “But I just filled it up!” I cried.

“Well, the needle is right on the line now, so someone must have siphoned off our gas,” replied my wife.

I didn’t have much time to worry about who might have come onto our property to steal fuel, because I needed to catch a ferry as soon as my wife returned – and now I had to worry about taking enough time to fill up the tank en route.  As soon as my wife drove up, we exchanged a hurried greeting and I took off.  Worried that I might run out of gas before I got to the station, I glanced down at the gauge.  It was full.

But I can’t fault my wife too much.  The gauge does not sport the helpful letters “E” and “F” that have become so familiar to American motorists.  No, the VW engineers decided that since they needed to label the midpoint “1/2”, it made perfect sense to be consistent and mark the full end of the spectrum with “1/1”.  They did not label the empty end, however.

I would have expected “1/∞”, or something equally well defined.

Tags: design, eurovan, vw
Continue Reading

Homeward

Written on the plane last night

I’m seated by the window of a Boeing 737-400 on our way back to the Boeing mother-nest, Seattle.  The SPC went very well, I think.  The workshops, especially those presented by Steve Ives, did justice to what is without any hype the most significant release in the 30+ year history of the Synergy/DE product line.

As for me, I avoided getting hammered the night before my presentation. Back in the day, I could party all night with customers and give three or four presentations the next day on four hours of sleep and some Tylenol, but for better or worse I’ve gotten unused to that behavior in my advancing age.   I got to bed rather early that night, and I prepared better for that session than any I have ever presented before.  So I had no excuse for a bad performance other than by own ineptitude — but I think it went off well anyway.

I also had the opportunity to say a few words in honor of Ken Lidster, my mentor, who is retiring this year.  Ken was one of the two original creators of Synergy/DE (then called DBL), and his understanding of programming language theory and design continue to inspire me.  I’m hoping that Ken will find it difficult to stay uninvolved in the language, and that I’ll have plenty of opportunities to work with him in the future.

Besides Ken, Inge King is also retiring this year.  She’s my sales representative (I’m also a customer of Synergex), but more than that she’s a great friend of both my wife and I.  But I expect to see even more of her and her husband in the future, as they have a daughter and grandchildren living in the Seattle area.

Liz Marmins interviewed me on tape regarding Synergy/DE version 9 and the SPC.  No doubt they’ll edit out my repetitious babbling and make me look like I know what I’m saying.  When it gets posted on their web site, I’ll link to it — no matter how embarassing it turns out to be.  I’m such an exhibitionist.

It was good to reconnect with so many of these people after all these years, but I’m glad to be heading home.  After the two-hour flight, I’ll catch a ride  to downtown Seattle where I’ll take the 35-minute ferry ride to Bainbridge.  There I’ll catch a cab home — probably after midnight.  I’m hoping that I was missed and will be appreciated, but I fear that revenge may be in the cards instead.  We’ll see.  Maybe a combination.

Tags: bainbridge, boeing, ferry, ingeking, kenlidster, lizmarmins, programming, seattle, spc, synergex, synergyde, travel
Continue Reading

Random 8

Catching up on meme-tags, here’s one I owe to Tish:

The Rules:

  • Players start with 8 random facts about themselves.
  • Those who are tagged should post these rules and their 8 random facts.
  • Players should tag eight other people and notify them that they have been tagged.

Eight random facts about yours truly:

  1. I like food that’s so spicy that most people can’t eat it, and some folks can’t even stand to be nearby while it’s cooking.
  2. As a US Air Force brat born in West Germany, I nearly reached the East German border alone one day when my parents weren’t watching.
  3. I’ve lived in Germany, New York, Texas, Maryland, Virginia, Oklahoma, Florida, California, and Washington State in roughly that order.  I’ve never lived in any one home for longer than eight years.
  4. I love to travel – by plane is OK, but driving is far better.  Unfortunately, circumstances keep me at home most of the time.
  5. I fell madly in love with a girl when we were both in second grade.  She rejected my advances (go figure), and I never fully got over it.  I’ve been far too careful with my heart ever since, although I’ve rarely lacked someone to love throughout my adult life.
  6. When I was in the third grade, I was on a live local TV quiz show.  As part of the introductions, the emcee asked me what was my favorite game.  I replied, “Poker.”
  7. Music for me can be almost any genre, as long as the creator(s) put everything they have into it – no holding something back for later.  Each piece of music should be written as if it were their last.
  8. I’d like to be able to say that I live each day as if it were my last, but that wouldn’t be true.  I’m often sulky, keep things to myself, and ignore my loved ones.  Sometimes I even sincerely wish for death.  Then at other times when enjoying life to the point of feeling a buzz in my scalp, I wonder how it was possible that I could have ever been possessed of such weltschmerz.  It makes me believe that my brain is a highly volatile chemical compound over which I have less control than I’d like.

Hmm.  Seems like some of these could be developed into full-blown posts of their own.

Now for 8 random tags:

8.times { |n| puts(blogroll[Integer(rand * blogroll.length)]) }

Gabrielle
Michael
Aki
Diogenes
Scott
Darrell
Cooper
Danielle

Tags: akijinn, daniellelafleur, darrellgrizzle, halfass, life, love, meme, michaelbains, music, poker, quasifictional, random, techchickblog, wonderlandornot
Continue Reading

Bullying starts with bull

I’m not ready to declare meme-debt bankruptcy yet, so I’ll tackle another tag today.  Here’s one from Randy about bullying.  You’ll have to read his post first to know what the questions mean.

Am I a bad person, if I’m happy to know that the bully did not live a full life?

Randy was pleased to hear that someone who had bullied him died in an accident while they were both still young.  I can appreciate Randy’s sense of vindication and relief from further bullying.  But if you go on to say “he deserved it” then you’re saying that bullying merits a death penalty.  I don’t think I’d want to go quite that far.

Were you bullied as a kid?

Are you kidding?  If I had allowed anyone to bully me, I would not have been able to look my father in the eye.  He taught me how to fight when I was very small, often forcing me to continue until one of us drew blood.  I hated that, but it did prepare me for the playground.  My Dad always said, “Never start a fight — but always be the one to end it.”

One day early in my first grade year, a sixth grader decided to pick on me, and started punching me in the arm.  Without passion or anger, I followed my father’s advice and gave him a swift one to the nose.  He ran off, and I was never bothered on the playground again.  Naturally, someone reported this event to my teacher, who could not understand the logic of my actions, and punished me (with a spanking, ironically).  Very conflicted, I related all of this to my father that night.  He expounded a long and thorough explanation about how society often punishes you for doing what you must, replete with examples from his Air Force career.  Then he said he hoped that I had endured my spanking proudly, and congratulated me for standing up for myself.  My Dad should have been born in ancient Sparta.

Was bullying as rampant in your schools, as they were in mine?

Bullying was common, especially on the playground and the buses — but I don’t think it was as pervasive as Randy described.  I often felt compelled to intervene on behalf of those who wouldn’t stick up for themselves.  In those cases, it never came to blows — a well-aimed “pick on someone your own size” usually answered the purpose.

What happened to the bullies in your school?

Despite the fact that I was immediately reported for defending myself, nobody ever reported bullying to teachers.  Most were afraid that they would become more attractive targets if they did.  For me, I didn’t think telling teachers would do any good, judging from the justice I had received at their hands.

So instead, a silent culture developed — much like in a prison.  The best way to divert the unwanted attentions of bullies was to reveal them for the cowards that they were.  A satirical comment to others in their hearing about how they needed to pick on the weak would usually do the trick — but you always had to be willing to back that up with physical measures if it had the opposite effect.

But times have changed.  I don’t advise my children to get physical.  I do advise them to tell their teachers.  I believe that schools handle bullying more thoroughly and justly than they did when I was young. I hope to hell I’m not mistaken.

Was it just the boys, or did the girls bully too?

The girls were often worse — to other girls.  It’s a good thing that girls back then hardly ever picked on boys, because I would never have been able to use even the threat of violence as a defense.  My father taught me that striking a woman for any cause was the lowest form of low.  To even imply that you might do so would be a blemish on yoru character that could never be removed.

Sometimes it’s hard to realize just how divided the sexes were in those days.  The girls managed their own culture separately from the boys, for the most part.  I can recall only one time where I stepped in to reprove a girl my age for picking on someone smaller.  That happened on the school bus, and the only tool I could employ was to shame her.  Luckily, I’ve always had a way with words.

Were you the bully?

No.  I never picked a fight or pushed people around.  Even in defending myself, my conscience was always stung by my Baptist upbringing and Jesus’ command to “turn the other cheek”.  In fact, I became a radical religious pacifist by age 15 — abrogating even self-defense, much to the chagrin of my father – but somehow I had already established myself in the social hierarchy at school such that I never had to test my commitment to that creed.

I’ve never understood the mind that needs to subjugate others to its will, against theirs.  People are generally enough trouble as it is — why would you want to churn up resentment against yourself and make things worse?  I don’t want to get all psychoanalytic on you, but I can only think that a bully must have no life worth living – or they wouldn’t need that type of diversion.  So back to your first question, Randy — maybe his death was merciful.

I’d like to tag a few people who came to mind as imagined readers while I was writing this post: Shelley, Shelley, Joseph, apotheon, Jessica, TDavid, Kent, Doug, and Cooper (sorry for the quick re-tag).  Tell us about your experiences with bullies in school.  As always, anyone else who would like to participate, feel free and I’ll give you some linkage.  I’d really like to tag Kathy, but I don’t think she’d answer.

Continue Reading

Stuffing the blogroll

Kent tagged me for round two of his swivel feeds experiment.  To recap: Kent, bored with many of his feeds, gutted his feed reader.  With only the meat and bones left, Kent asked for help with the stuffing.

So trying to keep your particular tastes in mind, here are my contributions to the recipe, Kent:

  1. 1 teaspoon dried leaf sage, crumbled:  indexed by Jessica Hagy.  Jessica packs a lot of flavor into a small space — a chart on an index card.
  2. 1/2 cup finely chopped celery:  [Geeks Are Sexy] Technology News.  Even though you read a lot of tech news feeds already, I like [GAS] because it’s succinct and well-written.  OK, and they also had me contribute some posts (shameless self-promo disclaimed).  Adds crunch.
  3. 3 tablespoons finely chopped onion:  Middle Zone Musings, by Robert Hruzek.  Robert always gives you something to laugh about as well as something to think about.  Flavor and texture.
  4. 6 tablespoons melted butter:  The Marketing Technology Blog, by Doug Karr.  Doug covers a lot of ground, from, um, marketing to, um, technology — and he carries on great conversations with his readers.  Gives consistency to the whole.
  5. 1/8 teaspoon cayenne pepper:  Wonderland or Not, by cooper.  Cooper => Alice => Wonderland… or not.  An insightful 22-year-old anthropology student with an edgy sense of humor.  Adds zing.

Hope you enjoy my contributions, Kent!

Tags: blogroll, blogs, dougkarr, geeksaresexy, jessicahagy, kentnewsome, roberthruzek, swivelfeeds, wonderlandornot
Continue Reading

Chipping the web – the sum of digital power

A piano has a total of 88 keys, counting both the black and white ones.

TDavid sent me some help for thinking of subtitles for these “Chipping the web” posts: What’s Special About This Number?  So if you’re puzzled by my titles in future, this might be a good place to look.  Hint: some other good sources are Google and Wikipedia.

The World RPS Society, serving the needs of decision makers since 1918 — via Rock, Paper, Scissors.  Their explanations of the nuances of various gambits are jaw-dropping.

Try reading this in a GWB voice (thanks, Jim).

Darrell and Cooper responded to my tag on the Random 8 meme, and Kent responded to my tag on the Bullying meme.  You can’t accuse Kent of being stingy with the Google juice.

Tags: americanism, bullying, bush, chattiecat, darrellgrizzle, google, googlejuice, jimcobb, kentnewsome, meme, numbers, piano, random8, randymorin, rockpaperscissors, satirewire, tdavid, wikipedia, wonderlandornot
Continue Reading

Still smiling

This little icon of yours truly has become my online visual proxy in a number of fora (that’s plural of “forum” for the Latinally challenged), including Technorati, TechRepublic, MyBloglog, BlogCatalog, Gravatar, and who knows where else that I’ve forgotten that I dropped my pixels. But have you ever wondered (oh to imagine my vast following of groupies) whence cometh said image? Well, wonder no more!  Behold, the full image from which this icon was clipped.

I’m standing on the beach belonging to our former home on Rich Passage.  This was the last day that we visited that beach, being under contract for sale.  It was a bittersweet day.  We loved that place — at low tide we had about 100 feet of beach from our house to the ocean, and at high tide you could cast a line from our upper deck and hit the water.

Sometimes at night the deer would walk down to the beach and lick the salt off the rocks.  I often miss the sound of the waves breaking on the shore while I was drifting off to sleep.

Why did we leave there?  The lot was a grand 0.19 acres, and half of that was under water at high tide.  Our children had no place to play.  The road, which was within twenty feet of our front door, was getting busier every day.  And every available square yard of land around us was being built up with grand houses overlooking the Passage and destroying our peace.

Our children needed a place to ride bicycles.  Our fifteen-year-old dog passed away, and we wanted to get a new puppy (which turned out to be Halley), but we had no room for an active dog to run around.

So, we sold our waterfront dream home and bought a place on 2.35 acres surrounded by huge cedars and hemlocks.  We can’t see our next door neighbors.  Our kids can ride their bikes for hours and never leave our property.  Our dog has a huge run.

But sometimes I miss the water.  Early every morning I would walk along the shore.  On a clear day, I would pause to gaze at Mount Rainer.  I took this picture on one such walk.

This was about a mile from our house.  Another quarter mile brought me to the Treehouse Cafe, run by my good friend Arnie.  He was just getting started in his own business there when I first visited.  Now he’s booming — rented more space in Linwood Center, installed taps.  He’s fathered two kids since then and hardly shows up on weekends.  I’m happy for his success.

Many times while the sky was still black I’d show up at his doorstep before opening time, but he’d let me in and pour me a Triple Americano Grande with cream.  He and I would philosophize while I sipped the strong brew and he prepared for the day’s business.

One day in mid-winter, the cold rain beat upon me as I advanced along the shore in the darkness.  But the lights at the Treehouse ahead promised dry air and hot coffee.  I lurched through the door and threw the hood off my head in the warmth.  Arnie greeted me and introduced me to Bill, who was seated at a table, sipping a cup and eating a bagel.

Bill was a retired trucker from Arlington, Massachusetts (that’s pronounced AH-lingten Mass) who took a part-time job delivering the bagels from Port Townsend.  The Treehouse was his southernmost delivery, so he would relax with a cup of coffee and a bite of something before heading back home.  He greeted me with a big handshake and asked me to sit down at the table with him.  We hit it off instantly.

At one pause in the conversation, Bill sighed.  “Have you ever had to deal with the approaching death of a pet?”  I had — just a few months before, our beloved fifteen-year-old Samoyed had passed away in her sleep.  Bill revealed that his seventeen-year-old dog was on his last legs.  We got to talking about dogs of ours that had gone before.

“The last time this happened, I swore I’d never own another, ” Bill said.  “After that one died, you’d never want to see a sorrier sight than this rough old trucker driving his big rig down the turnpike and blubbering like a baby.”

“I know how you feel, ” I replied.  “You can stand beside the casket of your own parent whom you mourn bitterly, and nevertheless be aware of their faults in life — as much as you love them.  But a dog only ever wants to please its master.

Once when I was a sapling Southern Baptist, I asked my great-grandmother the question that was always difficult for other church members: “Do dogs go to heaven?”

She replied, “Well, son — of the dogs I have known, if they didn’t deserve heaven, then no people do.”

Bill slapped his big palm on the heavy oak table and declared “Isn’t that the truth!”  We talked for an hour or more on many subjects.  After that, Friday conversations with Bill became a regular event.

When we were preparing to move, I told Bill that my new home was too far away to make it to the Treehouse even once a week.  We traded phone numbers and promised to keep in touch.

But neither of us ever called.  I think we both knew that the same ongoing conversation couldn’t be transplanted out of the Treehouse, away from the big oak table, two cups of coffee, and Arnie cleaning up behind the counter, getting ready to open for the day.

Continue Reading

wOOt!

What a relief!  Last night I finished planning my OO presentation for the SPC and sent the PowerPoint slides to Synergex.  I’m looking forward to giving this talk, but lots of other things had kept me away from working on it, and the deadline for slides was today.

It’s been about five years since I last presented at a conference, and I’m taking quite a different approach with this one.  Usually in the past, I would write my presentation as bullets (essentially the overheads) and just talk from them.  That worked OK, provided I was lucky.  And alert.  And not too nervous.

But typically, I’d talk too fast and forget half of what I meant to say, and end up at the “Questions?” slide about half-way through the allotted time, with nobody asking any questions because they hadn’t even begun to follow any of the jargon-laced broken sentences with which I peppered them like so many live rounds — the “ums” acting as tracers.

Or else in trying to avoid that scenario I would pack my slides full of content so there would be no way to run out.  Which resulted in me talking even faster and flipping through the last slides just as time expired, finishing off with “Questions? OK, great.  Thanks, bye.”

This time, I started by writing my presentation out longhand.  This came very naturally to me, now that I’ve been blogging for over a year.  It only took me a couple of days to write it, almost as if it were a lengthy blog post (in fact, I used Windows Live Writer to compose it).   From that, I went back and created my slides.  Some of the slides act like graphics for the post, others outline certain sections of it.  So when I present, I’ll be more or less repeating my narrative and flipping the slides that go with it.  I’m thinking that will be quite a bit more natural and interesting than flipping to a slide, studying it for a moment, and then trying to think of what I meant to say.

Another difference that five years has brought:  I’ll be referring to blog posts for the first time in a presentation.  Specifically, Steve Yegge’s Execution in the Kingdom of Nouns and Chad Perrin’s OOP and the death of modularity.  It may seem strange to use ostensibly anti-OOP posts in a presentation on the benefits of OOP, but both of their arguments really zero in on what bad OO design looks like — even when it’s necessitated by a lack of language capabilities.  I hope to use their points to indicate by contrast what constitutes good OO design, and how that’s supported by Synergy/DE 9.

Now I just need to figure out how to keep Richard and Steve from getting me thoroughly boiled as an owl the night before.  <O,O>

Tags: alcohol, apotheon, asciiart, blogging, drunktionary, oop, owl, powerpoint, presentation, programming, richardmorris, spc, steveives, steveyegge, synergex, wlw
Continue Reading

Dawn

Living north of the 47th parallel, Halley and I now have enough sunshine to see our path and each other when we leave the house before 5AM on our daily run.  I miss viewing the stars, but it’s interesting to see what the neighbors have done to their properties over the winter.

The air is warm, quiet, and clear.  I can hear a train over in Seattle — al lthe way across the Sound.  There aren’t any tracks on Bainbridge, and it’s definitely coming from the east.  Not another noise except the constant chirping of hundreds of birds — so many at once that you can’t pick out an individual song.  Reminds me of Twitter.

I can also hear Halley panting as we jog along, and I’m silently whistling to myself an old Dire Straits tune: Walk of Life.  I picked up the habit of whistling noiselessly from my grandfather.  He would go about his chores saying not a word, whistling silently while my sister and I tagged along.  He spoke so infrequently that I can’t even remember his voice.

Despite the daylight, the waning three-quarter moon shines brightly, turning her beaming face towards the sun that she barely preceeds.

Halley pays no attention to the sheep grazing across the road.   They’re old news now.  For the first year or so that we ran this way together, they held quite an attraction for her: ears pricked, tail straight out.  And when they beheld my little predator, they all stood in frozen attention.  One time Halley charged them, barking, and sent them fleeing in terror before I could pull back on her leash.  Now, though, they quietly ignore her.

Yesterday I didn’t get as much accomplished as I had hoped, so today I’ll have to hit the ground running, so to speak.  Get back home, give Halley the remaining treats (good girl), head inside and get to work.

Tags: bainbridge, direstraits, exercise, halley, seattle, twitter
Continue Reading

Using OO in Business Applications

The day before yesterday I presented on OOP in Synergy/DE version 9.  Here’s essentially what I said:

What is OO?

“OO” is the sound people are supposed to make when they behold your beautiful object-oriented code – but in many cases it comes out “OOPs” instead.  In this presentation I hope to provide some insights on how to evoke the desired exclamation.

Object Orientation is both a design philosophy and a set of programming language features to support it.  Languages that provide the latter are often called Object-Oriented Programming (OOP) languages.  Object Orientation’s primary goal: to make the code describe the real-world objects involved in the application, and their interactions and relationships, thereby reducing the translation between business rules and computer instructions.

How does this apply to business applications?

Well, you could begin to model your business processes in code.  Given an order entry system, for instance, you might make “Order” a class that contains all the data related to an order and the methods to do what an order needs to do.  A class defines a type of object.  So, an Order will contain some general information about an order and a collection of line items, along with methods to retrieve, commit, and maybe validate that data.

You might then find that sales orders and purchase orders have a lot in common, but differ somewhat.  So, you make both the SalesOrder and PurchaseOrder class “extend” the Order class, adding data and procedures that are unique to each, and possibly overriding some behaviors of the base Order class.

As you apply this principle to more areas of your application, you might start to see patterns emerge.  A lot of what you do to store, retrieve, update, delete, and list orders also applies to other types of tables.  You could then make the Order class extend some even more generic class that provides methods and data for manipulating any type of discrete data item.  If you’re familiar with Design Patterns, you might want to follow the Model-View-Controller pattern and call this class a Model.  Then you could create a View class which represents any type of user interface for the data, and extend that for specific ways of looking at certain types of data (input windows, lists, etc.).  Finally, a Controller class could be used to orchestrate the overall behavior of an application, and extended to create specific types of applications.

“Whoa!  You’re talking about a complete rewrite!”  I hear you cry.

You’re right — that’s a bad idea.  Any of you out there who have ever attempted it can testify that for any application that has taken many years to mature, a complete architectural overhaul is not in the cards.  You simply cannot rewrite from scratch and have any product ready to ship before you go out of business.  You need to incrementally incorporate newer methods and technologies in a way that allows you to continue to release your product on a regular basis.  And you don’t want that pavement-to-dirt feeling when your user navigates between different parts of your application.

So, I expect that most of you will begin using objects without even really thinking about OOP.  First, you’ll start consuming some of the supplied classes.  The new dynamic Array class might prove handy, with which you can size an array at runtime without having to use the obtuse ^m syntax.  You’ll be using classes and not even know it.

Or, quite likely, you’ll see the new try-catch-finally structured exception handling in Synergy 9 and say to yourself, “Self, you’ve been looking for something to replace that goto-by-any-other-name-still-stinks onerror statement for ages.  Time to learn something new.”  As soon as you catch your first exception, you’ll have an Exception object in your hot little hands.  You’ll see how naturally you can access the information contained therein using the new object syntax.  Maybe you’ll create your own derived class of exception in order to add your own custom information about an error encountered in your application.  That might be your very first class definition.

Then you’ll start to discover more of the useful features of objects.  For instance, scope and destructors.  How many times have you wrestled with problems related to cleaning up resources when they’re no longer needed?  The UI Toolkit provides the environment concept to release all resources that were allocated in an environment when that environment level is exited, which works fine for many cases.  But in more complex applications you often find that you need to preserve some resources across environment-level bounds.  So, you promote those to global, but then you have to remember to clean them up when you’re done.  Wouldn’t it be nice if the resource would just get cleaned up automatically as soon as you lose all references to it?  That’s what you can do with a class.

As you begin to think more in terms of objects, it will become more natural for you to create classes that model other aspects of your application.  But don’t rush yourself.  And don’t massively redesign, unless you’ve got a lot of extra time on your hands.

General principles

A class should reflect a single type of object.  That means it’s a noun — some actor within your application.  Without referring to existing code, try to describe, in natural language, how your application works from the user’s perspective.  Whenever you encounter a noun, that’s a candidate for a class.

Methods are verbs that describe some action that a class of object can perform, on other objects or on itself (or intransitively).  If the name of the method doesn’t involve a discrete action, then maybe it needs to be thought out differently.

Properties can be seen as adjectives that describe the object, or members that compose it.  If your class has a property that you can’t think of in one of these ways, perhaps it shouldn’t be a property of this class.

A class should extend another class if it passes the “is a” test.  A Bugatti is a car, so Bugatti extends the class of cars (does it ever – this baby can do 253 mph.  Why from here to Los Angeles — of course, you couldn’t do 253 mph all the way to Los Angeles, because there’s always some jerk hogging the left lane at about 180).  A Bugatti is not a chassis.  A Bugatti contains a chassis, it isn’t derived from it.  That distinction trips up class designers all the time.  For instance, given the Model class we discussed earlier (from which an Order is derived), does it extend or contain a database table?

Often you can get away with inaccurate inheritance models for a while.  But eventually, the practice of deriving classes from things that they logically contain causes conflicts, because you end up wanting to derive them from more than one ancestor class.  Use the “is a” test to avoid that problem.

Signs you should have contained:

–You feel the need for multiple inheritance

–You add way too many methods

–You don’t override any virtual methods

Sign you should have inherited:

–You replicate all of the same methods and just forwards or duplicates them

What else to avoid

As Ken Lidster has said to me on many occasions, OO rewards a good design handsomely, but punishes a bad design to the end of your days.  Lets discuss some common pitfalls.

In Execution in the Kingdom of Nouns, Steve Yegge describes how Java’s (and C#’s) insistence on requiring all functions to belong to a class causes programmers to manufacture many needless nouns in order to perform any activity.  You don’t have to fall into that trap in Synergy/DE, because Synergy/DE provides stand-alone functions.  So if your description of a process begins with a verb, just make it a function.  Don’t give it an actor if it doesn’t need one.

Classes whose names include the words “manager”, “broker”, “locator”, or any other verbal noun, should be suspected.  If the noun’s purpose in life is merely to perform some action, then that should be a function instead of a class.

What about singleton classes?  Singleton classes are only instantiated once.  Sometimes that means that they’re really just a set of global data and functions disguised as a class.  Take, for instance, an Application object.  Java and C# virtually require classes like this because otherwise you can’t get anything done.  Because these languages require that you have a class to contain any function, you typically pick yourself up by your bootstraps by creating an Application object that has, at least, some sort of ”run” method.  You don’t need that in Synergy/DE, unless it’s useful.  Singleton classes can be useful for encapsulating related data and functions together, creating derivations of similar applications, and for avoiding global naming conflicts — but be careful not to let them become big, miscellaneous messes or just the equivalent of namespaces.

In OOP and the death of modularity, Chad Perrin notices a trend in object-oriented programming in which classes become coupled with one another, reducing modularity.  Sometimes, by thinking in terms of objects rather than starting with processes, you can bundle too much functionality together into one class.  Interfacing with such a complex class soon requires complex knowledge about how that class operates, creating unnecessary dependencies.  By contrast, keeping the design simple and atomic requires less intimate knowledge and maximizes reusability.

Geek24 provides a series of humorous programming quips, including: ”The great thing about Object Oriented code is that it can make small, simple problems look like large, complex ones.”

Unfortunately, that often proves true.  But you can avoid doing that, and make OOP work for you instead:

Avoid creating overly ornate inheritance hierarchies.  Focus on the abstractions that you use in the business model, and ignore the rest.  In real life, we always ignore certain layers of abstraction.  It’s useful, for instance, to talk about an overnight envelope as a type of shipment, but we rarely need to state the fact that all shipments are types of molecular collections.  That’s not the level on which we operate.  Likewise within an object hierarchy, don’t bother including ancestor classes that no one will ever need.  Make use of inheritance where it makes sense.

Rule of thumb: simplify.  If adding a class simplifies the code and makes it easier to understand and manipulate, that’s a good design.  Oooo.  If it complicates the code and adds unnecessary layers and dependencies, you were better not to use objects at all.  OOPS!  The beauty of Synergy/DE is that it lets you decide.

Tags: apotheon, bugatti, designpatterns, geek24, oop, programming, steveyegge, synergyde
Continue Reading