This was Techorama 2017

The last Microsoft focused conference I attended was the Techdays in 2008, almost 10 years ago. I heard good things about its successor, Techorama, so I decided to attend this year's edition. These are my notes and experiences of the sessions I attended.

Techorama 2017

Azure: the intelligent cloud by Scott Guthrie

I was late for the opening keynote by Scott Guthrie, I had to drop off the kids at school first. An ad for Azure was playing when I entered the room which gave me flashbacks to the Techdays where there was too much marketing talk and not enough real technical content. All things considered the talk really felt like a marketing talk. But some impressive new features of Azure were shown. I'm not a big fan of Azure, it's too much of a black box for me and doesn't always "just works". I find their pricing unclear, I've been looking into it to host some smaller projects but I never seem to find how much it will cost me in the end.

That being said, the features showcased were pretty impressive. SQL Server databases on Azure now come with performance suggestions. The SQL Database Advisor detects if your SQL database is running slow and it uses machine learning to suggest performance enhancements. In this presentation the advisor proposed possible indexes to speed up the database. Another cool feature was the SQL Database Thread Detection which detects certain hacking attempts on your database. The demo showcased a SQL injection attack which was detected by Azure and shown in the dashboard.

Next to Azure, Microsoft is betting on mobile development. With Xamarin Live you can now run and test your mobile app build with Xamarin by scanning a QR code with your smartphone. Very similar to what can be done with Expo for React Native.
The Visual Studio Mobile Center promises continuous integration and deployment for mobile apps. Not Windows Phone only, continuous integration and deployment for iOS and Android apps. Now this caught my attention, deploying to the App Store or even just Test Flight is painful it would be awesome to be able to automate it. There is also the possibility to test your app on all different kinds of devices. The platform has every possible iPhone and iOS combination. It does have some limitations, it is for example not possible to use the camera on the test device. These are not virtualizations, these are physical devices somewhere in a room at Microsoft connected to the network.

Mobile Center Test Run Devices

Reassuring was that the shift Microsoft has announced from Windows-only to offering their products and services on all platforms was visible throughout this whole session. Next to Microsoft SQL Server databases Azure offers PostgreSQL and MySQL as a service, unthinkable in the past. Next to these relational databases Microsoft's NoSQL Cosmos DB is also available on Azure.

If you're interested the entire session is online available: Azure - The Intelligent Cloud by Scott Guthrie.

Typescript - Beginner to advanced by Chander Dhall

This session started with an introduction to Typescript. It will add type checks to Javascript but the dynamic behavior of Javascript is kept. By adding types your code becomes more robust. Javascript allows passing any parameter you like to any function. This makes it flexible but also error prone. You might know what a given function takes as parameter but another developer will have trouble determining what data the function expects. On top of that Typescript adds features like array deconstruction, object deconstruction, classes, interfaces, nullables, default values for parameters. Some examples:

Array deconstruction

let list = [ 1, 2, 3, 4 ];
let [ first, second ] = list;
console.log(first, second); // 1, 2

let [ first, ...rest ] = lest;
console.log(rest); // 2, 3, 4

Object deconstruction

let iPhone = { id: 1, model: "5s plus" };
let { id, model } = iPhone;
console.log(id); // 1
console.log(model); // 5s plus

Nullables

function buildName(firstName: string, lastName?: string) {
    // ...
}

Default values for parameters

function buildName(firstName: string, lastName = "Smith") {
    // ...
}

Interfaces

The cool thing about interfaces in Typescript is that you can create an object of an interface without implementing it:

interface IProduct {
    id?: number,
    name: string
}

let p = <IProduct> {};

Further it was explained that interfaces lend themselves well to implement the Strategy pattern by using interfaces and lambda's. In case it's not clear what a lambda is, the speaker described it as:

A lambda is passing a function to another function

For loop

An important fact to remember when using for loops in Typescript is there is a difference between for ... in and for ... of;

let list = [4, 5, 6];

When using for ... in, i will be set to the index of the element:

for (let i in list) {
   console.log(i); // "0", "1", "2",
}

When using for ... of, i will be set to the value of the element:

for (let i of list) {
   console.log(i); // "4", "5", "6"
}

A webinar of this session can be viewed at Typescript Beginner to Advanced with Chander Dhall

REST the hard parts by Kevin Dockx

The description of this session:

REST is… a bit of a wonder really. It’s probably the most misused term for describing APIs, as most RESTful APIs that are called RESTful aren’t really RESTful. That’s because REST is an architectural style that isn’t that easy to correctly implement. In this advanced session, we’ll dive into the more challenging parts of REST: from using the correct media types (and why that’s so important) over handling collection resource creation in one go, handling pesky CalculateTotal()-RPC-like functions, method safety and idempotency, right up to implementing HATEOAS support. And we’ll do all of this using ASP.NET Core.

I have also been guilty of misusing REST and certainly calling a webservice RESTful when it wasn't RESTful. So I was eager to learn. First eye-opener for me was that RPC calls should be avoided. The given example was when retrieving a certain playlist you would have this resource:

localhost/playlists/{id}

Now let's say that you want the average rating of a certain playlist, you would be tempted to create this:

localhost/playlists/{id}/averagerating

This is an RPC call and at this point your API is no longer RESTful. To keep the API RESTtful, we can use a ratingaverages resource instead of an RPC call:

localhost/ratingaverages/{id}

When creating a REST API the call should be idempotent, which means that the methods can be called multiple times and they always give the same result.

HATEOAS

HATEAOS stands for Hypermedia As The Engine Of Application State. Wikipedia defines it as:

HATEOAS, an abbreviation for Hypermedia As The Engine Of Application State, is a constraint of the REST application architecture that distinguishes it from most other network application architectures. The principle is that a client interacts with a network application entirely through hypermedia provided dynamically by application servers. A REST client needs no prior knowledge about how to interact with any particular application or server beyond a generic understanding of hypermedia.

It comes down to whenever you make a call to a REST resource, next to sending back the found data it also returns the links to additional available methods for that given resource. This is the example from the Wikipedia page, it uses XML as response format:

GET /accounts/12345 HTTP/1.1
Host: bank.example.com
Accept: application/xml

This would be the response:

HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: ...

<?xml version="1.0"?>
<account>
   <account_number>12345</account_number>
   <balance currency="usd">100.00</balance>
   <link rel="deposit" href="https://bank.example.com/accounts/12345/deposit" />
   <link rel="withdraw" href="https://bank.example.com/accounts/12345/withdraw" /> 
   <link rel="transfer" href="https://bank.example.com/accounts/12345/transfer" />
   <link rel="close" href="https://bank.example.com/accounts/12345/close" />
 </account>

As you can see next to the data the resource also returns links with other possible actions: deposit, withdraw, transfer and close, that can be called on the resource.

Channel 9 has interviewed Kevin Dock on Techorama and he also posted the slides and code on his blog.

Microservices ... but not like that by Udi Dahan

When creating a software project you must realize that the people architecture, the way a company is organized, will be represented in the software. As Udi states it: the people architecture becomes your technical architecture. When you want to change your software architecture, split up a monolith application, you have to be aware in order to change the software architecture you also need the change the people architecture. Be cautious when splitting up a monolith using microservices that you are not just creating a distributed monolith.
A sample project on how to implement microservices is available on github.

When creating microservices you have to look beyond the level of a single screen or entity. Make use of microservices and microviews, and the set of tables should be isolated per microservice. This can be achieved by using an event-driven architecture. Always remember that it is not about microservices, it boils down to coupling and cohesion.

On a sidenote: it is scientifically proven that pair programming is the most cost effective method to discover bugs.

Secrets of SQL Server - Database Worst Practices by Pinal Dave

I wandered into the session and recognized Pinal Dave, the person who runs sqlauthority.com. I've found numerous solutions to problems I had on his blog. This was the most entertaining session there was at Techorama and on top I've learned some useful things.

NULL can cause some problems in your SQL query. For example, if you're using NOT IN and there is a NULL value in your data this will give unexpected results. You should use NOT EXISTS instead of NOT IN. It is more performant and does not have problems with NULL.

When using a left join in combination with a count statement be sure to always count a certain column: Count(o.orderid). Count(*) does not count all rows that are part of the result of the left join.

Datatype presedence

If you have a varchar column Refno and you have two where clauses:

where Refno = 555
where Refno = '555'

The first clause is significantly slower than the second, this is because for each row the Refno column is begin converted to an int. If we change the Refno column to an int, both queries are equally fast. This is unexpected, you would expect that the first clause would be faster after changing the type of the Refno column to int. This is because of datatype presedence, SQL server determines based on the datatype which values gets converted. In this case int has presedence over varchar so every value will be converted to int. As said when the Refno is of the varchar type every row's value is converted to int. When the Refno column is an int, only the '555' value is converted to an int. So both clause are equally fast, the conversion of only one value is negligible.

Some funny moments:

  • When the audience was asked to choose between two options, someone in the audience shouted: "It depends". Pinals answer: "It depends is for lazy people".
  • The truth of life: It's always about money

Devops on the Microsoft stack

Devops is the union of people, process and products to enable continuous delivery of value to our end users.

A common misconception is that everything should be automated. You should be careful with that mindset it's better to automate everything you can, not automate everything.

Microsoft has embraced devops and now offers tooling via Visual Studio Team Services to practice devops for any language and any platform. I'll be trying it out to run the Fake scripts I've created for our projects.

Another thing that caught my eye was SQL Server Data Tools which let's you put a database under source control.

Docker for .Net developers by Ben Hall

Windows Server Core will support Windows containers via Docker. Not just for .Net core projects, but also for older .Net 4.5 projects.

User Experience in IOT, from hardware to UI by Pieter-Paulus Vertongen

Some key takeaways:

  • Friction makes users change behavior. Create zero effort path for your users
  • Don't try to make the user understand your technology, try to understand the user goals.
  • Never just accept technical limitations
  • Turn errors into solutions. If the user encounters an error, try to propose a possible solution.

And remember: UX is not only for designers, UX design is a team effort!

User experience in IOT, from hardware to UI was livestreamed on Facebook

Conclusion

I loved how Techorama was a lot less marketing talk then what I'm used of a Microsoft conference. It was pretty clear that Microsoft is going further in the new direction it has set out by targeting all platforms with its services which can only be encouraged. These are the things I'm adding to my endless list of things to checkout:

  • Run Fake script with Visual Studio Team Services
  • Get started with Typescript
  • Implement the Strategy pattern with interfaces and lambda's in Typescript.
  • Check out the Particular microservices example
  • Continuous deploy an xcode project to the app store via Visual Studio Team Services
  • Check out SQL Server Data Tools to put a database under source control