word = unit test, sentence = integration test

I was trying to explain to a manager the difference between unit testing and integration testing.  I used a few different styles for explaining, but one jumped out at me as “have to blog about that one.”

The Analogy

  • unit tests represent testing a word
  • integration tests represent testing a sentence

Why this works

If you use spell a word wrong, you have no hope of your sentence being correct.  The words are the units.  If you use the words in the wrong order or are missing a word or use the wrong word, your sentence is not correct.

It also shows why both unit tests and integration tests are needed.  With just unit tests you won’t know that “cat my hair ate the” is wrong.  After all the individual units are correct.

With just integration tests, it is a lot more work to know everything is correct.  While it is possible to test the entire sentence in one shot for spelling correctness, it is hard.  As humans we spell check one word at a time even if we don’t realize it.  That’s why “coding is fun” is faster to spell check than “codingisfun”.

Conclusion

Thoughts on this?  I don’t remember reading this idea anywhere, but I may have read it and forgotten it.  If anyone knows where it came from, feel free to post that as a comment.

why do i blog?

.. and I could not think of any reason why I would want to give free information to the anonymous general public.

I asked a colleague if he had a public blog and this quote was from his answer.  (used with permission.)  We both blog at work so I was a little surprised to hear that.  I thought about replying, but it makes a perfect blog post.  So here we are.

Why did I start blogging?

I’ve been posting at JavaRanch/CodeRanch since 2003.  I had thought of starting a blog but didn’t feel I would write often enough to warrant one. In 2008,  Scott asked me to be a contributing author on his blog, selikoff.net.  Fifteen months ago, he invited me as a co-author.

Why do I enjoy blogging?

I like to write.  I like to share knowledge/ideas/information.  I still don’t write often/regularly enough here to warrant having my own blog.  But that’s ok.  Scott and I provide a nice balance and variety of topics.  I even got an iPad so I add Apple topics too.  I also have an internal corporate blog which I write to about twice a month.  I use this one for my general information/JavaRanch projects/robotics topic.

What do I get out of blogging?

Pretty much the same things I get out of JavaRanch:

  • the opportunity to share information – I noticed very little information on the Core Spring 3 certification so I added a lot after I took the exam.
  • the opportunity to help others struggling with a problem – I encountered some surprises while setting up the BlackBerry simulator so I wrote about it to help others.
  • the opportunity to get feedback on ideas – or give.  One of our top five blog posts of all time is my reply to Kathy Sierra‘s tweet stream about female programmers.
  • the opportunity to interact with other strong technical people in the field
  • the opportunity to get corrected in a “safe” setting (it’s not like work where you are going to get in trouble for taking a risk) so I can learn more
  • a place to post things I know multiple people will ask me so I don’t have to keep writing answers to the same questions – whether it is a tool choice for Subversion or why you need to defend the code, it is write once and read thousands of times.
  • respect as a strong technical person
  • surprise opportunities that I never would have expected like quoted on the back cover of EJB 3 in Action, being a reviewer on the OCPJP certification book and being a speaker at the upcoming Server Side Java Symposium (extra $200 off with the code listed here.)

I wrote this list as a stream of consciousness thing and then went back to add examples.  I’m pleasantly surprised how many times I used the word opportunity.  I was also excited to see that each thread I linked to as an example has at least two thousand hits.

Why the quote surprised me

A few key words jumped out at me.  Let’s look at them one at a time.

  1. “free information” – Have you ever googled an error message?  Many of the hits that come up are blogs or message boards.  Granted some of them are people who are paid by Oracle/IBM/etc to be there.  But most are not.  They are people sharing free information.
  2. “anonymous” – Networking is all about talking to people you don’t know.  In the real world, you walk into a room and there are many people who quietly listen.  Which is fine.  Then there are the leaders who make things happen.  You get to meet more of those people if you are contributing information to the larger tech world.
  3. “general public” – Having those connections to people I don’t work with is incredibly valuable.  This is more so for JavaRanch than this blog.  Although I do think the amount of reputation/goodwill I have built up come from both.  When I am stuck on something, nobody I work with knows what to do and I really need help, having those contacts is priceless.

Culture differences

I work for a bank where intellectual property comes up as a term.  I am very careful not to let any work information/projects leak out.  (That’s why I have a work blog; for the things I can’t make public.)  Sometimes I’ll play with a tool/technology at home first so I can blog about it here.  Or sometimes I’ll play with something home because I want to try it out before a conservative place like a bank gets to it.

I do understand the feeling of not sharing information with the “outside world”.  But that’s for information that my employer owns or pays me to learn.  For things I do on my own time, why not?

Conclusion

I enjoy blogging/information sharing and I look forward to continuing to do so.

4 Lessons in PowerPoint and Impress

As I was preparing my presentation for The Server Side Java Symposium, I learned three valuable lessons about PowerPoint.

Note: If you are thinking about attending the conference, Coderanch has an extra discount.

Lesson 1 – Open Office goes crazy

As I have Open Office 3.0 on my machine, I just assumed I could create my slides in Open Office’s Impress.  I opened the template the conference organizers provided.  And Open Office went crazy.  I ran into two problems right off the bat:

  1. The template decided to use “random transition” between slides.  Which many people noticed when I asked for feedback on my slides.  I saw this in PowerPoint too so it might have been the template.  Or it might have been that my copy somehow got corrupted.
  2. The text sizes were different.  This did work correctly in PowerPoint.  In Open Office, indenting caused that row to be bigger than it’s parent.  Not a big deal as I don’t have two levels of bullets in my Presentation.  They were only there when I was gathering ideas, but annoying regardless.

I was able to recover from these quirks and go on to write my presentation in Impress.

Lesson 2 – Showing one row at a time

I asked some people for feedback on my slides.  Most people had a few comments. Norm Sutaria tore it apart provided by far the most feedback.  Thanks Norm!  I have two slides with comparison tables.  Norm correctly pointed out that I should set them to display one row at a time so the audience doesn’t read ahead.  Sounds easy to do, right?  Nope.

In Impress, I couldn’t find a way to do this.  I decided to move to PowerPoint where more help is available.  I learned that PowerPoint 2007 doesn’t make this easy because it was required to allow larger table sizes – 75 rows x 75 columns.  (Who puts so much data on a slide in a presentation?)  In any case the tip was helpful to copy paste as an enhanced metafile, ungroup twice and then regroup into rows creating a custom animation for each row.  Oh and text that spans two lines needs to be selected for each line.  Tedious.  I can’t believe this is the way to do something so common.

Then I ran the presentation through to check that it worked.  And I saw:

  1. Slide title, table header and first row – good
  2. Press enter a few times and see the next row appear until all are there – good
  3. Press enter to go to the next slide and see the original slide title, table header and first row – huh?

I couldn’t find anything on the internet about why this was happening.  I gave up and asked Norm.  Who couldn’t find anything either.  He solved it by deleting the animations and starting over.  I’m guessing it was a residual thing from the Impress/PowerPoint switching.  Thanks Norm! (again)

Lesson 3 – Highlighting text

While walking through the slides with Norm, I also realized I should highlight certain text.  Like when you take a yellow highlighter and run it over text to get a yellow background.  Another thing that sounds easy to do, right?  Of course not.

At first I blamed Impress for this.  After all, it is a free tool.  Surely real PowerPoint lets you use a highlighter.  Turns out not so much.  Both tools let you use a background color for the entire textbox, but not for part of it.  The “solution” is to create a box of the color you want and position it over the text and then adjust the transparency.

This isn’t important enough to waste time/patience on positioning boxes.  I decided to just change the color of the text itself.

Lesson 4 – The mysterious blocks when printing

I made a nice little graphic and put some text next to it.  I had underlines in three places in the text.  PowerPoint turned that into big black blocks that go down the rest of the page.  It’s not my printer, this happens in print preview mode.  I found out when I was walking through the slides with Norm.  Why would it do that?!  After all the time spent on previous lessons I used a “solution” of removing the underline and using indentation for emphasis.  The lesson is to look at your slides when printed and not just assume they look the same as on the screen.

Conclusion

Argh!  So much frustration to do simple things.  I have to wonder if (Mac) Keynote has these issues.  Anyone know?