Thursday, February 28, 2013

Special Thanks: Max Guernsey, Jr.

Test-Driven Database Development: Unlocking Agility is almost on the shelves, now, and there is one last person I would like to thank: my father.

Of course, both my parents are responsible for my existence and contributed to my development as a human being.

My father, however, played an especially strong role in my growth as a software developer.  I learned many of the fundamentals from him, either by way of direct instruction or indirectly through conversation.  So thanks, dad, for getting me started in the career path I'm on today.

Wednesday, February 27, 2013

Tuesday, February 26, 2013

Looking for Venues to Give a Talk on Test-Driven Database Development

In the very near future, Addison-Wesley will be publishing my new book, Test-Driven Database Development: Unlocking Agility.  Recently, I did a talk at Better Software East on the same topic.  I would like to re-deliver that talk at a number of locations in the United States and I'm looking for companies or user groups that are willing to host a ninety-minute talk on the topic of test-driven database development.  I'm trying to do these talks at times when I'm already going to be in a city.

You can find the list of cities and available dates here.  A large date range means I intend to travel to a city in that date range but have not yet nailed down the dates.  In that case, I will try to work around any bookings I make.  A small date range means I have a hard travel date and will need to fit such a talk into that schedule.

Contact me via email if you have anything available or any ideas.

Monday, February 25, 2013

Special Thanks: Alan Shalloway

Well, it looks like the release of Test-Driven Database Development: Unlocking Agility is less than a week away now.

I'd like to thank the guy who is in charge of the Net Objectives Lean-Agile Series: Alan Shalloway.  Not just for inviting me to publish in the series but for helping shape me as a professional.

It's probably hard for you to imagine but the warm, fuzzy, forgiving, and benevolent Max Guernsey you know was not always that way. I used to be a lot meaner and a lot less tolerant of foolishness.  Al, among other people, took the time to guide me to a more functional way of dealing with people.  I think there's some irony in the fact that he taught me to be a little better at dealing with people by helping me value other people getting a little better at programming.

So thanks, Al, for your patient guidance and mentorship.  I'm certainly not done getting better at dealing with people but I am started and you played a big role in that.

Sunday, February 24, 2013

One Week and Counting (You Are All Doomed)

There's only a week left until they release Test-Driven Database Development: Unlocking Agility.

On the surface, this seems like a really good thing.  Good things don't generally happen to me.

I've been thinking a lot about all the ways this could not be a good thing.  I've found nothing so the only reasonable interpretation is that some horrible event is going to block this.

Here is a list of the things that will probably happen to prevent my book from getting into public hands:

  • An asteroid could destroy civilization as we know it.
  • A zombie apocalypse could destroy civilization as we know it.
  • A plague could destroy civilization as we know it.
  • Barack Obama could destroy civilization as we know it.
  • An army of angry DBAs could rise up and destroy civilization as we know it.
  • I could die.
  • Aliens could destroy civilization as we know it.
  • A solar flare could destroy civilization as we know it.
Let's deal with those one at a time.

Asteroid strikes are rare and we are a very deep infection.  I sincerely doubt that a rock large enough to be our undoing is going to hit us in the next week.

Inaugural ceremonies and zombie uprisings appear to be almost identical and we've survived many of those.  I'm sure we can weather a "real" zombie uprising.

Plagues are destructive but they don't wipe out whole populations.  It is exceedingly unlikely that one will could kill enough humans to cause a total collapse of civilization.

Barack Obama may have some terrible policies and be an incredibly destructive force but there's one thing about which he is incredibly passionate: keeping his friends in the banking industry happy.  Those guys have absolutely nothing to gain from the total collapse of civilized life so I'm sure he'll behave.

DBAs have been working on destroying us all for decades and have yet to succeed.  They're probably not a threat.

Near as I can tell, when I die, the universe ends.  That's inevitable, though, so there's no point worrying about that.

Aliens probably already know everything in my book as well as any other software development book that will be written in the next ten thousand years.  If anything, their arrival would accelerate our understanding of how to do our work.

Notwithstanding the kind of garbage espoused by the movie Knowing, it's doubtful that a solar flare would strip the Earth of all life.  However, one could kill a lot of Earth's life.  Almost worse, it could destroy virtually all of our infrastructure.

That's a potent combination.  A 99.99% reduction in equipment could knock us back into the eighteen hundreds.  Pair that with a large reduction in population and no ability to coordinate (at least, none such as anyone alive today has ever known) and we really could collapse into another dark age.

So there you have it.  By March 2nd, either I will be dead and the universe will cease to be along with me or a solar flare will kill most living things on the planet and destroy nearly every electronic device at the same time.

Either way, the best course of action for you is to take advantage of Amazon's awesome advanced purchase policies.  You can be sure to buy your copy before the world ends and, in case it doesn't, you'll get the best price available between now and the end of March 3rd.

Saturday, February 23, 2013

See You in Hell, Facebook!

I never check my Facebook profile anymore.  I have an Android tablet that will tell me if someone has sent me a private message and I will go in to read any such transmission.  Other than that, it's been a couple weeks.

It's a good thing.  Facebook is such a toxic place.  Humans cannot function with that kind of exposure to what the people around them think and feel.  It's much easier getting through things if you aren't constantly faced with evidence that those around you are completely insane.  I'm sure all the insane people around me appreciate that I am no longer constantly threatening their delusions, too.

I'm not urging you to leave Facebook.  Maybe it does you some good.  Maybe you only accept friend requests from those who share your beliefs.  Maybe you are just plain better at tolerating people who have no rational basis for their ideas.

If you are like me, though, it will drive you mad to know that someone can appear to be rational on the surface but then end up believing in magic.  It will infuriate you that someone can see the deleterious effects of certain policies first hand in personal interactions but then believe those policies will somehow function when applied on a larger scale.

If you are like me, you are better off living in denial; better off focusing on the superficial rationality rather than the rotted thinking inside.  If you're like me, it's not Facebook that is the corrosive force in your life, it's the people you know.  Facebook is just the medium through which the destructive thoughts those people carry can reach you.

If, like me, you are better off keeping relationships skin-deep, then it's probably a good idea to try getting away from Facebook.  Having done so has certainly improved my happiness.

Friday, February 22, 2013

Different Forces Are No Excuse for Bad Practices

Encapsulating construction is not optional.  It is a mandatory part of good design.  The reason simple and easily conveyed.  If instantiation is encapsulated, resistance to changing what concrete type is used is low.  If sprinkled throughout a code base, that resistance is high.

One of the most important kinds of changes in this family is promoting a concrete class to an abstraction, moving the behavior to a new concrete class, and changing construction logic to use the new concrete class.  Being able to perform that operation allows you to defer the creation of an abstraction until there is actual variation to encapsulate.

This concept was popularized in modern languages like Java and C#.  A typical implementation is as follows:

public class IsConcreteForNow {
  // nobody can create this directly
  private IsConcreteForNow() { }

  // force everyone to get it indirectly
  public static IsConcreteForNow GetInstance() {
    return new IsConcreteFornow();
  }
}

C++ programmers are often resistant to encapsulation of construction when presented with a "literal" translation as follows:

class IsConcreteForNow {
private:
  IsConcreteFornow() { }

public:
  IsConcreteForNow* getInstance() { return new IsConcreteForNow(); }
}

If you are a C++ programmer, it's probably already apparent why this is so objectionable.  To start doing such a thing demands that you put every object on the heap and give up stack instantiation forever.  That price seems too high to warrant the value.  It isn't too high but it seems that way to people who are accustomed to leveraging the stack for most of their short-lived objects.

When some French guy says he has a hangover, you don't translate that to "my hair hurts" or "I have wood mouth."  You translate the intended message, not the individual words.  Likewise, encapsulating construction should be translated so as to meet the need in the context of C++ without regard to how that need is met in other languages.

While C++ makes certain aspects of keeping objects on the heap a little more complex, it has a lot of cool tools that can help you in other ways.  For instance, it has the concept of a typedef, which allow you to (among other things) define how types relate to other types.  It also has a more powerful operator overloading mechanism than a lot of other languages.

These two things put together allow you to implement encapsulation of construction in a different, but still useful way as follows:

template<class T>;
class OnStack {
private:
  T core;
public:
  T* operator -> () { return &core; }
};

class IsConcreteForNow {
private:
  IsConcreteForNow() { }

public:
  typedef OnStack<IsConcreteForNow> TransientPointer;
  typedef IsConcreteForNow* PersistentPointer;

  static void CreateTransient(TransientPointer& toCreate) {
    // constructor already did the work
  }

  static void CreatePersistent(PersistentPointer& toCreate) {
    toCreate = new IsConcreteForNow();
  }

  static void DestroyPersistent(PersistentPointer& toDestroy) {
    delete toDestroy;    toDestroy = 0;
  }
};

Note how this implementation forces consumers of a class to go through its static instantiation methods while respecting the forces imposed by C++, namely the distinction between an object that should only live for a stack frame and one that should live longer than that.

This code can be consumed as follows:

IsConcreteForNow::TransientPointer transient;
IsConcreteForNow::CreateTransient(transient);

transient->DoSomething();

IsConcreteForNow::PersistentPointer persistent;
IsConcreteForNow::CreatePersistent(persistent);

persistent->DoSomething();

IsConcreteForNow::DestroyPersistent(persistent);

Later, should I decide that I need variation, I have lots of options.  If it is absolutely imperative that I create an object on the stack, I can go through all kinds of contortions to support that.  Otherwise,  I can simply switch my TransientPointer type over to being an auto pointer or something of that nature and instantiate the right type as needed.  I can make all of those changes without any effect whatsoever on my client code.

Encapsulating construction is something everyone should do with every class they write.  I've just shown you can do it with C++.  If you can do it in C++, you can do it in any language worth your attention.  If you are using a language that makes encapsulating construction seem hard then you either need to re-evaluate how you look at the forces in that language or you need to re-evaluate if that's the right language to use at all.

Monday, February 18, 2013

Special Thanks: Michael Brown (the non-criminal one)

In my quest to build my most recent book, Test-Driven Database Development: Unlocking Agility, there were many people who helped me.  One of those people is a recently acquired friend and colleague Michael Brown.

There are two Michael Browns with the same name and one of them is a criminal.  The other is not. I mean the one who is a computer programmer, not a criminal.  There are other distinguishing characteristics but none that make me laugh as hard when I remember them.

As much as it was useful to know which parts of the initial versions should never see the light of day, it was also extremely helpful to know which parts of what I was writing actually were of value.  Mike, your positive and open-minded attitude helped me with exactly that.

Of course, you gave me some constructive criticism as well - just like others gave me positive feedback.  However, I could tell what was really clicking by how excited you seemed to get over certain ideas.  I can think of at least one thing that was completely unclear and that I may very well have left out altogether if not for your response to it: the whole information-behavior-knowledge trinity.  There are countless many other examples, that don't immediately come to mind.

So, thank you, Mike.

Sunday, February 17, 2013

Republicrats and Democans - A New Way to View Them

...at least, a new way for me to view them.

Everybody with half a brain knows that Republicans and Democrats are basically the same thing.  I've many times said that Democrats are just sheep in wolves' clothing.

Recently, a reason why they might be so similar dawned on me.  They actually believe the exact same things.

I'll start with the obvious case: Republicans.  Most Republicans, not all but most, fit the following description.  They are people who believe in some kind of god figure and imagine that this god figure will always balance the equation in the end.  If things aren't made right here, they will be rectified in the hereafter.  This is why Republicans lean toward financial liberty.  The impulse to make everyone live the "right" way their god wants them to is also why they lean away from social liberty.

Now, I'll propose an hypothesis about Democrats.  A Democrat is someone who knows that he should not need a god figure in his life but still does.  He has lost the battle with his mind and is desperately searching for a replacement god.  After a short scan of what he thinks he knows, he finds an entity large enough and complex enough that he can ascribe magical powers to it without the burden of critical thinking getting in the way: government.

The Democratic god of government then has the same job as the Republican god with only a difference of "when."  That is, while the Republican god grants happiness or punishment, thereby making everything fair in the hereafter, the Democratic one must do it in the here and now.  For this reason, social liberty is promoted (as a form of heaven on earth) and financial liberty is restricted.

Democrats and Republicans aren't just similar.  They are the same broken model for the world: There is a giant, intangible, benevolent entity that will make everything right if you only allow it to do so.  Near as I can tell, they differ only by the stipulations fed into those broken thoughts.

So what's my conclusion?  I don't know.  I just discovered this and wanted to share it with the rest of the world so that you can call me crazy and ignore it like you always do when I'm right.

Wednesday, February 13, 2013

False Dichotomy - Who is the Bad Guy?

People are divided about this Christopher Dorner thing.  Some people think that he is the bad guy in all this.  Some people think that the LAPD is the villain.

This is typical of human behavior, to try and make a problem simpler than it really is and therefore to make it more complex.

Let's start with the simple analysis.  Regardless of how you feel about police, Christopher Dorner killed two innocent people in cold blood and without provocation.  That's classic bad guy behavior, right there.  So he was a bad guy.

That, however, does not make the police the good guys.  Let's consider how they reacted to this situation.  They opened fire on a couple of old ladies with no provocation.  They rammed some random guy's car and tried to shoot him to death after determining that he was definitely not Dorner.  They tried to assassinate some other dude based on no evidence at all.  Their policy was, objectively, "shoot first and ask questions later."  Finally, they intentionally burned down a building with something they were pretty sure was him in it so they didn't have to do their jobs.  That's classic bad guy behavior too.

So the obvious answer is this: Christopher Dorner was a bad guy.  A real, honest, full-fledged nut job - if the killings didn't tell you that, his political beliefs certainly would.  That said, the police in Southern California have been for many years, and still are, an occupying force rather than keepers of the peace.  They too are the bad guys.

One of the many disservices the media does us, is to train us that the whole yin and yang thing is not the complete load of horse shit it is.  For every darkness, there must be a light.  For every villain, there must be a hero.

It's just not true, though.  There just because there is a bad guy, there doesn't have to be a hero.  The reality is that the world is mostly bad guys and normal guys, with just a scant few good guys struggling their way through a tide of apathy and malice.

Monday, February 11, 2013

Special Thanks: Scott L. Bain

On March 7th, my latest book (Test-Driven Database Development: Unlocking Agility) will be on the shelves.  This was a large undertaking and some of my friends and colleagues played a major role.

I cannot think of anyone who had a more profound impact on the development of this book than Scott L. Bain, author of Emergent Design: The Evolutionary Nature of Professional Software Development.  Scott is both a friend and a colleague.

Part of the depth of Scott's influence stems from how far back it began.  Long ago, when dinosaurs roamed the Earth, I had an idea that seemed like it was the right thing to do but I couldn't figure out how to persuade more than one person at a time.

The problem was that I thought I had a software product and Scott helped me see that I actually had an educational product.  He got me interested in writing technical materials and in teaching other people how to do things I knew how to do.  This was a big leap from making software and expecting people to already know what they should do.

Part of the impact comes from Scott's skills at, and interest in, developing developers.  Before the Earth finished cooling, I was a good programmer but not yet a good software developer.  Scott's careful, patient, and wise guidance kept me on a path of discovery that put me where I am, today.

It's hard for me to even imagine what I would be like without his guidance, but I'm very much afraid that I would be sitting in some ivory tower hurling proclamations down upon the commoners and cleaving to impractical ideals like everything being hyper-configurable all the time.  You can see direct evidence of Scott's influence on my thinking about things like design in my book.

So a special thanks goes out to Scott Bain for his contribution to my book by way of contributing to my character.  Thank you.

Monday, February 04, 2013

Breaking Down Barriers to Agile Database Development

Having a cross-functional team that works together to solve a problem is a basic property of an agile development environment.  It's impossible to list all the things that can impede the development of an agile database environment.  There are, however, some particular scenarios worthy of note.

One common case, especially in smaller organizations, is that the person who works on the database design is also a programmer.  In that case, fostering a collaborative environment is probably not too difficult.  Don’t let people catch you talking to yourself too often, though.  They might decide you have cracked under the pressure.

Another scenario that is ever-increasing in its frequency is when you have an agile development team with a “database guy” or a “database gal.”  In this situation it is important for programmers and the “database folk” to work together.  However, it’s still not that hard.

The toughest nut to crack is when you have an organizational boundary between a team of programmers and one or more database people, and those database people serve not only as database developers but also as “gatekeepers” to some production databases.  Oftentimes, the gatekeepers are vehemently against anything agile as well as anything automated touching their jealously guarded database structures.


I’m not exactly known as some great builder of bridges.  I’m actually better known for my “scorched earth” manner of dealing with people who I see as “in the way.”


However, there is one trick that has worked for me on the rare occasions when I was able to take a deep breath and count to a thousand before opening my mouth.  That trick is giving the gatekeeper control over the new processes I want implemented.  Instead of persuading them to let me have the most agile thing I can possibly get, software development teams in control of database design, I settle for the next best thing.  I try to persuade the "database guy" to take on the test-driven development and and object-oriented design activities I want implemented.

An example would be trying to get them involved in things like writing transition tests.


People tend to want to do the right thing and, when they are doing the wrong thing, it’s usually because they don’t understand the negative impact.  The other major reason is fear of no longer being needed.  It’s not so important who implements good practices as it is that they are implemented.

Giving control over certain aspects of an agile database development process to someone who is already in control of the database development process often neutralizes both the major impediments to adoption.  The gatekeeper will be able to make sure things are done his way and can be assured that he will remain relevant while slowly growing more accustomed to the modern ways of doing things. 

Saturday, February 02, 2013

Special Thanks: Seth McCarthy

As the hour of Test-Driven Database Development: Unlocking Agility draws nearer, I'm left with less to do and more time to reflect.  It was a lot of work and, no doubt, I did much of the work.  There are numerous people who have been in some way responsible for the current shape of the book.

One of those people is Seth McCarthy.  Seth is a friend I acquired upon moving to Central Oregon.  As a good friend, he offered to read early chapters of the book.

One thing that makes Seth unique as a friend is that he is not afraid to give harsh criticism when it is deserved.  For some people, I'm sure, that's a problem but for me it worked perfectly.  There's a reason that you won't see any of the original chapters if you read my book and most of it derives from Seth being willing to tell me I was pompous, long-winded and (worst of all) off topic.

Thanks, Seth, for being technically competent and forthright enough to spare me the abject failure the first incarnation of my book surely would have been.