Tuesday, October 29, 2013

First impressions of Visual Studio 2012 by an IntelliJ user

I'm back with Visual Studio which I haven't used since before the first version of .Net. I've been told VS12 is a great IDE, better than Xcode, Eclipse and even IntelliJ. These are my first impressions of "vanilla" Visual Studio, i.e. before installing ReSharper. Let's start with the good stuff. 

Note to self: Need to update this to VS13 now that I've installed it.

Nice features of VS12

  • VS builds on Visual Basic's ground breaking GUI builder. Delphi also had a great GUI builder (at least back in the days when I used it). Add a button, double-click, write code. This is something to dream about in Xcode.
  • The built-in webserver makes it easy to get going with MVC development. (In Java one would typically install Tomcat and then set it up within IntelliJ as an application server).
  • Page Inspector is an enhanced browser whose Inspect function will take you directly to the code that created the inspected part of the page.
And that's it. I'm done with the nice features. Now it's time for features that are...

Great Tools (photo by OZinOH)

Missing in VS12

  • There is no keyboard shortcut for Get Latest Version (Recursive). Unless of course you think pressing the following sequence of keys is an actual shortcut: Alt+V, P, Home, Menu, L.
  • And when you manage to get latest, there is no simple path to go the Changeset Details window. Viewing the latest changes is an important operation that should be part of Get Latest Version.
  • There is no keyboard shortcut for Compare with previous version. Also you cannot make one yourself since the api call is different for different windows, or even missing.
  • Call Hiearchy stops on interface methods. Hey, those get called too you know!  R# 
  • You can't create filterable todo categories. I will often use my own todo tag/token for stuff I need to implement, test or check later. I don't want to mix those todos with those of other team members.  R# 
  • Code Snippets are good, but where's the editor?  R# 
  • There is no Find Usages function. Yes, there is the Find Symbols (Shift+F12) but the result view has a bad layout showing the complete file path on every row. Also Find Symbols doesn't handle usages of the property name that exposes a member variable.  R# 
  • There is no syntax hightlighing for member variables.

Bad and/or Weird Stuff

  • The Options window contains hundreds of options but it isn't resizable! It stays small, showing only a few options at a time.  VS13 
  • You can't edit code without stopping execution (Break All). That would seem like logical restriction, but what about adding a comment - not possible! Also, Break All will navigate away from the source file where you wanted to make the edit, and take you the place where execution is taking place. Annoying.
  • Many common operations have double-stroke keyboard shortcuts, e.g. Show the solution explorer, Format document, and Show quick info.
  • The Find in files result window is badly formatted. For example, it shows the entire JQuery source code if a match is found within it.
  • View Call Hierarchy shortcut (Ctrl+K, Ctrl+T) doesn't work at all.
  • What is source code doing in the project root folder? It is a really weird thing to mix source files and other project files. Bad design choice.

Conclusion

I can't live without ReSharper.

Monday, June 24, 2013

JavaScript global variable declaration tidbits

To make a global variable in JavaScript, type:

var thisHereThing = {};

You could make it even simpler:

thisHereThing = {};

They are the same thing (pretty much).


Let's try a practical example, a namespace for your app:

var TC =  TC || {};

Of course you may simplify it to:

TC =  TC || {};

Ouch! No, it doesn't work. What is going on here?

What happens is this. The js runtime tries to evaluate the right hand side of the equals sign. It finds a non-existing variable, TC, and gives up. But then, why does it work in the first example that starts with var? It turns out var statements get interpreted before the normal program flow. When the evalution of the right hand side takes place, the TC variable already exists and has an Undefined value.

Even the following piece of code won't throw an exception, even though b is used before its declaration.

var a = b;
var b;

If you wanted to skip the var keyword there still is a way to do that:

TC = window.TC || {};

Global variables are properties of the window object. And properties get created when they are used. So that works as well.

Learning and using JavaScript feels like exploring uncharted territories a lot more than using Java or C# does. Sometimes I like exploring.

Monday, April 22, 2013

Learning from my work notes

As I read through my work notes from last week, I made a few interesting conclusions. As a little background I'm working on integrating a web based system and an access control smartcard system. To bridge the gap between web software and the smartcard reader hardware I'm using an old-style ActiveX component. The component is controlled via Javascript that also communicates with the server.

Week 16 Work Notes

Tuesday Apr 16
  • Testing ajax calls. Adding error handling when json parsing fails, or if there is a server exception, or an Ajax timeout.
  • Starting to work on the "activate card" function in js.
  • Adding a progress indicator to show we're in the middle of a ajax and/or cardreader operation.
  • Thinking through how to handle the removal of a card when we're in the middle of a transaction.
Wednesday Apr 17
  • Refactoring out all ajax calls into its own js-class.
  • Fixing progress indicator (which stackoverflowed in IE8)
  • Learning more about ActiveX exception handling when called from js.

Thursday Apr 18
  • Now catching and handling all js exception with window.onerror.
  • More testing of error and exception handling.
  • Adding error handling for when card is removed during transaction.
  • Testing and fixing validation of input fields.
  • Fixing ajax timeout error handling.
  • Thinking through card validity dates, and when a card is to be considered expired or empty.

Friday Apr 19
  • Formatting of date and time. Trying to replicate what goes on in Java.
  • Coding empty card recognition. Discover that a null end date means the card never expires. Have to change my if statements accordingly.
  • The name field from the card is full of \0000. Clean!
  • Enable/disable code for input fields is all wrong. Refactoring to methods into one that handles all cases.

32 hours

Summed up, I spent 32 hours working on the following:
  • UI: Error handling and input validation (Ajax, ActiveX, card data)
  • UI: Progress indicator
  • UI: Enabling/disabling of input fields depending on state
  • UI: Datetime formatting
  • Business code: Recognizing empty card put onto reader

Conclusion #1

I spent almost all time dealing with user interaction issues. Did I have to spend so much time with error handling and GUI stuff? I guess not. I could have skipped a lot of the error handling code and testing I wrote. I could have skipped the progress indicator. I could have trusted the user not to click buttons at the wrong moments. Basically I could have saved a lot of time.

But I didn't. Why? Because otherwise I would have ended up with a really low quality application. Software quality is all about user experience. This is conclusion #1:
  • You need to pay attention to detail and invest a lot of time into UX if you want to build high quality software that makes users productive (and happy?).

Conclusions #2 and #3

What if I were to estimate the time required for the tasks I completed during those four work days? Well, actually all of the tasks are sub tasks to just one user story:
  •  Activate Card: Make it possible to activate a new card and write name, access list, validity dates and amount to it.
In reality I estimated a bigger load of work that just this story, but what if I had estimated just this one story? How much extra time would I have added for the error handling and ux stuff? Maybe a work day, 8 hours. Why such a discrepancy to the outcome? I think for two reasons, conclusions #2 and #3:
  • No matter how much work experince you have it is just darn difficult to understand how many small tasks are needed to get a story done.
  • Your boss is not going to like it when you add four days to the schedule for just "error handling". And he's going to get the answer he wants.
That's all for now. :-)

Friday, January 18, 2013

Whats wrong with IoC and Spring?

My main concern with Spring and the Inversion of Control paradigm is that it encourages the separation of data from operations on the data. In the typical Spring project model classes carry the data and service classes contain operations on that data. So what's wrong with that? It breaks the best feature of Object Oriented software dev, the fact that the data "knows" what operations are available. As an IDE user you just need to press the magical dot which will give you a menu of methods to call. That is great because the knowledge of the programmer that created the class is now built-into the class itself. When the methods are moved into a separate service class the magical dot does not work any more. That is a big deal.

Does it have to be like this with IoC and Spring? I don't know yet. Since it's more or less impossible for an indenpendant Java consultant to avoid projects that uses Spring I'm reading Spring in Action. I've already read quite a bit on IoC but I thought I'd better learn some more practical struff. I will probably get back to this topic in the future.

Tuesday, November 27, 2012

Om konsultmäklare, konsultbolag och konsultsäljare

Jag som konsult är alltid ute efter ett spännande uppdrag där jag kan skapa mycket nytta och glädje för andra människor. När ett behov som matchar min kompetens uppstår vill jag maximera mina chanser att få uppdraget. Drömläget är att jag känner projektledaren och vi har jobbat tillsammans tidigare; saken är redan klar!

Om så inte är fallet behöver jag en bro mellan mig och konsultköparen. Som frilansare är jag fri att välja den säljare ( =eventuellt ett helt team med olika roller) som jag tror mest på. Dom bästa möjligheterna att få uppdraget får jag om säljaren känner både konsultköparen och mig personligen. På så sätt kan det bildas en stark bro av förtroende som kan leda till en affär.

Spana in konsultsäljaren längst upp på taket
Vanliga konsultbolag har en fördel gentemot mäklare: Säljarna har lättare att bygga en relation till sin konsult. Mäklarens stall är mer flyktigt och kräver en större insats att hålla koll på. Å andra sidan säljer konsultbolaget (nästan) bara sina egna konsulter. Mäklaren däremot har tillgång till alla frilansare och mindre konsultbolag.

Vad gäller relationen mellan säljare och konsult finns det olika grader av kompetensbedömning som mäklaren gör. Det finns mäklare som investerar mycket lite tid att värdera konsulten dom offererar. Kanske funkar deras affärsidé ändå pga en hög volym av potentiella uppdrag och många offereringar? Dessa mäklare hamnar såklart längst ner på listan för mig som konsult. Jag vill säljas som "filmstjärnan" och inte som en "statist". Faktum är att den säljare som mekaniskt matchar uppdragsbeskrivningar med konsultprofiler kan ersättas av.... en app!

Det finns även ett fall då även den bästa konsultsäljaren kan ersättas av en app, och det är när det finns så få tillgängliga konsulter som kan göra jobbet att köparen hinner intervjua allihop själv. Jag tror det finns en stor potential för kompetensrekryteringsmarknaden att effektiveras. För konsultköparnas skull hoppas jag också att dom snart upptäcker den där appen. I mitt tidigare inlägg broderar jag ut lite mer om denna (web-)app som jag där kallar LinkedIn för konsulter.

Friday, November 2, 2012

WyWallet har potential att lyckas

Jag har länge kliat mig i skallen och undrat varför kreditkort är det enda betalsystem som funkar förutom kontanter, både IRL och på nätet. Och med fungerar menar jag: Att systemet erbjuds som betalalternativ tillräckligt ofta för att man orkar bry sig om att skaffa konto. Men äntligen verkar det vara en ny guldrush mot nya (mikro-)betalsystem. Bankerna kommer med Swish. Teleoperatörerna har lanserat WyWallet. Förutom att kunna göra egna inköp är  jag är nyfiken på om något av dessa system kan vara en bra betalsystem för Sprend.

Idag har jag provkört WyWallet och det har inte varit lätt att göra. Det finns nämligen ingenstans man kan handla med sitt WyWallet-konto! Jo okej, sms-betalningar dras automatiskt från WyWallet-kontot i stället för mobilfakturan. WyWallet lovar att det så småningom också skall bli möjligt att betala i webbutiker, i mobil-appar och i fysiska affärer - med det går inte ännu. Därför har jag bara kunna provköra dom delar av appen som inte har med betalning att göra.

Slutsatsen av app-testet är att fyra stora rika teleoperatörer måste kunna mycket mycket bättre än så här. iPhone-appen är ett riktigt buggigt budget-bygge:
  • Appen kraschar gång på gång. Det händer speciellt ofta när man återvänder till appen efter en stund i en annan app.
  • Appen är slö som tusan. Det tar flera sekunder att växla mellan sidorna, vilket leder till feltryckningar.
  • Den ser inte ut som en iOS-app; jag gissar den är byggd i något crossplatform-verktyg.
  • Dom få texter som finns är inte ens korrekturlästa.
  • Vid påfyllning av kontot via kreditkort skickas man ut ur appen och in i Safari till ett flöde som inte är mobilanpassat.
WyWallets facebooksida kan man hitta flera inlägg som undrar varför man ersätter ett fungerade system, sms, med ett sämre, WyWallet-kontot.  Ja vänta lite, vi har ju redan sms. Funkar inte det? Jag tror ändå en app kan göra inköp enklare, och det finns inget som är viktigare än just enkelhet enligt min ödmjuka mening. Om jag förstår flödet korrekt så handlar man genom att:
  1. Ange sitt mobilnummer i ett webbformulär
  2. Mobilen säger pling-plong: Vill du köpa <x> från <y> till priset <z> kr?
  3. Du godkänner genom att knappa in din pinkod.
Är detta enklare än att knappa in ett nummer och en kod i sms-appen? Jag tror risken för misstag blir lägre i WyWallet-appen eftersom man redan kan sitt eget mobilnummer i huvudet (?), samt att WyWallet-appen anger vad man betalar för. Jag jag betalar via sms trippelcheckar jag alltid att numret och koden är rätt. Det skulle jag slippa med WyWallet.

Andra fördelar är en tydlig transaktionslista, och möjligheten att flytta pengar från mig till dig. Det kostar 1 kr vilket det definitivt är värt bara för att man kan spåra transaktionen.

En stor nackdel som även David Paulsson uppmärksammat är att det blir klurigt att betala med företagspengar. Varför kan man inte registera två konton i WyWallet-appen, ett privatkonto samt ett för företaget? När man genomför ett köp skulle man enkelt kunna välja vilket konto som köpet skall registreras på. Vid slutet av månaden skulle företaget man jobbar för få en komplett lista på alla inköp som gjorts. Ingen extra adminstration eller pappershantering. Lösningen som WyWallet erbjuder är att man loggar på sitt konto och väljer ut företagsinköpen, laddar ner en pdf som man sedan skickar till sin arbetsgivare för bokföring. Funkar, men är onödigt krångligt.

Jag tror WyWallet har en stor potential. Tjänsten har fördel gentemot Swish eftersom sms-betalningar redan är ett etablerat system. Kvaliteten måste dock höjas över hela linjen (PS. Jag är bra på att koda).

Tuesday, October 30, 2012

LinkedIn för konsulter

Jag fick nyligen en fråga i en LinkedIn-grupp vad jag saknade som frilansare på LinkedIn. Detta ämne har jag haft i tankarna under en längre tid. Här är mitt svar.


"Det som mest saknas [på LinkedIn] är möjligheten att ange följande egenskaper:
  1. Jag söker uppdrag (inte anställning)
  2. Jag ledig fr.o.m. detta datum
  3. Jag passar i fler än en roll. Konsultuppdragsprofiler är ofta nischade mot en viss roll. En person har ofta kompetens för flera roller.
Det viktiga är att egenskaperna är sökbara vilket skulle ge konsultköparen kommandot över rekryteringsprocessen.

Av olika skäl är konsultbranschen, även inom IT, synnerligen analog. Personliga kontakter är oerhörd viktiga, och det är gott så. Men ofta kan kedjan mellan projektledare till potentiell projektmedlem vara för lång. En tjänst, kanske LinkedIn, kanske en helt ny tjänst, skulle i vissa fall kunna kapa dessa led.

För att exemplifiera, säg att jag är projektledare för ett nytt projekt. Jag letar efter en  kompetent medarbetare som är a) ledig vid projektstart 2012-11-15, b) finns i Norrköping, c) är en skicklig yrkesman inom området mjukvarutest. Tänk nu om den sökningen ger vid handen att det finns tre stycken som matchar. Dessa tre kan jag ta in och intervjua själv.

Säg att det blir 30 träffar i stället. Då kan jag behöva hjälp och vänder mig till konsultföretag och mäklare som jag har förtroende för. Deras jobb blir att sovra och hitta de bästa. Kanske skickar jag med en länk till sökningen jag gjort i min förfrågan.

Kanske ser jag att konsultbolaget X har ett flertal passande kandidater direkt i min sökning. Lika bra att vända mig till dom direkt. Samma sak för konsultmäklare; mäklaren har ett stall med konsulter precis som ett konsultbolag med anställda.

LinkedIn skulle kunna bli tjänsten som digitaliserar den konservativa konsultbranschen. Det skulle också kunna vara en helt ny tjänst med fokus på konsulting och inte rekrytering som bröt ny mark."

Archive