Monday, December 28, 2015

Do We Really Need Estimates?

agile-iconOkay, so you’ve read anything I wrote before, you probably know by now, that I am a strong proponent of Agile methodologies. I’ve said it before, and I’ll say it again:

Estimates Are Wasteful

waste-clipart-trashcancIt doesn’t matter if it was a friendly debate with a manager, discussion with a client, heckling from someone in the audience of a presentation, but pretty much every time that I bring up this point, I get asked some variation of the following question:

Thousands of companies and organizations have been managing by estimates for decades. Do you think that you are smarter than the owners and managers of everyone of them?!?

I must admit, that question ruffles my feathers every time I hear it. Mostly because, that’s a direct attack on me, not my ideas, and a part of me wants to lash out back at them, or just glibly reply in the affirmative. I don’t. Discretion is the better part of valor, after all…

Today I just thought of a real good answer. Perhaps still a bit on the glib side, but at least not disrespectful or boastful.

Am I Smarter Than Pro-Estimate Managers?

brainyThis is going to be my new go-to answer. Feel free to use it. Feel free to quote me:

I think that I have more knowledge, better tooling, and have learned from more failures, than whoever originally came up with the idea to estimate. And I have no basis to compare myself with those who simply estimate because that is what everybody else is/was doing.

What Do You Think?

TrollfaceStill too glib? Too arrogant? Just right?

Let me know in the comments.

Wednesday, April 15, 2015

How to REPL in C# with CShell

Sea-shell

Perhaps the first question should really be ‘what is REPL’? In truth, much like software testing, many developers use it, without knowing that there’s a name for it – or a better way to do it. In this post I will explain what REPL is, how to use it in your development process, and finally, how CShell makes REPLing so much easier.

What is REPL?

http://ubik.cc/MAOW-Firenze-09/images/repl-loop.pngREPL is an acronym, which stands for Read – Evaluate – Print – Loop (see? not so complicated). Essentially, this is a cyclic process, where the computer reads and parses input from the user and feeds it into some algorithm or function, evaluates the algorithm, prints out the function’s output, and then returns (loops) back to the read state for more input. This cycle repeats until terminated.

In some ways, you may consider this to be the interactive version of TDD, where you make up the test as you go, running a function either in order to test that it works as expected, or in order to learn how it works, using different inputs to increase your confidence in the code.

In fact, anytime you write a short block of code, often a console application or a unit test, in order to design or test a function – you are – to some extent – REPLing.

To some extent, because just like with test automation, you really want proper tooling, if you want to do this properly, and do this with ease.

You need a REPL environment.

What is a REPL Environment?

https://www.smc.edu/ACG/Marketing/Events/Documents/policy%20of%20environment.jpgA proper REPL environment is first and foremost, an interactive environment. This means that you should be able to simply drop into the environment, type in some code, and have an immediate indication as to whether the code does what you want it to do.

A na├»ve and cumbersome way to do it, is of course, open Visual Studio, start a new console application, type some code into the Main() function, and run the application. The problem with this approach, is that (a) it takes a lot of time to reach the part where you can type in some code – too much ceremony, and (b) you have to compile the whole application, and start running from scratch every time you want to run. A true REPL environment should let you evaluate each line separately.

Note that Visual Studio has an Interactive Window. Unfortunately, it is for debugging, and can be used only while running code in debug mode, not while designing it.

Until recently, I’ve been using LinqPad. LinqPad is a really great tool, that allows you to run short scripts in C# (and VB.NET and F#). The commercial version (just under $50) adds intellisense, and supports using NuGet packages for references that your .NET script may need. You can also use it to write short programs as well, and create extensions that you can use with all of your scripts. You can fire up the environment very quickly, and just start coding an expression to REPL, or write a script.

I have, however, a few weeks ago, discovered CShell, and have started using it immediately, and have not looked back since.

Enter CShell

CShell IconCShell – no relation to the similarly named shell that is (not so) commonly used in UNIX and Linux environment, is a free (as in beer), true REPL environment. It is based on the new Roslyn compiler, and has all of the key components that you need:

  • True REPL interactive window – in the IW, you can simply type C# code, hit enter and it evaluates, line-by-line. In the IW, each evaluation is remembered, so you can enter multiple lines, each one based on the results of the previous evaluation.
  • A scratchpad window for entering C# and script-CS (.csx) scripts. You can run an entire script, or just selected lines. In this mode, of course, each evaluation runs separately.
  • CShell can print to a “sink”, in various formats – text, HTML, XML, graphs, etc.
  • Intellisense. It simply just works.
  • string based evaluation. You can type in something like Shell.Evaluate("1+1"); and it prints the evaluated result.
  • Add references from the file system or the GAC.

imageOne nice thing that really helps you get started with CShell is the tutorial. When you open the IDE for the first time, the workspace opens up with the Tutorial.csx script file. It walks you through examples of what CShell can do, and how you can/should use it. One run through it, and I felt as comfortable with it as I do with LinqPad, which I’ve been using for years:

image

If you accidentally (or purposefully – I won’t judge you) closed the tutorial and want to reopen it, you can find it where you installed it (unzipped the binaries, really – it’s an XCopy deployment), under CShell\Templates\Tutorial.csx.

And did I mention that it’s free?

Technorati Tags: ,,,

Tuesday, January 27, 2015

5 Reasons to Manage Your Solo Project’s ALM Process

ALM soloSo I’ve been developing software on the Microsoft stack for just over 10 years, and training and consulting on managing software development with VS-ALM (a.k.a. TFS, a.k.a. Team System) for just over 4 of those years. But in all time training and consulting, I was working with teams – from small 5 person start ups, to enterprises with hundreds of users, all using Team Foundation Server (a.k.a. on-premises TFS) to develop their methodology and align their tooling with their products.

Never individuals, though.

Over the years, though,  I’ve had the opportunity to fly solo on several software projects, some short lived, some longer, as have other ALM consultants that I know. One thing we all seem to have in common is that, while as ALM experts, we have all of the skills and knowhow to apply our own trade to the software we develop, we seldom – if ever – do so.

The Cobbler’s Children Go Barefoot…

… as the saying goes. It seems that this proverb applies to our profession as much as it does to others. You’ve seen the doctor who smokes, the out-of-shape coach, the technician or plumber whose own wiring or plumbing is faulty, respectively. Perhaps it’s the same. Perhaps its just that proper ALM is more visibly useful when multiple hands are involved and they must all communicate and interact properly with each other, than when one person holds all roles.

Solo projects seem to need no management, I believe they only seem to.

Here’s why:

1. If You Don’t Use Source Code Version Control, You’re an Idiot!

The_Stupid__It_Burns_by_PlognarkI apologize for the vehemence. Let me rephrase this. If you don’t use some kind of source code version control, you’re an inexcusably dense idiot who deserves what he or she gets when you lose your source code!!!

I guess I couldn’t rephrase it without the vehemence. Lesson learned.

Beyond the fact that having some kind of backup, preferably online, means that even if you lose your laptop, or accidentally delete your source files, you still have a copy of your code, version control means that if you make a mistake, you can still rollback to that point in time and fix whatever you did wrong. Having a historical log of the changes you made to the software can also serve as release notes of sort, and a rudimentary list of the features and bug fixes you have, and even help establish some kind of time line.

Really though, version control is about security for the code – protection against loss and against mistakes. you should use it as frequently as possible.

Note that you do not need to shell out huge amounts of money to be able to use version control. In fact, as in life, so with version management, the best things are free!

I prefer using Git. You can use it locally with any operating system (Windows, Linux, Mac OS), and there are multiple online tools that work and synchronize with Git, all free: GitHub, CodePlex, and (my personal favorite) Visual Studio Online. There are, of course, other version control systems, both distributed and centralized (Mercurial is another DVCS, Subversion is a great free centralized one).

Heck, even use DropBox or some other online-syncing file-storage, just beware that it won’t protect you from deleting your code, nor will it let you rollback – but at least you’

2. Defining (just enough) Work Upfront = Less Code Writing and Rewriting

backlogMuch like TDD tends to limit the amount of production-code you write, so does defining your work. In fact what is TDD, if not the definition of a small amount of work that needs to be done to the system, along with a definition of how to know when you’re done? The same holds true for defining a development task, a user story (a.k.a. a product backlog item, or PBI) or a feature; each is an elaboration of the higher level: Feature to user story, to task, to test. When you know what needs to be done, and you know when you’re done, you know exactly what the remaining work is. That saves time.

And let’s be clear. Just enough is key here. Too little, and you’ll rewrite anything that you haven’t properly thought out and planned. Too much, of course, and changes to the reality surrounding the project and your perception of reality will bring rewrite to your plans.

3. Project Planning Makes it Possible to Plan Releases

Unless you are truly working on a hobby for yourself, you still need to be able to answer at least these two questions:

  1. When will it be done?
  2. What will be done by a certain date?

Without estimating the work you have to do, more so if you don’t even know how much work you have, you simply will not be able to give more than a POOMA estimate.

Note that unless you live alone, you might still need to answer these questions, if only so your partner, roommate or parent will know when you will finally clear the garage (or dinner table) from your junk.

4. Automation Reduces Human Error as well as Manual Labor

vitruvian-hiEven if you are a solo programmer, two things remain invariably true for you:

          1. You’re only human.
          2. You’re only one human.

Being only human means that as talented as you may be, you are still prone to repetition based errors. You’ll forget to update the version number, or forget to set the build configuration to Release, or forget to run the tests, or any number of things. When I train new developers, especially in those early days when they feel that the fact that they’re constantly making errors, and more experienced developers must be demigods or some such, in an attempt to reassure them (and lighten the atmosphere), I tell them this:

  • There are only two kinds of developers: experienced, and inexperienced developers.
  • Inexperienced developers make only two kinds of mistakes: Mistakes born of inexperience, and mistakes born of stupidity.
  • Experienced developers make mistakes only born of stupidity

Aside from the fact that this is inherently true (an experienced person, by definition, cannot make a mistake born of inexperience), it is important to note – experienced developers make mistakes!

Computers do not. Ever.

Another saying that I’m fond of repeating, the former statement being a key reason to do so, especially when consulting and or training clients on the use of ALM tools, is to never let a human do a machine’s work (and vice versa). Anything a machine can do, we shouldn’t.

Finally, there’s the fact that any time spent on doing what someone, or more importantly, something (i.e. your computer) could do, is time not spent on things only you can do (i.e. developing the product – which you’d probably prefer to do anyway). Ask yourself this – while you’re manually doing repetitive work – who is coding? Nobody.

This holds true for building, for testing, for releasing and deploying, and basically for anything that you can (and know how to) automate.

In all but the simplest and most straightforward scenarios (usually short-term, one-shot projects), you should find ways to delegate work to a machine.

5. Defining the Work Makes Change Management Easier

It’s all great when you’re hacking away at that pet-project of yours and you’re in the zone, but a week later, a month or even three later, once you start delivering a second or third release of your software, keeping track of what was done, when – not to mention writing release notes, becomes extremely difficult, if you don’t know what your changes are or were. In fact, if you use an ALM tool for tracking features, changes and defects, and associate them with automated builds, you can generate a release notes document automatically with every build, and not have to deal with it yourself.

The other kind of change, is change of management. Today this may be your solo project. Tomorrow, who knows? You may take on a partner, give someone else the code to maintain, or decide to open the source. If the only definition of the work is whatever lies inside that wonderful brain of yours, hand-off will be a bear. Trust me. I’ve had to waste two weeks once receiving a project, and I still don’t know everything about it. Finding out stuff on my own is not the best use of my time. Having a nice set of features, tasks and bugs (past and open both) shortens the time, and makes discovery pains all but gone.

Conclusion

In summary, I’d like to state my opinion that in most (again, all but the simplest and most straightforward one-shot) software projects, proper ALM is as useful and important when flying solo as when developing with a team. Lack of communication issues (though see point #5) are balanced by the increase of work of having to do it all by yourself.

Just do it right the first time. You’ll thank me for it.

Best Regards,
Assaf Stone
Occasional Solo Developer

Friday, January 23, 2015

5 Ways Project HoloLens May Change the World

Ok. So I have just right-clicked the word “HoloLens” and selected Add to Dictionary from the context menu. I believe that this word will be there for a while, and sooner or later, on everybody’s lips.
In case you have been out of touch with technology news in the past several days, HoloLens is Microsoft’s newest device, still in its earliest development phase, which has been unveiled for the first time (after many super-quiet years of secret development) at Microsoft’s Windows 10 Event in Redmond, VA.

Meet HoloLens

HoloLens is Microsoft’s leap in to the virtual reality – or rather Augmented Reality – arena. Wearing HoloLens will allow you to view the reality around you, with holographic images, videos and even sound overlaid on your surroundings, allowing you to interact with it with natural gestures and voice commands. Imagine being able to see a video on a virtual screen where your wall should be, or a floating instructor – either virtual or a real person on a Skype call – along with arrows and guidelines for, say, fixing a sink. Imagine your game world overlaid on your real world!
There are a lot of different ways to use HoloLens, or a similar device, and most people whose comments I’ve had the misfortune of reading, seem to see a cross between an even weirder-looking Google Glass, and Yet-Another-Gaming-Console-That-Will-Never-Replace-The-Controller-We-Already-Have.
I disagree. I think that the sheer number of possibilities such technology can offer is mind-staggering and goes far beyond gaming and taking pictures and videos of others on the street without the subjects knowing it.
The following list comprises what I believe may be the five most pronounced ways that HoloLens can change how we interact with the world around us.

1. Virtual Privacy

Not my office. Just a picture off the netMany people in various industries are victims of what seemed to bean-counters like a great idea. Cubicles, bullpens, hotel-desks. No matter how you call them, Work environments where people who are not collaborating on the exact same task are forced to endure noise and distractions from others are detrimental to productivity. At my current job I sit at my (small) desk, and am surrounded by people who are almost constantly on support calls that 90% of the time have nothing to do with me. There are also at least one man and one woman who seem to be chattering about non-work related issues, at least half of the day, everyday. The noise is annoying. Add to that the fact that there’s no privacy – my calls, my screen, etc. Personally, I hate having to think that someone may be looking over my shoulder while I’m browsing, reading, coding or answering emails (unless I asked them to). Finally, I miss the gigantic whiteboard that I had in my office, the last time I actually had an office. Just something that I could always look up to from my screen, so that I can verify or validate some design decision. So I work from home as often as I can (though I still miss my whiteboard. My wife just won’t let me put up one in the living room where I work…).
Only at home, while I do have my privacy,  I only have my (two) laptops – no 24” screen (its on my shopping list), much less two of them. And my really good keyboard and trackball mouse are at the office.
Enter HoloLens! Imagine coming in to work and putting on your HoloLens and sitting down at your… virtual office. That giant whiteboard? Hang it wherever you want. Might as well share a virtual strip of wall with anyone else in your office. It doesn’t matter. You see your whiteboard, I see mine. Or just hang it in the air. Look up to it any time you want from your 24” screen. No! Make it 48” or have several of them. It’s virtual anyway. Ever wanted your emails to be announced just not on your screen because you’re coding now? No problem – they can float off to the left, if you want. Your office can look however you want it.
Just add some pluggable noise-cancelling earphones to the rig (hear that Microsoft? I want to be able to plug noise cancelling earphones into my HoloLens!) and that annoying chatterbox may as well be on the other side of the world, for all of me.
And did I mention the privacy? Nobody looking over your shoulder. They can’t see your (virtual) screen unless you share it.
Oh, and for the bean-counters out there – as soon as this device hits the $2,000 mark, it will probably be cheaper to buy than the desktop, desk and cubicle that your office currently has.

2. One office to rule them all!

Moving on to #2, and moving home from the office. If you, like me, work a few days at the office, a few days at home, and a few days at the local Starbucks (or wherever you choose to water your horses), you know that having a decent laptop and VPN is crucial to get any work done, but you may have to decide between shelling out extra cash for having the same office set up at home as you do at work, or do without the comforts that you have at one location or another. You may decide to buy a decent monitor for home, and the same keyboard, but you are definitely going to have to live without your 2 x 24” setup whenever you go to work at the coffee shop.
Enter the – you guessed – HoloLens! Just lug that HoloLens from your office to home (and even to the coffee shop if you aren’t concerned about looking like a dork), and you can have the exact same office setup anywhere you are.

3. Training and teaching

Ever had to explain to someone else how to do something? Ever had to do that when you were out of reach? 10 miles or half a world away, as is often my case, something always seems to go wrong just as soon as I’m away. The farther I am, the greater the problem. I go to work – any my smart TV cannot connect to the internet, leaving my baby daughter unable to watch her favorite YouTube nursery videos (mainly “Twinkle, twinkle little star”, and “Peanut Butter Jelly Time!”) on the big screen (#FirstWorldProblems). I’m out of state? The thermostat doesn’t turn on the furnace (and it’s below freezing outside). Did I leave the country? The garbage disposal unit won’t work.
My wife is very capable, but I have a bit more of a knack for figuring out what went wrong and how to fix it. I could guide her, if only I could see what she sees, and show her what to do…
Enter – yet again – HoloLens! Skype + some virtual whiteboard tool, and I can see the sink as she does, point out where to stick that screw driver, see what’s happening and adjust my guidance without her having to describe what’s happening. Think Remote Assistance, only outside the computer!
Imagine a doctor training for a complex operation. Just put on the HoloLens and bring up a virtual body. Do the operation 100 times until you get it right, then swap for a real body. Keep the HoloLens on, for real-time guidelines on the procedure…

4. Design!

imageWhen Tony Stark designed his Mark-II suit (yes – that scene in his basement lab), a new era of imagining how we design products – forget flat rendering of 3D objects with blueprints on paper. Let’s have the objects floating in the air right in front of us! Zoom in, zoom out, step inside, turn it around – we can really understand what the design looks.
3D Modelling will be come a much more natural process, and design verification will be much better. We’ll be able to see what something actually looks like before we make it.
And speaking of seeing what something looks like, and speaking of Iron Man, imagine trying on a suit or a dress before you buy it. In the comfort of your own home.

5. P0rn

Let’s not pretend that it won’t change this world.

Closing thoughts

I am mostly psyched up about the first two options! Productivity in the work environment is a key concern for me. I believe that improvements there will ripple out to everything else we do.
I’m sure that there are other amazing ways people can improve whatever is near and dear to their hearts with the aid of augmented reality. What would you do if you had a working and stable version of the HoloLens?