Pair programming with a child

While driving home today my daughter Alaynah asked me a little bit about what I do. After explaining to her that I am a software engineer and that I write programs, and telling her that my programs run on the internet, she asked me how Google makes that little box “that you type in to look stuff up”. I told her when we got home I’d show her since it was pretty easy to do.

When we got home we got to work. And a coupe of minutes later we had a very simple web “program” that took some text in a text box and wrote it out to the screen a certain number of times, each time making the text bigger. Not a lot of action going on there, but still something she could see that involved a text box and some programming logic. And as uneventful as this little application might have been, what it led to was amazing to say the least.

As we started to look at the words “Awesome Alaynah” explode onto my monitor in ever growing size, Alaynah began to look at the lines and count them to make sure there were as many lines of repeating text as she had selected. So we decided that it would be easier if there were numbers next to each line so we could see just how many lines were on the screen. Then, after she saw that, she asked me “is there a way to make it so if you click on a line, that all of the lines after it just disappear, including the line that you clicked on?”. I told her that I was sure there was, but that we needed a different kind of programming for that (since our original program was all PHP and click events, while potentially served by the server, are better handled on the client). So I went and got us jQuery, included it and wrote the code that made the lines disappear from the line you clicked on.

As she sat in amazement watching the lines disappear when clicked you could see that there was something troubling her. It was almost as if, when the lines were disappearing, that they were gone forever and ever. So I wrote a little bit of code that would bring the lines back if you wanted them back. She loved that. Except for the text to bring the lines back was “Bring them all back”, which works in all cases except if you disappeared the last line, because there aren’t any “all” lines, only “the” line. So she told me that we needed to change it so that if you removed the last line that to bring it back, the program should say “Bring it back” instead. So we fixed that, and after only a few minutes of conceptualizing, programming, testing, using and refactoring, Alaynah and I had put together a little program that we were both pretty proud of. You can view the source of this little program here.

Now aside from the obvious goodness that is my eight year old daughter (who happens to be turning nine tomorrow) taking an interest in the work I do, I have to say that having time to spend with my daughter – just her and me time – was a blessing. I don’t get a whole lot of one on one time with any of my kids. And even though this was only a few minutes, it was a cool few minutes that let me show my daughter what I do, let her do it with me and let us both enjoy some quality time together. I’m certain I would have loved it just as much if we had been talking about dolls, mud, cartoons or our favorite foods, but the fact is, we were talking about programming, my work, her ideas and our time together. There is a lesson in this for any parent. If your child shows any kind of interest in what you do, take the time to show him/her what it is you do. Don’t explain it with words and leave it at that. If you can take the time to allow your kids to connect with you while learning you, take that time. No excuses, no fussing, just do it.

She and I had an awesome time with this, even if it was only a few minutes. It was a great time and I am glad I didn’t pass it up because I was tired, wasn’t interested or was just unavailable.

View the source of our little program
Our original code was a little more rough around the edges than this one. After we got it working the way we wanted it I went through and cleaned things up a bit, added some comments, pulled out duplicated javascript code segments, etc. So the final product is a cleaned up rendition of our original stuff, which we hacked together very quickly in an effort to make it just work.

<?php
// Iterations max limit
$max = 30;
 
// Iterations min limit
$min = 5;
 
// User supplied iterations count
$limit = null;
 
// Handle posted values
if (!empty($_POST['limit'])) {
	$limit = intval($_POST['limit']);
	if ($limit > $max) {
		$limit = $max;
	}
 
	if ($limit < $min) {
		$limit = $min;
	}
}
 
$words = empty($_POST['words']) ? null : $_POST['words'];
?>
<html>
<head>
	<title>Alaynah's program</title>
	<style type="text/css">
		#putitback {
			color: #008;
			cursor: pointer;
			text-decoration: underline;
			margin-top: 20px;
		}
 
		.index {
			display: inline-block; 
			width: 50px;
		}
	</style>
	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
	<script type="text/javascript">
		$(function() {
			// Set the row prefix
			var rowprefix = 'row-';
 
			// The id of the clicked row to make hide from
			var rowid;
 
			// Row toggler, makes rows appear and disappear
			function toggleRows() {
				for (var i = rowid; i <= <?php echo $limit; ?>; i++) {
					$("#" + rowprefix + i).toggle();
				}
			}
 
			$('.row').click(function() {
				// Get the row id that was just clicked
				rowid = $(this).attr('id').replace(rowprefix, '');
 
				// Handle visibility toggling
				toggleRows();
 
				// Set our message for restoring rows
				var message = 'Put them all back.'
				if (rowid == <?php echo $limit; ?>) {
					// Alaynah was smart enough to see that if you only plucked
					// the last row the message should be singular
					message = 'Put it back';
				}
 
				$('#putitback').text(message);
			});
 
			// Handle restoring "removed" rows
			$('#putitback').click(function() {
				// Handle visibility toggling
				toggleRows();
 
				// Clear out the restore link since everything is back to normal
				$(this).text('');
			});
		});
	</script>
</head>
 
<body>
<h1>Alaynah&apos;s program</h1>
<form action="" method="post">
	<p>What do you want to write? <input type="text" name="words" value="<?php echo $words ?>" /></p>
	<p>How many times do you want to see it? 
		<select name="limit">
			<?php for ($i = $min; $i <= $max; $i++): ?>
			<option value="<?php echo $i ?>"<?php if ($i == $limit) echo ' selected="selected"'; ?>><?php echo $i; ?></option>
			<?php endfor; ?>
		</select>
	</p>
	<p><input type="submit" value="Hit it!" /></p>
</form>
<?php if ($limit && $words): ?>
<hr />
<?php /* Loop $limit times and make the displayed text grow each iteration */ ?>
<?php for ($i = 0; $i < $limit; $i++): $c = $i + 1; ?>
	<div class="row" id="row-<?php echo $c ?>" style="font-size: <?php echo (14 + $i); ?>px;">
		<span class="index"><?php echo $c; ?></span>
		<span><?php echo $words; ?></span>
	</div>
<?php endfor; ?>
<div id="putitback"></div>
<?php endif; ?>
</body>
</html>

Incentive driven motivation

Yesterday, while doing some yard work I went into the back yard to handle some massive overgrowth in our lawn. Completely disgusted with our yard, and utterly frustrated with the growth of the grass that my push mower just could not cut, I decided that the yard would just have to wait a little while so I could focus on the front of my house.

My 12 year old daughter, Rebekah, had other plans. Always the entrepreneur, she actually offered to cut the grass for a mere $10. To which I promptly replied “thanks, but no thanks”. I was of the opinion that the grass was maybe a $3 job since I had already cut some of it and the lawn is not that spread out.

So Rebekah sweetened the deal a little bit, offering to not only cut the grass but straighten up the patio. After much back and forth over price and what the work would cover for that price, we agreed on the following:

  • Cut the grass
  • Clean up all dog poop
  • Clean up all trash
  • Straighten up all patio furniture and toys
  • Clean up the tan bark areas
  • Sweep the patio and sidewalks
  • Do it all within three hours (from 3:00 PM to 6:00 PM)

And the cost? $15, as agreed upon by the two of us, which to Rebekah was a bargain and to me was a steal.

So while I was out in the front yard working up a sweat she was out in the backyard earning her money. And you know what? For her, I discovered, money is an excellent incentive.

She managed to accomplish everything on the list of things to do (with the exception of cutting the grass completely, but this was no fault of hers). And she did it in two hours, not three. I was so impressed by her work ethic, her focus and her quality of work that I actually paid her $20 for doing such a fine job.

Looking back on this, I know there is a lesson in this. I could have asked the kids, all of the kids – you know, the ones that made that mess? – to clean the yard they helped dishevel. And I would have saved myself $20 in the process. But Rebekah, who has no problem working for her earnings approached me with a proposition of services rendered in exchange for payment. And ultimately it was that payment that drive her to accomplish such an impressive amount of quality in her work.

So if I take anything away from this, outside a clean yard of course, it will be that with the proper incentive, almost anyone can accomplish almost anything.

Excuse my reasoning

A point of view is a dastardly thing. It can be useful in some situations, but in a case where your point of view allows you to turn an excuse into a reason it can be devastating.

Excuses, in and of themselves, are nasty little buggers. They are purposed reasonings that one establishes to allow latitude and leniency to pervade their own inability to satisfy a need or a condition in which another person, organization or establishment is dependent upon the satisfaction of that need. In essence, they are a rationalized way out of a responsibility that should not be shirked.

Worse, excuses that are believed to be reasons are all the more dangerous because they are no longer just a way out of responsibility, they are now the driving force behind it. And along with that they become a convenient means to allow oneself to really never do the responsible thing.

The reason I bring this up is because it is so easy to do. Excuses, or in most cases, reasons, are so easy to come up with and even easier for others to believe. Children seem to know this inherently. So do spouses (yes, men and women). In fact, I tend to think it is human nature to be able to drum up an excuse, er, reason, at the drop of a hat in most cases.

I am just as guilty of this as the next guy. Which is why I chose to write about it. I find myself doing this more and more and, the truth is, it needs to stop. A wife, children, a boss… they all need reliability out of a man. And reliability is impossible if there is a way out of responsibility through excuses.

So the next time you feel yourself in a place to excuse your way out of something, think twice and see if you can reason with yourself to the point of not allowing the excuse. People are counting on you.

The best way to start a day ever

This morning, when my son woke up and after he told mom good morning, he sought me out. He had something to give me. And as he stepped down the hallway with purpose and authority I heard him call out to me.

“Daddy, I have a pwesent fow you.”

“What is it son?”

“It’s a hug and a kiss. I love you daddy.”

And with that he jumped into my arms and hugged me as big as his big boy arms could hug a dad of my size.

I’m certain he doesn’t know how much he touched my heart this morning, or how good of a day he gave me today. But hopefully I can share this with him so that he can look forward to those moments with his kids. I am a truly blessed father.

An outing of sorts

Today my wife needed a break badly. She has been without one for a while and asked me a couple of days ago whether last night would be alright for her to go out and have some “her” time. Last night did not exactly happen for her, but today did, so I gave her that time and decided I would spend some time taking the kids for a walk to get slushies because the kids really love doing that, generally it doesn’t cost too much and it usually wears the kids out and makes for an excellent quiet time when we get home.

Quick tip for the husbands: Your wife needs a break. Whether she tells you or not is irrelevant. Give her a break frequently. She needs it and she will be very appreciative of your thoughtfulness toward her. And even if she isn’t, you should do it anyway.

Quick tip for the fathers: Your kids need to get out the house. They need to blow off steam and they totally need to do that with their dads. This is not to say that they cannot get that with their moms. In fact kids need mom time too. But dad time is crucial, so if you have kids make time for them doing something you all can enjoy together.

So we set off on a walk, the six of us, to the 7-11 just down the street from us. The weather was nice, a little chilly but sunny, so the walk was pleasant right off the pop. We hit up 7-11 and grabbed slushies for all of us – well I prefer coffee so I did that instead – and a couple of bags of chips to snack on. Then we headed out to the front of the store to kick it and snack.

But that is something we always do, so I decided we would change things up a bit so instead of sitting out in front of the store we walked a little bit further to Mission Boulevard where we found a bench and sat on it, snacking and slurping and watching the cars pass us by. This is what it might have looked at from the cars’ perspective:

the-kids

After our snack time and car watching was over was decided to cross the street and check out Mission San Jose. It wasn’t until we got there that we realized it was going to cost more money that I brought with us so we just sort of hung around the outside and checked out as much as we could without spending any money doing it.

After a short while we decided to start the walk home with a planned stop at the Olive Hyde Art Gallery. This ended up being a much shorter trip than I wanted it to be seeing as the gallery was displaying quilts and artwork that ran as high as $10,000. If not for the fact that four of my kids suddenly had to go to the bathroom at the gallery we would have only been there for a couple of minutes. In fact we were there for almost a half hour.

After that we took a slow stroll home and ended our two hour walk by coming home and resting. So when Sandi got home from her alone time she was able to come home to a quiet, resting house. Now how could this day have gotten any better?

Think BBQ. I know I am.

In memory – Sandra Cantu

A little over a week ago a news story broke in which an eight year old girl had gone missing in Tracy, California. Sandra Cantu, the eight year old girl, was last seen leaving a friends house and walking back to her home in a trailer park in Tracy. She was not seen after that.

Within four hours the missing persons report was filed and the police began investigating. The media began to report it and the community rallied around her and became hopeful that she would be found. It was a touching story and one that served to bring awareness to all families that no matter where you live you need to teach your children how to defend themselves, who to trust and what to do in situations that could result in their harm, abduction or worst of all, their death.

Well yesterday the worst of all possible scenarios was broadcast all over the central valley and bay area. Sandra Cantu, the eight year old girl who had gone missing just 10 days ago, was found dead in a suitcase in an irrigation pond on a farm just two miles away from Sandra Cantu’s home.

As the father of five kids, four of whom are daughters and one of whom is eight, I was rattled by the news. Entirely too many children die each year for the stupidest of reasons. It sickens me and angers me when I hear that any kid has been violated in any way. Even worse is hearing about kids whose lives have been snuffed out because of someone with a penchant for causing harm to a child. I still get confused by acts like these, cowardly, selfish acts for which there is no logical explanation.

As a parent I feel it is my responsibility to make sure my kids are safe as much as possible. Doing that sometimes requires shock and awe tactics. Like relating to my kids that at any time, anyone that seeks to do them harm could very well present themselves in a way that appeals to my kids. My wife and I train up our children as best we can. And sometimes the best course of action is to let them in to stories like that of Sandra Cantu.

If you have kids I hope you take the time tonight to tell them just how much you love them. Make it a point to discuss this case with them and the importance of not trusting anyone they don’t know. And make sure you take some time to pray for the family of Sandra Cantu. I cannot even imagine what they must be going through right now

Happy 13th birthday Sarah

Today my oldest child, my daughter Sarah, turns 13 years old. And I am so not sure what to do with that.

I can remember vividly the moment she was born. How she looked when she came into this world, how small she was and soft she was. I remember her trip home from the hospital and how we spent every minute of the first 15 months of her life parenting right out of the books.

I remember when she started walking, talking, learning, growing. I remember when she learned to ride a bike, when she got her ears pierced for the first time, the first time she spent the night at a friends house, the first time we left her home alone for a few minutes to jaunt to the store.

Most recently I can remember her developing into a young woman, changing physiologically, getting super tall, looking older. 13 years passed me by in about three paragraphs.

Where does that time go? When you have as many kids as I do time does move pretty quick. Anyone that tells you a minute is a minute never had a house full of kids. But 13 years? I mean, they just started last week it seems. And no sooner did I take her out of diapers than I am preparing her for high school, her first work for money and the prospect of driving lessons in a few years.

I am a blessed man to have the children I have. Each of them is independent and individual, and each has their own unique quarks, personalities and characteristics that personifies who they are. Sarah is an outstanding musician. She can play just about any stringed instrument and can readily learn the tune for a song on the piano in a matter of seconds.

She is a drama queen. Not like your usual kicking and screaming, throwing a tantrum type drama queen (not that she hasn’t done that before) but the kind that loves the stage, theater and acting. She has an amazing sense of humor, sometimes bordering on gross or dry, but always funny and always well past her age level.

She has a keen eye for fashion and designs dresses whenever she has the time to doodle in her journal. She also loves to work on her comic strip “The Robinsons” from time to time, showing a sense of humor and wisdom well beyond her years.

And the characteristic that I love about her the most, one that the entire family is blessed with daily, is her ability to belch like a longshoreman. There is not a person on this planet that can rip ’em like Sarah can. I love you for that baby. 😉

Seriously though, I have had a hard time coming to grips with my daughter’s coming of age. She is an amazing kid and is turning into an amazing 13 year old young woman today. I am so happy for her, so proud of her, so glad to be her father and so ecstatic that I get to experience her 13th birthday with her and our family. Few men get to live the life I live when it comes to children and family.

So as I sign off of this little emotional rant, I would like to offer this suggestion to you parents, and specifically you fathers… love your children mightily. Men, if you have daughters, treat them like the lady you would expect her future husband to treat her like. Tell her she’s beautiful, smart, funny and awesome. Tell her you are a better man because she is your daughter. Let her know what she means to you as a man and as a father.

Every little girl needs to know her parents, specifically daddy, loves her. Make sure your son(s) and daughter(s) know it today.

Happy birthday my Sarah. I love you baby.

Government knows best

There was a time in our country when parents were afforded the position of “knowing what is best” for their children. In fact it wasn’t that long ago that parents were not only expected to tend to their kids but were encouraged to do so. But it seems as though the government has become increasingly interested in the governing of not just the political landscape. Apparently the government wants into your family now.

I had heard about this issue originally from a Home School Legal Defense Association newsletter and I later read about Senator Barbara Boxer seeking to ratify the U.N. Convention on the Rights of the Child. After reading the content and the message behind it I am left with an overwhelming disgust for our government. Not that I liked the government before, but this makes me want to become a politician just so I can speak out against this crap.

How can any politician believe, at all, that the government knows better than a parent when it comes to raising and handling their own kids? I know there are edge cases of neglect, abuse, bad parenting and utter parental stupidity that could easily be recounted that might provide a small sense of justification for this. But I would say that in the bulk of families that could be affected by a decision like this most have parents that are in some way or another involved in the welfare of their children. The government does not need to pass an intrusive legal decision that would in effect put the governments decisions regarding children above the decisions of the parents of those children.

Does this not seem odd to you? I take comfort in knowing that as a parent I am responsible for my children. I take comfort in knowing that since I live in a free country, a country that does no derive its identity nor its principles from the government which covers it, that I can parent my children however I see fit. Like home schooling my kids. Like disciplining them as I see fit. Like providing for them, sheltering them and teaching them the way that I, as their parent, think is the best way.

I hope Senator Boxer takes one on the chin with this attempt. Seriously, the government is meddling in affairs that it just should not be in. Parenting is one of those areas and that really needs to be left up to the experts: us parents.

That’s one small step for a Sarah

And one gigantic, enormous, monstrous step for dad.

My oldest daughter, Sarah, was invited to spend the night with a friend of hers for her friend’s birthday party on Saturday night. Part of the festivities were going to involve shopping and a girls day out with her friend. I was cool with that. But I was shocked and awed when her friend’s mom came to pick Sarah up and told us that she was going to be dropping Sarah and her friend off at the mall. By themselves.

This is the first time ever that I was faced with the prospect of one of my children alone in the great big world all by herself. Well, not really by herself, but more, I guess, without me. Of course her friend did have a cell phone (and no I am not getting Sarah a cell phone yet) and both Sandi’s and my phone were on. And they were only going to be there for three hours. And her friend had done this before, so all in all, it was a pretty safe experience. But it was more than a little nerve racking.

The nice part about the experience was that Sarah’s friend’s mom went over a good set of pretty basic rules that reiterated the rules that Sandi and I have laid for out kids as it relates to talking to strangers, scams brought on by adults and how to conduct yourself in places like stores when it comes to money, what you say, how you say it and what you do with things that you have already purchased. So it was encouraging to know that my kid was receiving the same message from another parental source.

It was also encourage when, at about 3:00 on Saturday, my daughter called me to tell me she was going to be leaving the mall because her friend’s mom had come to pick them. She also told me she was ok, that she had a great time and the her friend was keeping her alive “for the most part”.

So I would say it was not a bad day for a few first time experiences. I am proud of the way my daughter handled it. And I am proud of the way my wife handled it. I am also proud of the way I handled it, and though I think I am still going to be a little slow to go along with something like this any time soon, I can say that I am confident that if either of my two oldest daughters were put into a position in which they were alone in a large open square, they would be more than able to handle the situation and be totally safe doing so.

Boys vs Girls: Having a meltdown

From time to time I notice large scale differences between my son and my daughters. They are not always magnificent, spectacular differences in nature, but they are always widely and significantly different in terms of conduct.

One such example happened this afternoon. We spent a long afternoon at Ikea , one that included lunch, playing, dreaming and a butt load of walking. We went there right after church so there was no rest time in between church and the store. Throw in the fact that ever floor we hit was a little cooler than the floor above it and you can quickly gather that our entire family was tired, hot then cold then colder, irritable and generally of a cranky nature.

In the past I have become somewhat accustomed to my daughters crankiness and fits of rage. But having a son has shed some light on the different ways in which boys and girls handle that stage of melting down that necessarily happens when the day has gone on too long for them and no one is catering to their every whim. Let me explain…

As we left the store we walked toward our truck as a family. Rebekah and Adriannah decided they were going to race to the truck. Alaynah, being the big girl that she is, took off after them. My son, being the big man that he is, followed suit. Rebekah hit the truck first, not surprisingly, followed by Annah, Alaynah and Aaron. Oh yeah, and Aaron’s scream. See, he had it in his mind that he was supposed to win. And when he didn’t win, he got upset.

If this was one of my daughters I would be able to tell you that she would have probably gotten quiet, maybe telling you that she didn’t want to be your friend or didn’t want to talk to you anymore, maybe cross her arms. Very emotional, very heart felt. My son… well, he went in a different direction.

After screaming, well yelling really, very loudly, he screamed directly at Alaynah, telling her, in effect, that he wanted to win and the she was supposed to let him win. Then he screamed again. Then he put both hands on the truck as if he was going to push it out of the parking spot it was in. And when it didn’t move, he reached under the rear quarter panel and tried to pick it up and throw it. Yes, my son wanted to pick the truck up and throw it. It was only when he couldn’t get it off the ground that the tears came.

Broken, frustrated and thwarted as a mighty man of truck throwing strength, my son became a little boy once again. And I had no choice but to pick him up, hold him, tell him I love him and then tell him that next time, if he wants to win, he needs to earn it because there is nothing at all the he will ever do in which a win will be given to him. Of course, I told him this in terms a three year old might understand some day. But he had to hear it. More importantly though was that he had to hear that I loved him. Right then, in the middle of his meltdown.

Which takes me to a place where my kids aren’t really all that different. When they are broken, frustrated and thwarted what all they really need is a little love. But then, isn’t that something we all need when we go through all that stuff, too?