Arguments For Distributed Repositories

So — you are using distributed repositories (DRs) like Git or Hg.   And you are thinking — why the heck use branching?  Branching is great for local one-offs but I can copy/paste for that!”

I admit that I have struggled with this questions as well — for instance thinking that SVN is just as good of a tool for developers.  IN the beginning people pushed these DRs but we never, ever used them in the manner that they were intended; they were just shiny new toys.  Some of us, me included, took a lot of guff for not being the earliest of adopters.  After a lot of hands on over the years, working with these repos the correct and incorrect ways I finally have solid arguments for using distributed repositories, especially when it comes to branching.

Note this is *not* in any way an anti-SVN post; that repo has great tooling and was revolutionary when it came on the scene.  You can even use plugins like git-svn with some success in front of a central SVN repository; and in many ways I find build masters preferring its branch and tag methodology.  But I would argue that from a developer’s standpoint a distributed is tough to beat.

  1. Fluidity
  2. Ease
  3. Sharing
  4. Functionality

Fluidity

For me the definition of fluidity is how much something aides your development process.  A DR seems in the way at first with the double-check in steps . . .check into your local, check into your central.  But once a developer sees the advantage of the local repo it becomes much easier to create batches of changes locally and then push them up to the central repo.  (Central repo is usually where the build server points and everyone agrees to push to).  DRs accept the merge bumps we all run into and make it part of their process . . . so development becomes something with less in the way.  You can worry less about the checkin  process.

Also, their is the speed of creating and switching between local and remote branches in a DR; uber-fast.  This alone in hands-on makes these tools worth it.

Ease

Have you ever had to work on a branch in SVN? Check out the whole thing and switch workspaces with your IDE — what a pain.  With Git (for instance) I just issue a git checkout branch and nothing else needs to be done. That’s as easy as it gets.  Adding and committing are all as easy as any other repo.

One thing is with RVs is that it’s also *easy* to get into trouble with merging and getting code out of sync.  These systems are more sophisticated so that’s part of the problem.  Git has the merge/rebase  wars, and a lot of time in Hg and Git you’ll see unintended branches pushed out by new users.  This is OK, it takes a while to learn.  Make the learning process easy.  All too often I see an experienced person blowing up on a newb forgetting that they too usually can’t write documentation and probably made the same errors.

But — the flow makes you do small commits; this in the long run helps keep you out of trouble. Easy!

Sharing

Remote branches are SO simple with a DR.  Since they store their diffs much differently — and SVN has to create whole new copies of directories, the speed is so slow comparatively.  Team members can share remote repos in seconds, and with Hg and Git you can fire up local servers in your local directory for sharing right away sans central server.

If you sit down and work with the tools — SVN, TFS vs DRs it doesn’t seem obvious off the bat how this might work.  I have some use cases below that, when you run into them can immediately see how useful sharing becomes outside the central repo; it is very powerful and not immediately obvious to non-coders as to why.

I mention this because often non-coders get to pick the big tools: people like management, paper architects, PMs and build masters, maybe even QA.  Their input is important, but as a developer not always relevant for *doing* the work.  I guess that’s why there is git-svn as a compromise and/or transitional tool.  Sometimes newer management and QA tracking tools, Rally for a while, only worked with more legacy repositories like SVN and TFS.

Functionality

I am a combination command line/UI person.  For instance, I always make sure my build scripts can run on the command line (as will the build server) and in my IDE which is usually Eclipse, sometimes IntelliJ.    You can get intra-build errors that are difficult to debug if you don’t master this.  With a DR — you simply get more tools.  The command line options for Git are endless; I love the interactive staging UI on the command line (git add -i); I also use Tortoise for eyeballing all my files, it lets me add/commit at the same time; the log and branch viewers are fantastic and picking out commits its simple.  The amount of commit history is great as well.

In fact DRs really make you think beyond coding as to how you push forth your code.

Some Workflows

Commit types: Build masters and managers are more concerned with feature pushes and rollbacks on a macro level; developers with micro commits and history.  I find DR tooling makes this workflow much simpler.

Branching: A lot of times when there is a large test suite and a refactor or major requirement change must go in a lot of those tests and other code will break.  The main build must not break.   The best way to handle this, with ease, is to use a Git or Hg branch; make your changes while consistently merging trunk into your branch; anyone can work on it as well.  Fix everything, then merge back to the trunk (after a merge from trunk of course).  This is one of the most powerful and easy to do activities with a DR.  You’ll know it when it happens to you.  Many times you can do this by yourself with SVN by just not checking in and making updating from trunk; but you don’t get the ease of branching or the ease of sharability.

Postscript

Using DRs properly and leveraging the features is not immediately obvious; you have to dig in and experience it to see why they might deliver more value.  SVN and TFS are certainly very adequate; I like SVN’s integration into everything there is and I like TFS’s concept of a shared shelveset.  Many build masters prefer SVN’s straightforwardness for *their* tasks.  And SVN was certainly maligned (to CVS for instance) when it first came out.  As developers we should avoid harsh orthodox judgments and see if something will actually put forth value or if we are just doing something for newness/coolness sake.

It’s taken years to see the value for me because almost everyone doesn’t branch/develop the same way on different sites. I guess that’s the lesson.  Again, deferring to SVN which was the first repo to put out this mantra while they were still hosted on tigress.org: “We don’t provide you with a process, just a framework to do YOUR process.”  Brilliant.

And someday there will be something better anyway.

Agile Process Templates? LOL

I found this entry in a Rational Process server . . . a team that has a process template and daily meeting notes for SCRUM.

Is there any other needed proof that Agile has went off the deepend?

EC Tech Meetup May 20, 2014 – Was TDD a QA Coup d’etat?

Tonight is the next installment of  *hands on* for our local group.  With brewskies and Crown Royal.

There will be testing exercises and some TDD kata, and discussing the efficacy of TDD in coding with today’s modern methodologies.

A lot of you have noted there has been a (predictable) backlash against TDD.    My earliest memories of the methodology were of zealot/half coders from QA spitting bologna sandwich bits on our shiny developer faces while they told us we were all wrong about how we thought about software.   I personally worked on sites where directors argued that QA=Developer in a sprint.   Now when I look back I see that part of the evolution as a coup; that QA was trying to take over the development process by trying to argue that the creation process was nothing more than translating requirements and tests to code.  It sounded great in a manifesto . . . . but didn’t work in practice like so many other manifestos.  Eventually, and to this day, non-coding management uses  TDD as an bludgeon for their inquisition — the usual spiral to not so much build software as to set up a CYA network and pre-empt blame.  Good old pre-emptive blame, another Agile methodology.

Then, as now, we have argued TDD is merely a technique for the tool box.  Yes test, but I wasn’t ready to drill a hole into my engine block to test block temps just yet.  And software is not a set of tests, its a set of something that does something – for people.

That aside, the tasks on-hand will be this kata I gleaned from Roy Osherove’s site with many, many thank yous.

String Calculator

The following is a TDD Kata- an exercise in coding, refactoring and test-first, that you should apply daily for at least 15 minutes (I do 30).

Before you start:

  • Try not to read ahead.
  • Do one task at a time. The trick is to learn to work incrementally.
  • Make sure you only test for correct inputs. there is no need to test for invalid inputs for this kata

String Calculator

  1. Create a simple String calculator with a method int Add(string numbers)
    1. The method can take 0, 1 or 2 numbers, and will return their sum (for an empty string it will return 0) for example “” or “1” or “1,2”
    2. Start with the simplest test case of an empty string and move to 1 and two numbers
    3. Remember to solve things as simply as possible so that you force yourself to write tests you did not think about
    4. Remember to refactor after each passing test
  2. Allow the Add method to handle an unknown amount of numbers
  3. Allow the Add method to handle new lines between numbers (instead of commas).
    1. the following input is ok:  “1\n2,3”  (will equal 6)
    2. the following input is NOT ok:  “1,\n” (not need to prove it – just clarifying)
  4. Support different delimiters
    1. to change a delimiter, the beginning of the string will contain a separate line that looks like this:   “//[delimiter]\n[numbers…]” for example “//;\n1;2” should return three where the default delimiter is ‘;’ .
    2. the first line is optional. all existing scenarios should still be supported
  5. Calling Add with a negative number will throw an exception “negatives not allowed” – and the negative that was passed.if there are multiple negatives, show all of them in the exception message

    stop here if you are a beginner. Continue if you can finish the steps so far in less than 30 minutes.


  6. Numbers bigger than 1000 should be ignored, so adding 2 + 1001  = 2
  7. Delimiters can be of any length with the following format:  “//[delimiter]\n” for example: “//[***]\n1***2***3” should return 6
  8. Allow multiple delimiters like this:  “//[delim1][delim2]\n” for example “//[*][%]\n1*2%3” should return 6.
  9. make sure you can also handle multiple delimiters with length longer than one char

1286608618

The title is the remainder for evaluating the numerical sequence 9876543210 as an Integer in Java.  This number lies outsides the bounds of Integer.MAX_VALUE for Java; it’s an overflow error.

1286608618 is the overflow remainder for casting 9876543210 as an Integer in Java.

I ran across this error in some code I was working on that had credit card type account numbers; which are generally 16 digit numbers.  The program in question got the *same* account number from one table as a string, another database as an Integer, and a third table as a BigDecimal.  In the code there were also methods that did conversions  of this number to long and to int.  Normally values like this are stored as strings but I have no comment about the design of this software and database where such things could occur . . .

When the value 1286608618 came back as a value during a unit test, I thought it odd and instead of just taking it as incorrect I researched it.  Since a lot of people use 9876543210 as a test value, perhaps a lot of people have seen this.

There are a few interesting things about this error:

  1. Java doesn’t complain when the bad number gets assigned to Integer.
  2. Java just mindlessly returns the overflow value with no error.
  3. Java makes a few trips through its Integer range until it gets a number that fits within the range.  In the case of 9876543210, it is over 2 times the value of the range, to Java makes those trips through to get to 1286608618.

I wrote a little Groovy code to play around with this:

//Here's the integer and it's overflow
Integer i = 9876543210
println "overflow error for 9876543210: " + i

//Integer max value
BigInteger maxInt = 2**31 - 1
println "calculated max integer: \t" + maxInt
println "Integer.MAX_VALUE: \t\t" + Integer.MAX_VALUE

//Integer min value
BigInteger minInt = -2**31
println "calculated min integer: \t" + minInt
println "Integer.MIN_VALUE: \t\t" + Integer.MIN_VALUE

//get the Integer range
BigInteger range = maxInt  + 1 - minInt
println "range: \t\t\t" + range

//two trips around the raspberry bush calculation
BigInteger big = 9876543210
println "big: \t\t\t" + big
println "overflow remainder: \t\t" + (big - (2*range))

Here’s the outcome:

Well see here, I know thinking about this bakes my bean a little bit too.  There are number shifts and all kinds of thing going on. If you have underflow the same kind of logic applies as well.

I don’t understand why it just doesn’t error — what use is that remainder number at all?  Have no idea.

Tractor Lights and Upgradability

See those smaller white lights on the sides of this motorcycle headlight?  Those are called fog lights.  Harley Davidson calls them passing lights.

This is the front of a 2003 Harley Ultra.  When I bought the thing I was under the presumption that there would be parts, forever, for any Harley model.  The scale of Harley parts is massive — for instance, if you order catalogs from Dennis Kirk in Minnesota or J&P Cycles in Anamosa IA you have to specify HARLEY or THE REST.  The catalogs are massive, and the H-D catalogs for parts are as big as or larger than the catalogs for all other brands *combined*.

A sad day came a few weeks ago when I took my bike in and got maintenance done, and the one of my fog lights was burned out.   Harley service came back and said “$70 to fix one.”  What, for a bulb?  This was more than the usual exclusivity fee.

Well it turns out almost none of the dealers carries bulbs for 11 year old bikes anymore and they were going to upgrade me to something modern, and I am guessing, out of context with the timeless form so few manufacturers have achieved: Harley for one, and Ducati for another (IMHO of course).

But . . . no freakin’ lamps, a common maintenance item, for this bike?  That’s nuts. I told them no, I’ll get my own — they were cool with it (and I suspect  sympathized).

I trotted over to the local Farm and Fleet and there I found Phillips 4411 bulbs with the slip-on connectors I needed for $8 a piece.  They came up on the cashier screen as “tractor lights.”  Made sense — in the old days a lot of Harley dealerships shared space with John Deere, Case, and International Harvester equipment.

Finding standard parts for anything is a concern.    Once I talked with a guy who had toured South America on a bicycle — he said a person would be nuts to use a 700c wheel (commonest road bike size) because all’s they have down there are 26″ wheel parts — tubes, spokes, tires.   On the flip I remember owning a few Chevy pickups and the Haynes manual covered 1967-1984 — almost 20 years of interchangeable parts save some Navajo body decals  or an 8-track player.  Imagine . . . .

There are tie-ins to this idea in software.  For instance, when picking out a technology for a new application — like maybe UX frameworks — don’t we look at the one with the most options, support, and probably longevity?

And recently I have been researching big data engines.  Been playing around with Apache Tez and Cassandra and thinking, hmmmm, I’m going to analyze log files with this should I get good at it — maybe tie it into my web site data miner I wrote in Groovy.  Dunno.

A big data engine  evaluatory article I came across had this observation in the comments discussion how RavenDB failed to scale for them:

Speaking of RavenDB 2.0, you guys did a lot of funky stuff on the Raven Client that forced us to rewrite major portions of our app – limiting the number of async calls made in a single session to 1 was the issue, IIRC. I ended up scrapping the project and had us roll back to RavenDB 1.0 until we migrated off of it since there were just too many things we had to change at once in order for our app to support RavenDB 2.0.

So imagine that you put all this time into something and hit the feature wall.

My observations about this are:

  • You can only pick a technology as well as you can that day.
  • Nothing will prepare you for the type of obsolescence you will run into in the future.
  • Making things work might be cheap.  Maybe $8, if you get lucky.  But in my experience they get expensive.

For instance, an organization I did some FileMaker Pro work on waited too long to upgrade their database.  All their forms, everything, done for. Was time to sunset that application . . . or limp along knowing that death was near.

On the other hand you might get lucky.  XP just got sunsetted — after what, 13 years?   That’s a long life for any OS.

Software isn’t really a Harley; its not even a cultural artifact its just some code that does something for now.  Harleys have been around because the designers hit the form and functionality sweet spot right on. Even if I can’t get those 4411’s I can still get something newer for my ’03.  Cobol did that, the C languages and Java.   Bleeding edge might return ROI — or it might end up like the Excelsior-Henderson Super X — flashy, awesome and just not around anymore.  Maybe a little of both is best.

A Trite Exchange About Agile This Fine May

I just  had a great discussion about Agile with one of my technical buddies.  It seams this is popping up everywhere: Agile has become a management club.  And by club I mean both an organization and a tool with which to bludgeon.  These are some of the ideas that came out of our rather trite exchange.

The content you are trying to access is only available to members. Sorry.

Opera With Chrome Plugins

Firefox.  Dang it.

Coding some javascript and waiting for a build, I was checking out my OK Cupid profile and wiped my Chick-Fil-A grease on my LA Clippers t-shirt when someone walked up and said –

“OMG!!!  You are using Firefox!  What a moral outrage!”

Crap.  Can’t win here.  Time for a new third browser.   I have to use IE (reality) and Chrome.  IE, sigh.  Good ideas, bad implementation like a Corvair.  Oops that’s non-PC too.  Wait were Corvairs bad cars? Can’t remember.

Believe it or not I work in the stone ages and can’t install Safari on my Win 7 machine.   You need admin rights for that.  I know, crazy – a developer without admin rights????; my setup starts with what the front desk has which is so nuts.  But . . . I CAN install Opera.  And Opera is kinda neat because it’s a *version* of Google Chrome and is also my mobile browser of choice.

For a long time I didn’t do this because I couldn’t install any good plugins but this has changed – Opera 20 has a plugin that let’s you install Chrome plugins.

The two I absolutely need (besides developer’s stuff):

  • Xmarks — very implement for sharing project links between browsers, especially during testing.  And the profiles are awesome.  I organinze my research in folders this way too.
  • Controlled Multi-tab Browsing — this lets me limit my browsers to 9 tabs.  I am an infernal tab opener, and I read at Lifehacker.com that all’s you need are 9 tabs max — and I’m following that right now.  And seriously it’s a big help.

Be careful about the multitab limit plugins.  There’s another Chrome one I cannot recommend called Tabalot that does this (explicitly from their plugin site):

After reaching a configurable open tab limit (that excludes pinned tabs) Tabalot will automatically close the left-hand non-active tab.

 

There’s no prompt or anything as of this date – just closes the darn tab.  Sounded great until it closed a Google Doc I keep open all day and I lost my information for the day.

So anyway in Opera you can install Chrome plugins.  It’s a big deal to *me* because XMarks doesn’t have a deployment for Opera. To do this you need to first install a plugin called Chrome Extension.  Here are the steps:

  • Install Opera’s Chrome Extension.
  • Install your favorite Chrome Plugins – Opera will be treated like Chrome because they are based on the same WebKit core – as is Safari.
  • Xmarks will work properly in Opera (or it has for me in version 20).  Joy of Joys.

Now when these politics and religion talking people come sauntering around they’ll just see me with Opera, Chrome and IE.

But did I uninstall Firefox?  Heck no.  Never know when it might be PC again and Chrome be the next offender. I’m even keeping Sea Monkey on my PortableApps just in case someone sees me shopping at Walmart or the Co-op and complains about my browser.

I guess there’s always wget.

RIP Agile

Agile is Dead?

About 15 years ago I was in a conversation to two women and one brought up her new “cool” shoes. The lady with the shoes said “Do you like these? I got them at Target and they are sooo cool.” We looked down at them — basic Nurse Ratchet shoes with a trendy buckle to make them look motorcycle-bikerish, but basically pigs with lipstick.  The other lady said: “No, they just look like Target shoes.”

The content you are trying to access is only available to members. Sorry.

Xmarks Server 503 Error

Like many, I use Xmarks plugins to manage my bookmarks across multiple web browsers.

Recently the Xmarks install on Chrome was breaking.   I sync anything and got a 503 error.

After spending some time looking into it and finding no answer on the Xmarks site or anywhere else, I decided to reinstall the plugin, which resulted in a successful fix.

Here are the steps:

  • Backup your Chrome bookmarks:  ctrl-shift-O (or use the tool menu) to open the Bookmark Manager –Then Organize–>Export Bookmarks to HTML file. If you don’t backup you could make a mistake during the Xmarks sync and lose everything.
  • Uninstall the Chrome Xmarks Extensions from Chromes Customize Menu–>Settings–>Extensions.
  • Reinstall the Xmarks Extension.
  • Sync up XMarks.  If you use profiles, you can cancel out of the initial sync wizard, and then go into the Options in Chrome and assign the profile.
  • During the sync wizard I chose this setting which kept it from destroying my bookmarks on my other browsers and in Chrome:

Tech Thoughts April 22, 2014

  • Tonight is the first of the hands-on developer meetings – Ale and Algorithms – for our EC Tech Meetup at the Milwaukee Burger joint in Eau Claire.  7 pm.  Tonight I’m hoping to work on some problems including
    • Fizz Buzz
    • Armstrong Numbers
    • Prime Number detector
    • Reverse a String without API use
  • Since the meeting is only an hour or so long we may not get through all these.  I’ll be using  Groovy  . . . and beer and cheese curds.
  • This is the first of hands-on meetings to do TDD, build build servers, open source VM, and solutions for private business.
  • How exactly can you do TDD whne you are using Acceptance Tests as a target?  So . . .in (say) a two week iteration you start off with broken tests and then fix them?  The build server then reports red for two weeks. Yikes.  And imagine a release of several iterations over a few months . . . maybe thats an insane target and TDD doesn’t work on that level.
  • After you release an iteration MAKE SURE the business experts review the AT criteria and outcomes.  All that may have changed by the end of development.
  • In DB Unit — if you are loading your data from an XML file make SURE the first record of the same table has ALL the fields even if it doesn’t use them!  Else you’ll get a “Broked” error — can’t load missing fields.  For instance:

This breaks:

   <Object  Date=”[some_date]” ID=”77″  />

   <Object  Date=”[some_date]” ID=”77″  ObjectNumber=”3751″/>

This doesn’t:

   <Object  Date=”[some_date]” ID=”77″  ObjectNumber=”3751″/>

   <Object  Date=”[some_date]” ID=”77″  />

  • Java’s Big Decimal: Again, to iterate: instantiating with a STRING is better than a DECIMAL — but you just have to live with the non-compile time check. Sigh.  But don’t want those nasty decimals hanging off.  Here’s a pic of a Groovy test (compiles to Java):

Pretty important in financial calculations.  More on this later sometime.