Tuesday, November 22, 2016

Do. Not. Optimize.

You've probably heard this quote before:
Premature optimization is the root of all evil.
 - Tony Hoare

Speculative optimization is always wasted time.  In the absence of an actual performance problem, you're just burning time that could be better spent on refactoring your code to make it clearer.  This is exacerbated because performance-optimized code is usually harder to read than code which hasn't received such treatment.

Here is what you're doing when you optimize:
  • Adding code that now must be maintained.
  • Obfuscating the existing code.
  • Spending time writing code that doesn't add value.
But what's that you say?  You have the experience and know-how to decide when optimization is needed?  Maybe, but probably not.   The people at Sun and Oracle may or may not be smarter than  you or me, but they certainly know more about optimizing Java bytecode than we do.

For example, some people think that having a large number of classes is slower than the alternative.  This was (maybe) true a long time ago, but isn't now. 

Why?  Because the JIT compiler inlines methods automatically.  It does a host of other optimizations adaptively (i.e., it decides where the program is spending most of it's time & optimizes those methods & loops).

So, when should you performance-optimize your code?  When you have a real performance problem, and a profiler (or similar tool) has identified the place in the code where it occurs.

Thursday, June 9, 2016

Developer Skills: Drawing

You aren't a good developer if you can't draw.

Fortunately, if you're a human, you can.  Drawing isn't an inborn talent, it's a technical skill that can be learned.  Write the previous sentence on a piece of paper to prove it to yourself.



There.  You just drew a whole bunch of letters quickly and (hopefully) legibly.  Words are a complex set of shapes that need to be drawn in a particular sequence to have meaning.  It's the same basic skill you use when drawing non-character shapes.

Drawing isn't a binary skill that you either have or do not have.  It's a continuum, and even at the shallow end (people with barely-legible handwriting), you have enough of it to communicate ideas visually.

So that changes the top line of this post to:

You aren't a good developer if you don't draw.

Visual communication is much more powerful than text.  (This study found 65% retention over 3 days for images vs text.)  We also absorb visual information much faster than text.  (This link goes nowhere.  Do your own research you lazy bastard.)

Communication is a key software development skill.  Consider how often you need to talk to people, and how badly things have gone wrong when you don't.  Design sessions, customer collaboration sessions, backlog grooming, story estimation, etc, etc, etc.

And yet, how often do we get up an draw a picture in an estimation session?  How often do we do it when talking about design?

Some years (decades, actually) ago, I started drawing simple box & line diagrams whenever talking about design.  Now I don't even bother to have a design conversation without that.  Even a simple nested box with a few labels in it will speed things up considerably.  It gives us something to point to and summarizes basic assumptions.

So, do you want to supercharge your development skills?  Don't bother with Angular 2.0, typescript, SpringBoot or DropWizard.  Practice drawing!

Why don't you?  What excuses have I heard?
  • I don't have any talent.
  • I'd look like a five-year-old.
  • I have gone paperless.
All of these really mean, "I'm embarrassed that my simple boxes and lines aren't as good as what a professional sketch artist can do."

They certainly don't need to be.  The easiest way to get better (in fact, the only way) is to just do it. For yourself if you must, but preferably to show others.  Their drawing skills are probably just as bad, so what have you got to lose?

Still too embarrassed?  Fine, here are a few simple ways to improve:
  • Switch back from digital notes to a paper notebook (I like the Levenger Circa system, but Staples' Arc is just as good) and doodle in it for a while.  (You can still capture photos of your notes to stick in Evernote, OneNote, Keep or whatever.)
  • Google the word "doodle" (or whatever else interests you) and copy whatever appeals to you onto paper.
  • Google "learn to draw" and choose from websites and YouTube videos.
  • Buy a book and work through it.  I liked "Learn to Draw in 30 days", but there are loads of others to choose from.

Bonus: Get others to draw!

I find this is much more powerful if you can get other people to draw on a whiteboard with you.  It clarifies what they are saying, and forces them to give you something concrete to point to.  

This is particularly useful in determining if A) someone is trying to convey and important concept that you don't understand, or if B) they're a clueless idiot blowing smoke.

Give it a try.  At the very least it will give you something to do in boring meetings, while making you look engaged.

Saturday, June 7, 2014

Showing Off: How to Do a User Demo


Rather than repeating what has been said elsewhere, here is a nice short post on agile-for-all that covers the basics.

Here are a few things for my own future reference and teams that I'm working with...

Try to keep each demo to 5 minutes or less.  

If it's longer than that, it's possible that you should be demoing more than one story.  More likely, you're just being too wordy.


TALK LOUDLY.  

No, louder than that.  Louder.  Do you feel like you're yelling?  OK, that's about right.  You need to put your voice in public-address mode for 5 minutes.


Focus on why your audience should care about the story 

This is particularly important for back-end work.  For example: Your story generates a feed of XML that will be consumed by another application. Show the output, and point to a couple of salient features in it.  Then be done.

The important part of the above is "show the output."  Showing the end users how to interact with your service is a separate sit-down, not part of demo.

At base, you want to remember who your audience is, and why you're doing a demo. 

Your audience

Usually, people come to a demo because they have a stake in the success of your software project. They're executives and end-users who want a preview of what they're getting.  The questions that are foremost in their minds are:
  • Am I spending my software budget wisely?
  • Is what the team is working on what I need next, or do I need to change their priorities?
What it does and why it matters are most important.  They do not care if you came up with a way-cool whiz-bang solution to a technical problem.  They do not care if you just learned how to use the MEAN stack.  Show off your skills to the rest of your team in a lunch & learn session later.

Why do a demo?

You're doing this to ensure that you're building the right thing.  Hopefully you have other controls in place (tests, business validation reviews, etc) to ensure that you're building the thing right.  This isn't the time & place to prove it.  You're here to give the business-oriented people a chance to judge the value of your work, so they can help you adjust if you're not giving them what they really need right now.

On this last point, it's important to keep an open mind and accept the feedback you get.  If you aren't getting any feedback, you probably need to adjust how you're doing the demo.