I am unashamedly a fan of the magicians Penn and Teller. I most especially love the fact that I will laugh out loud during their performance and I end up just feeling great afterwards. Today’s topic is sort of like one of their magic tricks. Bare with me, while the analogy might be a bit loose I think it holds a wee bit of truth at least.
The build up to the big trick is sometimes long, takes a bit of explaining, usually involves some sort of peril for one of the participants and has a great payoff in the end that makes you happy and the audience will cheer. So the following the analogy means that in creating an app, any app requires a bit of time for prep and planning. You sometimes don’t know if you will be successful (the peril bit) and when you ship; it just feels good. In some instances you might laugh (or cry I suppose) and the audience (users) will hopefully cheer. I should add that the magic trick takes hours and hours of practice with the result being failure a whole bunch of times, so don’t give up, keep working on it and your audience will thank you.
Christopher Priest wrote a book called “The Prestige” which was made into a movie in 2006 about a couple of 19th century illusionists. In the book he described the three parts of a magic trick, the pledge, the turn and finally the payoff, the prestige. We are going to try really hard to relate development to these steps (in a slightly twisted analogy).
The first part, “The Pledge” is where the magician shows something ordinary: a deck of cards, a bird, etc. The magician then gets the audience to inspect that ordinary thing, unaltered and real in all aspects. The second part called “The Turn” is where the magician takes that ordinary object and makes it do something extraordinary. You, the audience, are looking for the secret but you won’t find it. Mostly, you won’t find it because you don’t really want to know. You want to be fooled or in our case amazed. The last stage is “The Prestige” because just making something disappear is not enough, you have to bring it back too. (paraphrased from “The Prestige” by Christopher Priest)
In these blog posts I hope to cover all three stages as they apply to app development beginning with “The Pledge”.
The Pledge
The first part of our trick today is to show you something ordinary. In a trick it might be a deck of cards or a bird or something like that. In our tale it’s going to be Visual Studio 2015. You can look at it all you like and of course it looks quite ordinary. It’s probably not, but it seems so.
I have a big affinity for Visual Studio (VS). I have used other tools from command line text editors (you vi fans know who you are) to notepad to open source tools like Eclipse. None, absolutely none have performed for me the way that VS has. Each new iteration has brought new productivity gains. Each new thing I learn makes me a better developer. Is it perfect? Of course not, but then we wouldn’t need new versions every couple of years adding the features we sometimes didn’t even know we needed then wonder how we lived without. Visual Studio “15” Preview 4 is out as of this writing and it looks pretty cool to me.
Back to Visual Studio and showing off “The Pledge”. You would think it looks like just an ordinary IDE used to build great Windows Software for the Enterprise, the Windows Store, your mom or just something to make your own life easier and it is.
Here are a couple of features of Visual Studio I find very compelling. There are dozens more but I had to start somewhere.
Git
I have “discovered” Visual Studio’s integration with Git source control. I must admit that I was not a big fan of git in the beginning but I’m completely sold now. I like a command line as much as the next geek but only a command line got to me. With the git integration in VS I can do most of what I want inside the IDE now. Branch management, commits, synchronization, pulls, pushes and even pull requests can all be done inside the team explorer that was once reserved for Team Foundation Services (TFS). Working solo or in a team is now so much better. This would be a good time to mention that Visual Studio Team Services (VSTS) will support TFS and Git source control. Look for more info on VSTS in coming posts with regards to DevOps, Continuous Integration (CI), automated testing and publishing.
CodeLens
CodeLens was around in earlier version of Visual Studio but only for the Ultimate Edition. Visual Studio 2015 brought it to the common man, aka most developers. It offers developers a quick glimpse into not only the usage of a particular method or property but also its history. Should you work in a team, it also provides a way of seeing who last modified the bit of code you are working on. This is so unbelievably helpful, I love it.
To view references, or places where this method is called, click on the first section of the information just above the method name. It will provide you with a list where this method is called. Hover over the lines and it will display some context around the call. Double click on the line of code and you will be taken to that code where you can edit it as necessary. This feature is great on it’s own but combine with the other 2 sections (should you be using source control).
The second part of the CodeLens gives you a bit of a history lesson showing changes committed over time. You can see who made changes, when they made them and get a feel for how dynamic this particular method is. In the sample here we can see that no changes were made for more than a year then it was updated. It’s useful information that provides a time perspective.
The last section gives you a more exact list of changes and gives you a way of seeing exactly what changed, when it changed and who did the change. Tap the “Show all file changes” and see a complete history of this particular method. Double tap any of the lines shown and a “Compare” is shown of that particular commit against the current code. I can’t tell you how many times I use this feature, especially the first one while actively coding. If there are 0 references it also gives you a quick idea of what methods or properties are probably deprecated and no longer used.
Next Up – The Turn
Clearly Visual Studio is more than just the simple object dictated by “The Pledge” but we hope you see that it’s not magical (wink wink) in the sense of how we are applying the analogy today. VS is a great tool for creating Windows/Web applications.
My next post will demonstrate “The Turn” or a bit of magic if you like. How we can use Visual Studio to do more than you expect.
No comments:
Post a Comment