Filip Ekberg's BlogFilip Ekberg's Bloghttps://www.filipekberg.se/2018-04-02T09:03:59ZFilip Ekberghttps://www.filipekberg.semail@filipekberg.seSandra.Snow Atom Generatorhttps://www.filipekberg.se/2018/04/02/csharp-smorgasbord-free/C# Smorgasbord is now Free<p>C# Smorgasbord was first published on July 30, 2012 and was the start of something that I certainly could not have anticipated. At the time I had barely started doing any public speaking at all, nor had I been around the world to lots of interesting conferences.</p> <p>What initially sparked the idea of writing a book, was when I applied for a job at Spotify, which I didn't get. Just like many others I've always had a hard time proving my skills during interviews, especially when having to code in notepad. As I felt sad having lost the opportunity to work for an extremely interesting company, something sparked inside me, I wanted to prove, not to others, but to myself that I was in fact pretty good at what I do.2018-04-02T00:00:00Z2018-04-02T00:00:00Z<p>C# Smorgasbord was first published on July 30, 2012 and was the start of something that I certainly could not have anticipated. At the time I had barely started doing any public speaking at all, nor had I been around the world to lots of interesting conferences.</p> <p>What initially sparked the idea of writing a book, was when I applied for a job at Spotify, which I didn't get. Just like many others I've always had a hard time proving my skills during interviews, especially when having to code in notepad. As I felt sad having lost the opportunity to work for an extremely interesting company, something sparked inside me, I wanted to prove, not to others, but to myself that I was in fact pretty good at what I do.<!--excerpt--> </p> <p>As I started to look over the material that I had already produced, and thinking about how I could best put this into a better format, the idea of a smorgasbord came into mind. I had a lot of different topics spread across different formats and being a Swede, it felt rather natural collecting lots of different things and serving it to your friends and family.</p> <p>I reached out to a few publishing companies and pitched my idea, a few of them liked it and wanted to proceed, but I finally decided: I want to do it all on my own. Which is why I decided to self-publish with CreateSpace (Amazon). I didn't really do it on my own though, I really couldn't have. I had so much great support not only from my beloved partner, Sofie, but from friends and family. I had countless of friends helping me with reviewing content and giving me great ideas. I had friends help me with graphics and covers and finally I had something ready to publish!</p> <p>After the book was published, I certainly felt a lot more confident. Having worked countless of hours, probably more than 1000-1500 hours on the book, I certainly felt like I had to continue spreading my knowledge. Which lead me into a lot more public speaking!</p> <p>I did mention that the book opened for a lot of opportunities, and it certainly did. Soon after having published the book, I had the pleasure to meet up with Pluralsight, as they coincidentally were in town for a conference. We started to chat about my book, and my goals, and soon thereafter I produced my first course: <a href="https://www.pluralsight.com/courses/msil-csharp-developer">MSIL for the C# Developer!</a></p> <p>Writing the book, producing courses for Pluralsight, doing a fair bit of public speaking got me the MVP Award, and when attending the first MVP Summit, I met a really nice fellow from a place called Readify in Australia, which lead me to apply for a job on the other side of the world. </p> <p>The rest is history.</p> <p>Being turned down from a job isn't always a bad thing, I certainly got loads of energy from it, after being sad for a while, which changed the course of my career.</p> <p>It's now almost 6 years since I published the book, and during these 6 years I've travelled the world, lived in a different continent, and I'm now the father of a beautiful daughter; my journey has just begun.</p> <p>To celebrate all the above, I'd like to give everyone C# Smorgasbord for free, <a href="https://www.amazon.com/C-Smorgasbord-Filip-Ekberg/dp/1468152106/">you can still purchase the paperback copy</a>, or buy me coffee if we're ever in the same city!</p> <h1>Download C# Smorgasbord</h1> <ul> <li><a href="https://cdn.filipekberg.se/fekberg-blog/csharp-smorgasbord-free/Filip_Ekberg-CSharp_Smorgasbord.pdf" target="_blank">C# Smorgasbord PDF (11MB)</a></li> <li><a href="https://cdn.filipekberg.se/fekberg-blog/csharp-smorgasbord-free/Filip_Ekberg-CSharp_Smorgasbord.epub" target="_blank">C# Smorgasbord EPUB (6MB)</a></li> <li><a href="https://cdn.filipekberg.se/fekberg-blog/csharp-smorgasbord-free/Filip_Ekberg-CSharp_Smorgasbord.mobi" target="_blank">C# Smorgasbord MOBI (10MB)</a></li> </ul> <p>Last but not least, thanks for all the support through the years, without friends from all over the world I'd never be where I am today. Thank you!!</p> https://www.filipekberg.se/2017/11/21/csharp-what-is-next/The State of C# - What Have I Missed?<p>One of the most popular programming language on the market is getting even better. With every iteration of C# we get more and more features that are meant to make our lives as developers a lot easier. Support for writing (hopefully) better and more readable asynchronous code, being able to do pattern matching, tuples, deconstruction and much more. These are just a few of the many additions to C# that we’ve seen lately.</p> <p>In this talk I go through how C# has changed, as well as focusing on what's coming in C# 7.1, 7.2, 8.0 and beyond!</p> <h3>The State of C# - What Have I Missed?</h3> <div class="video-container"> <iframe src="https://player.vimeo.com/video/243227675?color=ffffff" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe> <p><a href="https://vimeo.com/243227675">&Oslash;redev 2017 - Filip Ekberg - The State of C# - What Have I Missed?</a> from <a href="https://vimeo.com/oredev">&Oslash;redev Conference</a> on <a href="https://vimeo.com">Vimeo</a>.</p> </div> <p><a href="https://github.com/fekberg/What-is-New-in-CSharp">Code samples are available on Github.</a></p> <p>If you have any questions, or feedback please feel free to leave a comment, send an e-mail or just ping me on twitter!</p> 2017-11-21T00:00:00Z2017-11-21T00:00:00Z<p>One of the most popular programming language on the market is getting even better. With every iteration of C# we get more and more features that are meant to make our lives as developers a lot easier. Support for writing (hopefully) better and more readable asynchronous code, being able to do pattern matching, tuples, deconstruction and much more. These are just a few of the many additions to C# that we’ve seen lately.</p> <p>In this talk I go through how C# has changed, as well as focusing on what's coming in C# 7.1, 7.2, 8.0 and beyond!</p> <h3>The State of C# - What Have I Missed?</h3> <div class="video-container"> <iframe src="https://player.vimeo.com/video/243227675?color=ffffff" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe> <p><a href="https://vimeo.com/243227675">&Oslash;redev 2017 - Filip Ekberg - The State of C# - What Have I Missed?</a> from <a href="https://vimeo.com/oredev">&Oslash;redev Conference</a> on <a href="https://vimeo.com">Vimeo</a>.</p> </div> <p><a href="https://github.com/fekberg/What-is-New-in-CSharp">Code samples are available on Github.</a></p> <p>If you have any questions, or feedback please feel free to leave a comment, send an e-mail or just ping me on twitter!</p> https://www.filipekberg.se/2017/04/10/xamarin-mobile-development/Play by Play: Xamarin Mobile Development<p><img src="https://cdn.filipekberg.se/fekberg-blog/xamarin-mobile-development/filip_ekberg_recording_play_by_play_pluralsight.jpg" /></p> <p>During my visit to NDC London, where I talked about Asynchronous Programming, I also got a chance to record a <a href="https://www.pluralsight.com/courses/play-by-play-xamarin-mobile-development">Play by Play</a> with <strong><a href="https://larsklint.com/">Lars Klint!</a></strong> The course we recorded gives you an introduction to what it's like to build <strong>native</strong> mobile applications in .NET, using Xamarin!2017-04-10T00:00:00Z2017-04-10T00:00:00Z<p><img src="https://cdn.filipekberg.se/fekberg-blog/xamarin-mobile-development/filip_ekberg_recording_play_by_play_pluralsight.jpg" /></p> <p>During my visit to NDC London, where I talked about Asynchronous Programming, I also got a chance to record a <a href="https://www.pluralsight.com/courses/play-by-play-xamarin-mobile-development">Play by Play</a> with <strong><a href="https://larsklint.com/">Lars Klint!</a></strong> The course we recorded gives you an introduction to what it's like to build <strong>native</strong> mobile applications in .NET, using Xamarin!<!--excerpt--> </p> <p>I've been working with some really interesting projects using Xamarin, the last few years, and this technology is just getting better and better with every release. If you're keen to get started shipping amazing apps, I suggest you start by watching the <a href="https://www.pluralsight.com/courses/play-by-play-xamarin-mobile-development">Play by Play</a>. If you're already comfortable with the fundamentals of Xamarin, there are plenty of other great courses on Pluralsight that covers more in-depth topics.</p> <h3>Play by Play: Xamarin Mobile Development</h3> <div class="video-container"> <iframe src="https://app.pluralsight.com/player?author=lars-klint&name=play-by-play-xamarin-mobile-development-m0&mode=live&clip=0&course=play-by-play-xamarin-mobile-development" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe> </div> <p><a href="https://www.pluralsight.com/courses/play-by-play-xamarin-mobile-development">Click here to go to the course on Pluralsight.</a></p> <p>If you have any questions, or feedback please feel free to leave a comment, send an e-mail or just ping me on twitter!</p> https://www.filipekberg.se/2016/11/11/async-xamarin-talks-from-oredev/Async and Xamarin Talks from Øredev<p>I was honored, to be invited to my first Øredev conference, to speak about two topics that I am very much passionate about. If you've never been to this conference, I can highly recommend checking it out next year. Lots of good talks, conversations and the atmosphere was awesome!2016-11-11T00:00:00Z2016-11-11T00:00:00Z<p>I was honored, to be invited to my first Øredev conference, to speak about two topics that I am very much passionate about. If you've never been to this conference, I can highly recommend checking it out next year. Lots of good talks, conversations and the atmosphere was awesome!<!--excerpt--> Below are the two talks I gave at the conference, it probably won't come as a surprise that their about Xamarin and Asynchronous Programming!</p> <h3>Back to Basics: Efficient Async and Await</h3> <div class="video-container"> <iframe src="https://player.vimeo.com/video/191077931" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe> <p><a href="https://vimeo.com/191077931">Back to Basics: Efficient Async and Await</a> from <a href="https://vimeo.com/user4280938">&Oslash;redev Conference</a> on <a href="https://vimeo.com">Vimeo</a>.</p> </div> <h3>Busting the Myths with Cross-Platform Xamarin</h3> <div class="video-container"> <iframe src="https://player.vimeo.com/video/190938585" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe> <p><a href="https://vimeo.com/190938585">Busting the Myths with Cross-Platform Xamarin</a> from <a href="https://vimeo.com/user4280938">&Oslash;redev Conference</a> on <a href="https://vimeo.com">Vimeo</a>.</p> </div> <p>If you have any questions, or feedback please feel free to leave a comment, send an e-mail or just ping me on twitter!</p> https://www.filipekberg.se/2016/04/12/oauth-secure-asp-dot-net-api/Using OAuth to Secure Your ASP.NET API<p>I'm very excited and proud to announce that my latest course is now live on Pluralsight! This course gives you an introduction to OAuth, OpenId Connect, IdentityServer, and ultimately, how to secure your ASP.NET APIs. I really hope you enjoy the course "<a href="https://www.pluralsight.com/courses/oauth-secure-asp-dot-net-api">Using OAuth to Secure Your ASP.NET API</a>"2016-04-12T00:00:00Z2016-04-12T00:00:00Z<p>I'm very excited and proud to announce that my latest course is now live on Pluralsight! This course gives you an introduction to OAuth, OpenId Connect, IdentityServer, and ultimately, how to secure your ASP.NET APIs. I really hope you enjoy the course "<a href="https://www.pluralsight.com/courses/oauth-secure-asp-dot-net-api">Using OAuth to Secure Your ASP.NET API</a>"<!--excerpt--></p> <p>The course covers:</p> <ul> <li>How to build secure ASP.NET APIs</li> <li>Understanding OAuth, OpenId Connect and IdentityServer</li> <li>Get an understanding of different OAuth Flows</li> <li>How to work with and customize IdentityServer</li> </ul> <p><strong><a href="https://www.pluralsight.com/courses/oauth-secure-asp-dot-net-api">Click here to watch my course!</a></strong></p> <p><strong>Don't have a Pluralsight account?</strong></p> <p>No need to worry! Pluralsight offers a 10 day free trial, sign up, check out my course and let me know if you like it!</p> https://www.filipekberg.se/2016/03/02/farewell-australia-moving-to-sweden/Farewell Australia! Moving Back to Sweden<p>After almost three years in Australia, we have decided to move back to Sweden. This has probably been one of the toughest decisions we've had to make, yet. Me and Sofie both have really good jobs, awesome co-workers, a life filled with diving and wonderful weather pretty much 70% of the year. Why would we leave this paradise? It's too far to pretty much anything, especially our family back in Sweden. It came to a point where we either decided to stay forever, and spend our 4 weeks vacation to stress through Europe each year to see our family, or move back and spend our vacation and weekends traveling new places.</p> <p>What now? After Easter, we're back in Europe and I'm going to run my own business, as a consultant/contractor. I've wanted to run a full time consulting business for a long time, and I finally have the guts to do it. Hopefully it all works out!</p> <p>We are certainly going to miss Australia, a lot. Anyone that's been here knows how friendly the people are and how welcome you feel everywhere. It will certainly be a culture shock moving back to Sweden, just as it was moving to Australia. This place will always have a special place in my heart, and I've made so many friends for life here so it's certainly not going to take long before we travel back (for a visit!).</p> <p>Australia, thank you for these wonderful years, we've grown heaps and learnt so much. It's been an amazing journey, and the tech scene has been so inviting and friendly.</p> <p>It's scary just letting go and pursue something unknown, but at the same time very exciting. Very much looking forward to catching up with friends all over Europe!</p> 2016-03-02T00:00:00Z2016-03-02T00:00:00Z<p>After almost three years in Australia, we have decided to move back to Sweden. This has probably been one of the toughest decisions we've had to make, yet. Me and Sofie both have really good jobs, awesome co-workers, a life filled with diving and wonderful weather pretty much 70% of the year. Why would we leave this paradise? It's too far to pretty much anything, especially our family back in Sweden. It came to a point where we either decided to stay forever, and spend our 4 weeks vacation to stress through Europe each year to see our family, or move back and spend our vacation and weekends traveling new places.</p> <p>What now? After Easter, we're back in Europe and I'm going to run my own business, as a consultant/contractor. I've wanted to run a full time consulting business for a long time, and I finally have the guts to do it. Hopefully it all works out!</p> <p>We are certainly going to miss Australia, a lot. Anyone that's been here knows how friendly the people are and how welcome you feel everywhere. It will certainly be a culture shock moving back to Sweden, just as it was moving to Australia. This place will always have a special place in my heart, and I've made so many friends for life here so it's certainly not going to take long before we travel back (for a visit!).</p> <p>Australia, thank you for these wonderful years, we've grown heaps and learnt so much. It's been an amazing journey, and the tech scene has been so inviting and friendly.</p> <p>It's scary just letting go and pursue something unknown, but at the same time very exciting. Very much looking forward to catching up with friends all over Europe!</p> https://www.filipekberg.se/2015/11/05/mastering-csharp/Mastering C#<p>In 2013, I published my first Pluralsight course; <a href="http://www.pluralsight.com/courses/msil-csharp-developer">MSIL for the C# Developer</a>. The aim of this course was to teach you about how a compiler looks at your C# code, and translates that into something else. Understanding the internals of how C# is translated into IL is a good way to master C#. If you're building a car, knowing what an engine looks like on the inside will most certainly make you a better mechanic; although you'll get a long way without it as well.2015-11-05T00:00:00Z2015-11-05T00:00:00Z<p>In 2013, I published my first Pluralsight course; <a href="http://www.pluralsight.com/courses/msil-csharp-developer">MSIL for the C# Developer</a>. The aim of this course was to teach you about how a compiler looks at your C# code, and translates that into something else. Understanding the internals of how C# is translated into IL is a good way to master C#. If you're building a car, knowing what an engine looks like on the inside will most certainly make you a better mechanic; although you'll get a long way without it as well.<!--excerpt--> </p> <p>If you are building high performance applications, or when optimizing your applications for IoT, knowing what penalties are applied to your code when introducing certain keywords will really help you build faster and more solid applications.</p> <p>While writing IL by hand is probably not something you will do very often, being able to read through it and understand the behavior of an application will make you a better C# developer.</p> <p>Of course, a really good C# applications follows best practices and patterns to help you along the way. One of the really hot topics over the years have been how to add logging to applications. It's better to find a problem and fix it before it reaches the customer. Over the years I think a lot of us have been writing our own systems for this, for instance systems that do: database logging, file logging, event logging. Why re-invent the wheel? Mastering C# is not only about mastering the language. It's about learning how to master your tooling, what packages, patterns and practices make the most sense in your current situation and how to tie it all together.</p> <p>This is why earlier this year, 2015, I published a course on <a href="http://www.pluralsight.com/courses/raygun-dotnet-getting-started">Getting Started with Raygun in .NET</a>. This tool does not only give you the capability to track errors and allow you to configure this to your specific needs, it also provides you with a top of the line interface to track down and understand your errors. It may seem like a simple task to just store a blob with error details and when there's an issue, you simply go and look at that blob. Although, I'd certainly argue that proper error reporting is something that should be one of the first things you add to your applications; because finding bugs before your customers do is priceless.</p> <p>As hinted with my first course, I personally think it's very important to understand the implications of keywords and practices. Naturally, my next course continues to help you master your C# skills by teaching you everything you need to <a href="http://www.pluralsight.com/courses/asynchronous-programming-dotnet-getting-started">get started with asynchronous programming in C#</a>. While adding the <code>async</code> and <code>await</code> keywords may seem trivial, I can ensure you that it certainly is not.</p> <p>All to often, someone tells me that they don't understand why their application seem to be loading forever. I'm sorry to break it to you, but you've got a deadlock. Want to know why? It'll take a little while to explain this, which is why understanding the implications of adding the <code>async</code> keyword to your method is a really important step towards mastering C#.</p> <p>Is this all you need to master C#? No, certainly not. It's a good step in the right direction: learn about what the compiled code looks like, learn how to analyze it, learn how to properly track errors in your applications and finally understand how to do proper asynchronous programming which is becoming more and more important. All of this will give you a good boost towards really mastering C#.</p> <p>If video courses is not your thing, I'd recommend checking out my book <a href="https://books.filipekberg.se/">C# Smorgasbord</a>. It's available as hard cover, PDF and kindle.</p> <p>So what's next? I'd really love to hear about your ideas on what you want to learn next!</p> <p><strong>Here's a list of my courses on Pluralsight to date:</strong></p> <ul> <li><a href="http://www.pluralsight.com/courses/asynchronous-programming-dotnet-getting-started">Getting Started with Asynchronous Programming in .NET</a></li> <li><a href="http://www.pluralsight.com/courses/raygun-dotnet-getting-started">Getting Started with Raygun in .NET</a></li> <li><a href="http://www.pluralsight.com/courses/msil-csharp-developer">MSIL for the C# Developer</a></li> <li><a href="http://www.pluralsight.com/courses/game-programming-python-pygame">Game Programming with Python and PyGame</a></li> </ul> <p>Why did I do a Game Programming course in Python? It's a really good next step after learning programming fundamentals, and creating a game is super fun!</p> <p>Enjoy watching my courses, I hope it helps you along the way to learn more about programming!</p> https://www.filipekberg.se/2015/08/14/asynchronous-programming-dotnet-getting-started/Getting Started with Asynchronous Programming in .NET<p><img src="https://cdn.filipekberg.se/fekberg-blog/asynchronous-programming-dotnet-getting-started/i_love_async.png" style="float: right; width: 270px; margin-left: 10px;"/>I am very happy to announce that my Pluralsight course covering <a href="http://www.pluralsight.com/courses/asynchronous-programming-dotnet-getting-started">Asynchronous Programming in .NET</a> is now available! In this course, we will cover the way to get started with asynchronous programming in .NET. You will learn how to apply these patterns in new and existing applications and you will see how to avoid the common mistakes.2015-08-14T00:00:00Z2015-08-14T00:00:00Z<p><img src="https://cdn.filipekberg.se/fekberg-blog/asynchronous-programming-dotnet-getting-started/i_love_async.png" style="float: right; width: 270px; margin-left: 10px;"/>I am very happy to announce that my Pluralsight course covering <a href="http://www.pluralsight.com/courses/asynchronous-programming-dotnet-getting-started">Asynchronous Programming in .NET</a> is now available! In this course, we will cover the way to get started with asynchronous programming in .NET. You will learn how to apply these patterns in new and existing applications and you will see how to avoid the common mistakes.<!--excerpt--> </p> <p>I do hope you enjoy the course "<a href="http://www.pluralsight.com/courses/asynchronous-programming-dotnet-getting-started">Getting Started with Asynchronous Programming in .NET</a>" and that it helps you along the way to successfully adapt asynchronous programming in your .NET applications!</p> <p>The course covers:</p> <ul> <li>Understanding the Need for Asynchronous Code</li> <li>Applying Asynchronous Programming in .NET</li> <li>Deadlocking, State Machines, and What Really Goes On</li> </ul> <p><strong><a href="http://www.pluralsight.com/courses/asynchronous-programming-dotnet-getting-started">Click here to watch my course!</a></strong></p> <p><strong>Don't have a Pluralsight account?</strong></p> <p>No need to worry! Pluralsight offers a 10 day free trial, sign up, check out my course and let me know if you like it!</p> <p><img src="https://cdn.filipekberg.se/fekberg-blog/asynchronous-programming-dotnet-getting-started/ access_pass.png" style="float: right; margin-left: 10px;"/><strong>Win a 30 day UNLIMITED Access Pass!</strong><br><br>I've got a handful of 30 day UNLIMITED Access Passes, if you want to win one, please leave a comment below and share some of your war stories when it comes to Asynchronous Programming!</p> https://www.filipekberg.se/2015/07/21/no-more-deadlocks-ssw-tv/No More Deadlocks - SSW TV<p>Asynchronous programming can be very difficult, and if done incorrectly it can cause devastating results in your applications!In this talk I introduce asynchronous programming in .NET and talk about a few gotchas that will be handy along the way. I'd also like to take this opportunity to announce that I'm working on my next Pluralsight course that will talk about Asynchronous Programming in .NET. It is definitely an important subject and I hope you'll enjoy both my coming course, and the below presentation.2015-07-21T21:00:00Z2015-07-21T21:00:00Z<p>Asynchronous programming can be very difficult, and if done incorrectly it can cause devastating results in your applications!In this talk I introduce asynchronous programming in .NET and talk about a few gotchas that will be handy along the way. I'd also like to take this opportunity to announce that I'm working on my next Pluralsight course that will talk about Asynchronous Programming in .NET. It is definitely an important subject and I hope you'll enjoy both my coming course, and the below presentation.<!--excerpt--> </p> <div class="video-container"> <iframe width="640" height="360" src="//www.youtube.com/embed/uDNFfzizfTU" frameborder="0" allowfullscreen></iframe> </div> <p><strong>Slides available below on Slideshare</strong></p> <div class="video-container"> <iframe src="//www.slideshare.net/slideshow/embed_code/key/eZOzUpudXH9GEF" width="425" height="355" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" style="border:1px solid #CCC; border-width:1px; margin-bottom:5px; max-width: 100%;" allowfullscreen> </iframe> <div style="margin-bottom:5px"> <strong> <a href="https://www.filipekberg.se/www.slideshare.net/fekberg1/no-more-deadlocks-asynchronous-programming-in-net" title="No More Deadlocks; Asynchronous Programming in .NET" target="_blank">No More Deadlocks; Asynchronous Programming in .NET</a> </strong> from <strong><a href="https://www.filipekberg.se/www.slideshare.net/fekberg1" target="_blank">Filip Ekberg</a></strong> </div> </div> <p>Remember, <code>async void</code> is evil and you should never block because it seems like the easy way to solve your current task. After watching the presentation, I hope you appreciate the joke I made in the below tweet!</p> <blockquote class="twitter-tweet" lang="en"><p lang="en" dir="ltr">I&#39;m going to write a VS plugin and distribute to my team: every time they block a task, this comment will appear! <a href="http://t.co/RoQ2bpGArL">pic.twitter.com/RoQ2bpGArL</a></p>&mdash; Filip Ekberg (@fekberg) <a href="https://twitter.com/fekberg/status/623392361163304964">July 21, 2015</a></blockquote> <script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script> https://www.filipekberg.se/2015/07/20/chsarp-is-the-future-ssw-tv/C# Is The Future - SSW TV<p>Over the past year I've done a few talks on C# 6.0 and the changes that we can expect from the next version of C#. Interestingly enough, each time I've done this talk a bunch of things have changed. Features have been added, features have been put on-hold and most importantly more people have joined the <a href="https://github.com/dotnet/roslyn/issues/2136">discussions on Github</a>.</p> <p>I was invited to speak at the Sydney and Canberra .NET User Groups where I talked about how C# is truly a relevant programming language of the future. It's time to embrace it!2015-07-20T00:00:00Z2015-07-20T00:00:00Z<p>Over the past year I've done a few talks on C# 6.0 and the changes that we can expect from the next version of C#. Interestingly enough, each time I've done this talk a bunch of things have changed. Features have been added, features have been put on-hold and most importantly more people have joined the <a href="https://github.com/dotnet/roslyn/issues/2136">discussions on Github</a>.</p> <p>I was invited to speak at the Sydney and Canberra .NET User Groups where I talked about how C# is truly a relevant programming language of the future. It's time to embrace it!<!--excerpt--></p> <div class="video-container"> <iframe width="640" height="360" src="//www.youtube.com/embed/UhUnczySjC8" frameborder="0" allowfullscreen></iframe> </div> <p><strong>Slides available below on Slideshare</strong></p> <div class="video-container"> <iframe src="//www.slideshare.net/slideshow/embed_code/key/EaR9bukr9XXh3u" width="425" height="355" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" style="border:1px solid #CCC; border-width:1px; margin-bottom:5px; max-width: 100%;" allowfullscreen> </iframe> <div style="margin-bottom:5px"> <strong> <a href="https://www.filipekberg.se/www.slideshare.net/fekberg1/filip-ekberg-csharpisthefuture" title="C# Is The Future" target="_blank">C# Is The Future</a> </strong> from <strong><a href="https://www.filipekberg.se/www.slideshare.net/fekberg1" target="_blank">Filip Ekberg</a></strong> </div> </div> <p>Let me know which feature you like the most in C# 6.0 and potentially C# 7.0!</p> https://www.filipekberg.se/2015/07/10/microsoft-azure-traffic-manager/Microsoft Azure Traffic Manager<p>Yesterday I was notified on Twitter that the RSS feed for my blog included draft posts. Which is not really ideal since it will contain articles that aren't really ready. I have previously written about how I moved to <a href="https://www.filipekberg.se/2014/05/21/goodbye-wordpress-hello-snow/">Sandra.Snow from Wordpress</a> and how much I really enjoy this transition. One of the biggest benefits is that it is open source, this means fixing this bug was rather easy and quick.</p> <p>Albeit the fix might have been easy and quick, I did run in to some issues with my automatic deployment. Every time I check something in to the git repository, Azure will notice this and start deploying my website. Little did I know that there was another bug, unrelated to the RSS feed getting my drafts, in my deployment script. Luckily for me, I got Microsoft Azure Traffic Manager running on-top of my blog, which means that I load balance between different zones. </p> <p>The load balancer is configured to run in performance mode so that visitors in US are transferred to the US West location. Meanwhile, EU visitors are transitioned to the EU location and Asia to the Southeast Asia location.</p> <p>To avoid down-time, I had two options when fiddling around with the fix for the bug.</p> <ol> <li><strong>Clone the Website</strong> in one of the locations and setup a staging like environment</li> <li><strong>Disable one of the locations</strong> in the load balancer and use that as a staging environment</li> </ol> <p>Obviously the second option would be cheaper, but it does come at a price: users from that location will experience longer load times.2015-07-10T00:00:00Z2015-07-10T00:00:00Z<p>Yesterday I was notified on Twitter that the RSS feed for my blog included draft posts. Which is not really ideal since it will contain articles that aren't really ready. I have previously written about how I moved to <a href="https://www.filipekberg.se/2014/05/21/goodbye-wordpress-hello-snow/">Sandra.Snow from Wordpress</a> and how much I really enjoy this transition. One of the biggest benefits is that it is open source, this means fixing this bug was rather easy and quick.</p> <p>Albeit the fix might have been easy and quick, I did run in to some issues with my automatic deployment. Every time I check something in to the git repository, Azure will notice this and start deploying my website. Little did I know that there was another bug, unrelated to the RSS feed getting my drafts, in my deployment script. Luckily for me, I got Microsoft Azure Traffic Manager running on-top of my blog, which means that I load balance between different zones. </p> <p>The load balancer is configured to run in performance mode so that visitors in US are transferred to the US West location. Meanwhile, EU visitors are transitioned to the EU location and Asia to the Southeast Asia location.</p> <p>To avoid down-time, I had two options when fiddling around with the fix for the bug.</p> <ol> <li><strong>Clone the Website</strong> in one of the locations and setup a staging like environment</li> <li><strong>Disable one of the locations</strong> in the load balancer and use that as a staging environment</li> </ol> <p>Obviously the second option would be cheaper, but it does come at a price: users from that location will experience longer load times.<!--excerpt--></p> <p><img src="https://cdn.filipekberg.se/fekberg-blog/microsoft-azure-traffic-manager/fekberg-websites.png"/></p> <p>As mentioned above, I have the site running in three different locations: West US, North Europe and Southeast Asia. When doing the testing, I could simply go into the sites that I did not want to affect with my testing, and disable the automatic deployments for now.</p> <p>The beauty is that I can hit the websites using a handful of different URLs, externally you will visit this blog on <a href="https://www.filipekberg.se">www.filipekberg.se</a>, but it's also setup to listen at:</p> <ul> <li>filipekberg.se</li> <li>blog.filipekberg.se (legacy)</li> <li>fekberg.trafficmanager.net (azure traffic manager)</li> </ul> <p>And the region specific endpoints:</p> <ul> <li>fekberg.azurewebsites.net (West US)</li> <li>fekberg-sea.azurewebsites.net (Southeast Asia)</li> <li>fekberg-eu.azurewebsites.net (Europe)</li> </ul> <p>The Microsoft Azure Traffic Manager itself is super easy to setup, simply create a new one and choose the websites you want included. One gotcha though, you cannot setup a traffic manager with the Free, Shared or Basic plans. Your website needs to run on the Standard plan.</p> <p><img src="https://cdn.filipekberg.se/fekberg-blog/microsoft-azure-traffic-manager/fekberg-traffic-manager.png"/></p> <p>I decided to turn off the West US location, I probably could have used Southeast Asia instead since that is most likely closer to where I am. Either way, enabling and disabling the endpoints is as easy as just clicking <code>Disable</code> or <code>Enable</code> for the highlighted endpoint.</p> <p><img src="https://cdn.filipekberg.se/fekberg-blog/microsoft-azure-traffic-manager/fekberg-disabled-endpoint.png"/></p> <p>This meant that readers hitting <a href="https://www.filipekberg.se">www.filipekberg.se</a> would get transferred to the Europe or Southeast Asia locations, meanwhile I could work on the West US site and make sure everything worked accordingly. This workflow gave readers 0 downtime and let me run tests on one of the real sites. Sometimes it may be hard completely replicating production and it may take longer doing so rather than just "cheating" like this.</p> <p>Doing it like this certainly saved me time, and it was a bit more fun than setting up a new environment! <a href="https://github.com/Sandra/Sandra.Snow/pull/139">Of course, I also got the chance to submit a PR to Sandra.Snow!</a></p> https://www.filipekberg.se/2015/05/28/csharp-is-the-future/C# Is The Future<p>C# is as relevant as always and is definitely something you want to learn! In this talk I did at <a href="http://www.anzcoders.com/">ANZ Coders</a>, I talk about how C# has changed through history, what it potentially could get in the future and why you want to embrace this lovely programming language.</p> <p>The point is of course not to alienate any other programming languages, C#, Python, Ruby, JavaScript, F# and many others will be as relevant as they are today in the future. If you take one thing away from this session it should be that C# is living, and it is growing fast. Embrace the future!</p> <div class="video-container"> <iframe width="640" height="360" src="//www.youtube.com/embed/-UMvYWiQJyA" frameborder="0" allowfullscreen></iframe> </div> <p>Let me know if this was helpful!</p> 2015-05-28T00:00:00Z2015-05-28T00:00:00Z<p>C# is as relevant as always and is definitely something you want to learn! In this talk I did at <a href="http://www.anzcoders.com/">ANZ Coders</a>, I talk about how C# has changed through history, what it potentially could get in the future and why you want to embrace this lovely programming language.</p> <p>The point is of course not to alienate any other programming languages, C#, Python, Ruby, JavaScript, F# and many others will be as relevant as they are today in the future. If you take one thing away from this session it should be that C# is living, and it is growing fast. Embrace the future!</p> <div class="video-container"> <iframe width="640" height="360" src="//www.youtube.com/embed/-UMvYWiQJyA" frameborder="0" allowfullscreen></iframe> </div> <p>Let me know if this was helpful!</p> https://www.filipekberg.se/2015/04/20/joining-invoice2go/Joining Invoice2go<p><a href="https://www.invoice2go.com" target="__blank"><img src="http://upload.wikimedia.org/wikipedia/commons/c/cb/Invoice2go_logo.jpg" alt="" style="float: right; margin-left: 15px; margin-bottom: 10px; width: 250px;"></a>As of next week I'm joining Invoice2go as a Senior Software Engineer! For the past 1 year and 8 months I've worked with some of the best people in my career at Readify. I'm truly grateful for the opportunity to move to Australia and work with these amazing people!<br/><br/>For the past 10 years I've worked as a consultant in some way or another and it's been a great journey! I'm super excited to step into a product company and face some really exciting challenges.<br/><br/>Working for Readify has given me a lot of confidence and opportunities to work on myself, which I am eternally grateful for. When moving to Australia I had never done any public speaking in English and it's been exciting to get better and better at this over time. Joining Invoice2go means I will still be living and working in Australia, which is great, the development community here is so friendly and exciting!</p> <p>I would really like to thank everyone that has attended my sessions, watched my courses, read my book or visited this blog; you are all the reason I love doing what I do. Without your support, I would never have moved to Australia and I would never have had the opportunity to work with these great companies!</p> <p><strong>My adventure at <a href="https://www.invoice2go.com" target="__blank">Invoice2Go</a> starts next week and I am super excited!</strong></p> 2015-04-20T00:00:00Z2015-04-20T00:00:00Z<p><a href="https://www.invoice2go.com" target="__blank"><img src="http://upload.wikimedia.org/wikipedia/commons/c/cb/Invoice2go_logo.jpg" alt="" style="float: right; margin-left: 15px; margin-bottom: 10px; width: 250px;"></a>As of next week I'm joining Invoice2go as a Senior Software Engineer! For the past 1 year and 8 months I've worked with some of the best people in my career at Readify. I'm truly grateful for the opportunity to move to Australia and work with these amazing people!<br/><br/>For the past 10 years I've worked as a consultant in some way or another and it's been a great journey! I'm super excited to step into a product company and face some really exciting challenges.<br/><br/>Working for Readify has given me a lot of confidence and opportunities to work on myself, which I am eternally grateful for. When moving to Australia I had never done any public speaking in English and it's been exciting to get better and better at this over time. Joining Invoice2go means I will still be living and working in Australia, which is great, the development community here is so friendly and exciting!</p> <p>I would really like to thank everyone that has attended my sessions, watched my courses, read my book or visited this blog; you are all the reason I love doing what I do. Without your support, I would never have moved to Australia and I would never have had the opportunity to work with these great companies!</p> <p><strong>My adventure at <a href="https://www.invoice2go.com" target="__blank">Invoice2Go</a> starts next week and I am super excited!</strong></p> https://www.filipekberg.se/2015/03/26/getting-started-with-raygun-in-dotnet-now-on-pluralsight/Getting Started with Raygun in .NET now on Pluralsight<p><img src="https://raygun.io/images/robots/homeRobot_right.png" alt="" style="float: right; margin-left: 10px; width: 60px;">I am very excited to announce that my latest course is now available on Pluralsight! This time I talk about the importance of tracking errors and how to easily track errors using Raygun!<br><br>Exactly two years ago, on this very day, <a href="https://www.filipekberg.se/2013/03/26/easy-error-tracking-in-your-applications/">I published an article</a> on how to easily add error tracking to your applications using Raygun! Now I am very excited to announce this course on Pluralsight that covers the usage of Raygun in different types of .NET applications.</p> <p>Watch this course to learn how to track unexpected errors in:</p> <ul> <li>Xamarin applications</li> <li>Desktop applications (WPF, Windows Forms, Windows Services)</li> <li>ASP.NET applications</li> </ul> <p>Watch the course on Pluralsight: <a href="http://www.pluralsight.com/courses/raygun-dotnet-getting-started">Getting Started with Raygun in .NET</a></p> <p>I hope you enjoy my work on this course, please leave me a comment if you end up watching the course and let me know if it helps you!</p> 2015-03-26T00:00:00Z2015-03-26T00:00:00Z<p><img src="https://raygun.io/images/robots/homeRobot_right.png" alt="" style="float: right; margin-left: 10px; width: 60px;">I am very excited to announce that my latest course is now available on Pluralsight! This time I talk about the importance of tracking errors and how to easily track errors using Raygun!<br><br>Exactly two years ago, on this very day, <a href="https://www.filipekberg.se/2013/03/26/easy-error-tracking-in-your-applications/">I published an article</a> on how to easily add error tracking to your applications using Raygun! Now I am very excited to announce this course on Pluralsight that covers the usage of Raygun in different types of .NET applications.</p> <p>Watch this course to learn how to track unexpected errors in:</p> <ul> <li>Xamarin applications</li> <li>Desktop applications (WPF, Windows Forms, Windows Services)</li> <li>ASP.NET applications</li> </ul> <p>Watch the course on Pluralsight: <a href="http://www.pluralsight.com/courses/raygun-dotnet-getting-started">Getting Started with Raygun in .NET</a></p> <p>I hope you enjoy my work on this course, please leave me a comment if you end up watching the course and let me know if it helps you!</p> https://www.filipekberg.se/2015/03/25/asynchronous-programming-in-dotnet/Asynchronous Programming in .NET<p>Asynchronous programming have been around for quite some time. Even so it is becoming more and more important! It is surely not an easy topic to master, but in this 1.5 hour session I will do my best to explain the fundamentals to Asynchronous Programming.</p> <p>After watching this session, I hope that you will have a good understanding how to use asynchronous operations in your code. Be it a WPF, Windows Forms, Xamarin.iOS, Xamarin.Android, ASP.NET or other .NET application! We will of course look at the most common reasons for locking and killing your application.</p> <div class="video-container"> <iframe width="640" height="360" src="//www.youtube.com/embed/PQKIS2oZ_K0" frameborder="0" allowfullscreen></iframe> </div> <p><strong>Slides available below on Slideshare</strong></p> <div class="video-container"> <iframe src="//www.slideshare.net/slideshow/embed_code/46291797" width="425" height="355" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" style="border:1px solid #CCC; border-width:1px; margin-bottom:5px; max-width: 100%;" allowfullscreen> </iframe> <div style="margin-bottom:5px"> <strong> <a href="https://www.filipekberg.se/www.slideshare.net/fekberg1/asynchronous-programming-46291797" title="Asynchronous programming" target="_blank">Asynchronous programming</a> </strong> from <strong><a href="https://www.filipekberg.se/www.slideshare.net/fekberg1" target="_blank">Filip Ekberg</a></strong> </div> </div> <p>Let me know if this was helpful to you and if you have questions about asynchronous programming!</p> 2015-03-25T00:00:00Z2015-03-25T00:00:00Z<p>Asynchronous programming have been around for quite some time. Even so it is becoming more and more important! It is surely not an easy topic to master, but in this 1.5 hour session I will do my best to explain the fundamentals to Asynchronous Programming.</p> <p>After watching this session, I hope that you will have a good understanding how to use asynchronous operations in your code. Be it a WPF, Windows Forms, Xamarin.iOS, Xamarin.Android, ASP.NET or other .NET application! We will of course look at the most common reasons for locking and killing your application.</p> <div class="video-container"> <iframe width="640" height="360" src="//www.youtube.com/embed/PQKIS2oZ_K0" frameborder="0" allowfullscreen></iframe> </div> <p><strong>Slides available below on Slideshare</strong></p> <div class="video-container"> <iframe src="//www.slideshare.net/slideshow/embed_code/46291797" width="425" height="355" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" style="border:1px solid #CCC; border-width:1px; margin-bottom:5px; max-width: 100%;" allowfullscreen> </iframe> <div style="margin-bottom:5px"> <strong> <a href="https://www.filipekberg.se/www.slideshare.net/fekberg1/asynchronous-programming-46291797" title="Asynchronous programming" target="_blank">Asynchronous programming</a> </strong> from <strong><a href="https://www.filipekberg.se/www.slideshare.net/fekberg1" target="_blank">Filip Ekberg</a></strong> </div> </div> <p>Let me know if this was helpful to you and if you have questions about asynchronous programming!</p> https://www.filipekberg.se/2015/02/24/when-is-1-not-equal-to-1/When is 1 Not Equal to 1?<p>Not too long ago I noticed a rather interesting question on JabbR that caught my attention:</p> <p><strong>When is 1 not equal to 1?</strong> asked the developer. Loving to solve problems and help others, I started questioning my fellow developer about the details of the problem. The first thought that popped up in my head take us back to my university days when first hearing about <code>NaN</code> (Not a Number), by definition <a href="http://stackoverflow.com/questions/471296/how-can-while-i-i-be-a-non-infinite-loop-in-a-single-threaded-applicati"><code>NaN != NaN</code></a>. </p> <p>To my surprise the data type was not of a type where <code>NaN</code> is applicable;2015-02-24T00:00:00Z2015-02-24T00:00:00Z<p>Not too long ago I noticed a rather interesting question on JabbR that caught my attention:</p> <p><strong>When is 1 not equal to 1?</strong> asked the developer. Loving to solve problems and help others, I started questioning my fellow developer about the details of the problem. The first thought that popped up in my head take us back to my university days when first hearing about <code>NaN</code> (Not a Number), by definition <a href="http://stackoverflow.com/questions/471296/how-can-while-i-i-be-a-non-infinite-loop-in-a-single-threaded-applicati"><code>NaN != NaN</code></a>. </p> <p>To my surprise the data type was not of a type where <code>NaN</code> is applicable;<!--excerpt--> in fact it was insisted that this was an integer compared to another integer. Being even more intrigued about the problem at this point I asked for a little bit more insight into the code. A piece of the code caught my eyes, the developer had to convert two parameters into the integers for some reason. To do this in C#, you can use <code>Convert.ChangeType</code>; minimum this method takes two parameters: the value and the type to convert to.</p> <p><strong>I ask the developer</strong> to send me the code snippet that fails, this is what the developer sends me:</p> <pre><code>Convert.ChangeType("1", typeof(int)) == Convert.ChangeType("1", typeof(int)) </code></pre> <p>Obviously it's simplified for the sake of this article, and they couldn't change their code to use <strong><code>int.TryParse</code></strong>, otherwise they would have. </p> <p><strong>Do you expect this to be true?</strong> At this point you most likely figure out that the answer to this question is no. <a href="https://msdn.microsoft.com/en-us/library/dtb69x08(v=vs.110).aspx">If we look at the complete signature of this method, we can see that it will return an <strong><code>object</code></strong>!</a></p> <p>This means that we are basically executing the following: <code>(object)1 == (object)1</code> and this will not work either! Why? Because it compares the references and they're of course not equal in this case. In the case of this developer, it was not possible to simply cast to the correct type however, there was still a solution at hand!</p> <p><strong>Polymorphism to the rescue!</strong></p> <p>Every type in .NET has the capabilities of overriding <code>Equals</code>, however the built in types already do this. At this point, I had asked the developer to try the following:</p> <pre><code>((object)1).Equals((object)1) </code></pre> <p>And voila, it worked; which is obvious when you know the method signature of <code>Convert.ChangeType</code>. If the developer had used <code>int.TryParse</code> instead, this problem wouldn't have occurred in the first place. However, in their solution did a few more things which didn't make this easily possible. </p> <p>Let us look at something, equally interesting (pun intended). Consider we have the well-used <code>Point</code> and an <code>X</code> and <code>Y</code> coordinate. This type has an operator overload for equality checks looking like the following:</p> <pre><code>public static bool operator ==(Point a, Point b) { return a.X == b.X &amp;&amp; a.Y == b.Y; } </code></pre> <p>What do you think happens in the following scenario?</p> <pre><code>var a = new Point { X = 100, Y = 100 }; var b = new Point { X = 100, Y = 100 }; (object)a == (object)b </code></pre> <p>Will <code>a</code> equal <code>b</code>? No, of course not. We are actually not making use of the operator overload in this case, since both <code>a</code> and <code>b</code> are <code>objects</code> for all we care. </p> <p>The solution for this would be to override <code>Equals</code>!</p> <pre><code>public override bool Equals(object obj) { var point = obj as Point; return point?.X == X &amp;&amp; point?.Y == Y; } </code></pre> <p>We even got to use null propagation! This way it wouldn't blow up if we run it like this: <code>a.Equals(null)</code>.</p> <p>Looking back at the fundamentals from time to time doesn't hurt, and helping out a fellow developer in need at least makes me sleep better at night. </p> <p>I hope you found this read interesting!</p> https://www.filipekberg.se/2015/01/11/csharp-6-0-null-propagation/C# 6.0 - Null Propagation<p>The next version of C# brings a lot of sugar to the table, which we have looked at a few times already. Although, I think it will be interesting to look into a few of the features in more detail and of course look at what tools like reflector says about the code generated. To start this off I want to look at null propagation. This is one of my favourite language features in the upcoming version of C#. I think, and I hope, that this will change the amount of Null Reference Exceptions that we experience in our applications.</p> <p>Let us start by just looking at the operator itself, it's simple and elegant. The null propagation operator looks like this: <code>?.</code>2015-01-11T00:00:00Z2015-01-11T00:00:00Z<p>The next version of C# brings a lot of sugar to the table, which we have looked at a few times already. Although, I think it will be interesting to look into a few of the features in more detail and of course look at what tools like reflector says about the code generated. To start this off I want to look at null propagation. This is one of my favourite language features in the upcoming version of C#. I think, and I hope, that this will change the amount of Null Reference Exceptions that we experience in our applications.</p> <p>Let us start by just looking at the operator itself, it's simple and elegant. The null propagation operator looks like this: <code>?.</code><!--excerpt--></p> <p>A question mark is commonly used throughout the language for evaluation of truth. For instance, it is used in in-line if statements. We have also seen double question marks used as a shorthand syntax for asking if an expression evaluates to null and if it does, we supply a value that is given instead of null. Not unlike these two cases, the question mark in the case of null propagation indicates that we will not proceed to what is on the right hand side if what is on the left is null.</p> <p>We are most certainly going to see null propagation used together with the double question marks, as they very much completes each other!</p> <p>In the following method, we expect a person to be passed and since there is no way for us to guarantee that what is passed to the method is not null, we might have a problem.</p> <pre><code>public void TellMeYourName(Person person) { person.SayMyName(); } </code></pre> <p>We could of course introduce a guard, a simple check to see if what is passed to this method is null or not; with even more realistic examples this gets easily bloated. With null propagation, there is an easy fix. We can simply add a question mark, to ask if person is null or not.</p> <pre><code>public void TellMeYourName(Person person) { person?.SayMyName(); } </code></pre> <p>It is a simple enough fix, but it ultimately changes the behaviour of the application. To the better? That depends on what you expect the method to do. What will happen here is that the entire expression will be evaluated to null, and since there is nothing else to be done in the method, it will be exited as if nothing was wrong. However, it was wrong, <code>person</code> shouldn't have been null in the first place. At least that what's we could assume. We solved the possible Null Reference Exception, but now the application might not work as expected, so we would still need to handle the case of it being incorrect.</p> <p>In the case of the example above, we just have one null check, imagine though if we had more. The following example demonstrates a bit more complex scenario, where we have methods, properties and variables that might be or might return something that is null.</p> <pre><code>users?.GetUser("Filip")?.GetRoles()?.IsAdministrator </code></pre> <p>The above example is interesting, what would you expect this to be? <code>IsAdministrator</code> is a <code>bool</code>, but as we are using null propagation it will instead be <code>bool?</code>. This means that you can no longer use it in an if statement like the following because it is a <code>bool?</code>:</p> <pre><code>if(users?.GetUser("Filip")?.GetRoles()?.IsAdministrator) {} </code></pre> <p>Instead, you will have to specify what the value is (even if obvious) when the entire expression evaluates to null.</p> <pre><code>if(users?.GetUser("Filip")?.GetRoles()?.IsAdministrator ?? false) {} </code></pre> <p>The above demonstrates how you could combine the use of <code>?.</code> and <code>??</code>. Let us step back, look at a simple example again, and see what happens when methods are invoked. Consider that we have the following structure; it is a person and an address with its expected relation.</p> <pre><code>class Person { public Address GetAddress() { Console.WriteLine("Getting the address!"); return null; } } class Address { public string StreetName { get; set; } } </code></pre> <p>Given that we have the following code to get a person and print the name, what do you think will happen?</p> <pre><code>Person person = new Person(); Console.WriteLine(person?.GetAddress()?.StreetName); </code></pre> <p>When you use <code>?.</code> it will be converted into an in-line if-statement like you've most likely seen many times before. The first check if the person is null or not will result in the following:</p> <pre><code>(person != null) ? person.GetAddress() : null </code></pre> <p>This means if person is not null, it'll go ahead and call <code>GetAddress()</code> on that instance and in case person would be null, it'll just say that the entire expression is null. So what happens with the rest of it? If we look at the entire expression in reflector, we will see something interesting (and not necessarily true!).</p> <pre><code>Console.WriteLine((person != null) ? ((person.GetAddress() == null) ? null : person.GetAddress().StreetName) : null); </code></pre> <p>It's a bit worrying to see that <code>GetAddress()</code> is called twice and when I did my talk at <a href="https://www.filipekberg.se/2014/12/10/csharp-6-0/">DDD Brisbane</a> I was a bit stunned when I saw this as I did not expect it! As you saw in the above example with the structure of the <code>Address</code> type, you see that I added a console output so that we can see if it is in fact called twice or not. Luckily enough, running this only results in one console output!</p> <p>Let us look at the IL and see what it looks like! Funnily enough, Reflector does not really show the same result when looking at the IL!</p> <pre><code>.method private hidebysig static void Main(string[] args) cil managed { .entrypoint .maxstack 2 .locals init ( [0] class NullPropagation.Person person) L_0000: nop L_0001: newobj instance void NullPropagation.Person::.ctor() L_0006: stloc.0 L_0007: ldloc.0 L_0008: brtrue.s L_000d L_000a: ldnull L_000b: br.s L_001f L_000d: ldloc.0 L_000e: call instance class NullPropagation.Address NullPropagation.Person::GetAddress() L_0013: dup L_0014: brtrue.s L_001a L_0016: pop L_0017: ldnull L_0018: br.s L_001f L_001a: call instance string NullPropagation.Address::get_StreetName() L_001f: call void [mscorlib]System.Console::WriteLine(string) L_0024: nop L_0025: ret } </code></pre> <p>You see here that there is in fact just one call to <code>GetAddress()</code> and there's only one place where it jumps to this call. I would really encourage you to read the IL a few times, it is good practice and it is interesting (at least I think so) to understand what everything means.</p> <p>We have seen how powerful null propagation can be, and hopefully you have gotten some answers to how you can use it in your applications. Keep in mind, we are hiding complexity behind syntactic sugar and this is just a nice and easy way for us to easily spot errors and not bloating our code with lots of if-statements.</p> <p>Use with care!</p> <p>Get a complete overview of what is new in C# 6.0 in my talk here:</p> <div class="video-container"> <iframe width="640" height="360" src="//www.youtube.com/embed/fNTf680fTHE" frameborder="0" allowfullscreen></iframe> </div> https://www.filipekberg.se/2015/01/07/hello-2015-goodbye-2014/Hello 2015, Goodbye 2014!<p><img src="https://cdn.filipekberg.se/fekberg-blog/wp-content/uploads/2013/01/MVP_Logo_Small.png" alt="" style="float: right; padding: 20px;" />It feels like it was just yesterday that we moved to Australia, even though it is almost 1.5 years ago. It does feel like time goes faster when you're having a lot of fun, and I sure have had in 2014! I'm truly humbled and honoured to be awarded with the Microsoft MVP Award for a third year in a row. I'm really proud to be a .NET MVP!<br/><br/>I have every single one of you to thank for it, without you reading this blog, watching my videos, attending my presentations it wouldn't have been possible. It truly re-fuels me standing in front of a crowd sharing my knowledge, writing about new(or old) things that excites me or recording courses that will help you advance in your career. Speaking of career progression, I'm very happy to have been promoted to Senior Consultant at Readify. Not a single day goes by that I don't learn something new and I truly love it!2015-01-07T00:00:00Z2015-01-07T00:00:00Z<p><img src="https://cdn.filipekberg.se/fekberg-blog/wp-content/uploads/2013/01/MVP_Logo_Small.png" alt="" style="float: right; padding: 20px;" />It feels like it was just yesterday that we moved to Australia, even though it is almost 1.5 years ago. It does feel like time goes faster when you're having a lot of fun, and I sure have had in 2014! I'm truly humbled and honoured to be awarded with the Microsoft MVP Award for a third year in a row. I'm really proud to be a .NET MVP!<br/><br/>I have every single one of you to thank for it, without you reading this blog, watching my videos, attending my presentations it wouldn't have been possible. It truly re-fuels me standing in front of a crowd sharing my knowledge, writing about new(or old) things that excites me or recording courses that will help you advance in your career. Speaking of career progression, I'm very happy to have been promoted to Senior Consultant at Readify. Not a single day goes by that I don't learn something new and I truly love it!<!--excerpt--></p> <p>It makes me so happy to see that a lot of you are still buying, reading my book and recommending my book C# Smorgasbord. Maybe 2015 will be a good year to start work on a second edition? </p> <p>I think it is safe to say that 2014 has been an exciting year for all of us, especially if you are working in the .NET space. A few things from the top of my head that I have been more than excited about:</p> <ul> <li><strong>Roslyn Open-Sourced and Microsoft working much more openly with everything</strong></li> <li><strong>C# 6.0 got more language features (and a few less)</strong></li> <li><strong>ASP.NET vNext is coming along very nicely</strong></li> <li><strong>Windows 10 Preview released</strong></li> <li><strong>Visual Studio 2015 Preview released</strong></li> <li><strong>Free Community Edition of Visual Studio released</strong></li> </ul> <p>Of course, there's been a huge bunch of things that has happened the last 12 months, I bet I forgot one or two big announcements! Personally, I had a really good year, I was invited to speak at Mobile/Xamarin user groups in Sydney, Melbourne and Brisbane. I was invited to talk about asynchronous programming, C# 6.0, Azure Mobile Services at user groups. Last but not least I had the opportunity to deliver a presentation at TechEd Australia (Sydney/Melbourne) and two talks at DeveloperDeveloperDeveloper in Brisbane! Australia has such an inviting community that makes easier to start delivering talks and sharing knowledge. I am positively impressed by the engagement of the crowd; everywhere I go, there are always lots of questions which as a Swede I'm not use to.</p> <p>In the end of 2014 I started working on my next Pluralsight course, which will be on Getting Started with Raygun in .NET. I'm really excited about getting this course out there to you, so bear with me while I do the final recording and editing!</p> <p>Without further ado, here are the links to articles I posted in 2014! Enjoy the read and I hope we'll see each other in 2015!</p> <p><strong>The Link Summary</strong></p> <p><strong>Architecture and Practices</strong></p> <ul> <li><a href="https://www.filipekberg.se/2014/01/30/test-automation-web-applications/" target="_blank">Test Automation for Web Applications</a></li> <li><a href="https://www.filipekberg.se/2014/11/04/getting-started-with-continuous-delivery/" target="_blank">Getting Started with Continuous Delivery</a></li> <li><a href="https://www.filipekberg.se/2014/11/05/microsoft-azure-mobile-services-powered-by-dotnet/" target="_blank">Introducing the Azure Mobile Services .NET Backend</a></li> <li><a href="https://www.filipekberg.se/2014/12/14/using-webapi-with-azure-mobile-services/" target="_blank">Using WebAPI with Azure Mobile Services</a></li> <li><a href="https://www.filipekberg.se/2014/06/12/asynchronous-programming/" target="_blank">Asynchronous programming</a></li> <li><a href="https://www.filipekberg.se/2014/03/04/reliable-fast-applications-introducing-parallel-async/" target="_blank">Reliable and fast applications by introducing parallel and async</a></li> </ul> <p><strong>Algorithms</strong></p> <ul> <li><a href="https://www.filipekberg.se/2014/02/10/understanding-peak-finding/" target="_blank">Understanding Peak-Finding</a></li> <li><a href="https://www.filipekberg.se/2014/02/17/calculating-document-distance/" target="_blank">Calculating Document Distance</a></li> <li><a href="https://www.filipekberg.se/2014/02/24/understanding-sorting/" target="_blank">Understanding Sorting</a></li> </ul> <p><strong>C# 6.0, Roslyn and Visual Studio 2015</strong></p> <ul> <li><a href="https://www.filipekberg.se/2014/04/04/microsoft-open-sources-c-compiler/" target="_blank">Microsoft Open Sources C# Compiler</a></li> <li><a href="https://www.filipekberg.se/2014/09/12/csharp-vnext-6-0-overview/" target="_blank">C# vNext (6.0) Overview</a></li> <li><a href="https://www.filipekberg.se/2014/09/23/whats-new-in-csharp-6-0/" target="_blank">What's New in C# 6.0</a></li> <li><a href="https://www.filipekberg.se/2014/10/31/microsoft-compiler-platform-aka-roslyn/" target="_blank">Microsoft Compiler Platform aka Roslyn</a></li> <li><a href="https://www.filipekberg.se/2014/11/12/visual-studio-2015-preview-and-open-sourcing-dotnet-announced/" target="_blank">Visual Studio 2015 Preview and Open Sourcing .NET Announced</a></li> <li><a href="https://www.filipekberg.se/2014/12/10/csharp-6-0/" target="_blank">C# 6.0 Overview</a></li> </ul> <p><strong>Xamarin and Mobile</strong></p> <ul> <li><a href="https://www.filipekberg.se/2014/03/26/xamarin-introduction/" target="_blank">Xamarin Introduction</a></li> <li><a href="https://www.filipekberg.se/2014/04/04/cross-platform-development-using-c-and-xamarin-studio-australia-tour/" target="_blank">Cross-platform development using C# and Xamarin Studio Australia Tour</a></li> <li><a href="https://www.filipekberg.se/2014/04/11/xamarin-rest-apis/" target="_blank">Xamarin and REST APIs</a></li> <li><a href="https://www.filipekberg.se/2014/07/02/what-is-xamarin-and-why-should-i-care/" target="_blank">What is Xamarin and Why Should I Care?</a></li> <li><a href="https://www.filipekberg.se/2014/08/31/xamarin-introduction-on-ssw-tv/" target="_blank">Xamarin Introduction on SSW TV</a></li> <li><a href="https://www.filipekberg.se/2014/04/29/universal-windows-windows-phone-apps/" target="_blank">Universal Windows and Windows Phone Apps</a></li> </ul> <p><strong>Inspirational</strong></p> <ul> <li><a href="https://www.filipekberg.se/2014/01/29/developing-good-software-damn-hard/" target="_blank">Developing Good Software is Damn Hard</a></li> <li><a href="https://www.filipekberg.se/2014/05/28/i-want-to-learn-programming-where-do-i-start/" target="_blank">I Want To Learn Programming, Where Do I Start?</a></li> </ul> <p><strong>Other</strong></p> <ul> <li><a href="https://www.filipekberg.se/2014/01/01/2013-amazing-year-heres-summary/" target="_blank">2013 was an amazing year, here's a summary!</a></li> <li><a href="https://www.filipekberg.se/2014/05/20/moving-microsoft-azure/" target="_blank">Moving to Microsoft Azure</a></li> <li><a href="https://www.filipekberg.se/2014/05/21/goodbye-wordpress-hello-snow/" target="_blank">Goodbye Wordpress Hello Snow</a></li> </ul> <p>Thank you again for your support in 2014, I hope you'll continue to enjoy my stories, videos and presentations!</p> https://www.filipekberg.se/2014/12/14/using-webapi-with-azure-mobile-services/Using WebAPI with Azure Mobile Services<p>When you thought Azure Mobile Services couldn't become more awesome the .NET backend was thrown into the mix. This gives us an extremely powerful, scalable and easy to work with backend – in the cloud! </p> <p>In this session, I'll show you how to get hacking with the .NET Backend for Mobile Services, how to cater for different connectivity patterns by taking data offline and how to leverage other data sources such as Mongo!</p> <div class="video-container"> <iframe width="640" height="360" src="//www.youtube.com/embed/4TMQK4siZO4" frameborder="0" allowfullscreen></iframe> </div> <p>2014-12-14T00:00:00Z2014-12-14T00:00:00Z<p>When you thought Azure Mobile Services couldn't become more awesome the .NET backend was thrown into the mix. This gives us an extremely powerful, scalable and easy to work with backend – in the cloud! </p> <p>In this session, I'll show you how to get hacking with the .NET Backend for Mobile Services, how to cater for different connectivity patterns by taking data offline and how to leverage other data sources such as Mongo!</p> <div class="video-container"> <iframe width="640" height="360" src="//www.youtube.com/embed/4TMQK4siZO4" frameborder="0" allowfullscreen></iframe> </div> <p><!--excerpt--> The slides from my talk are available below.</p> <div class="video-container"> <iframe src="//www.slideshare.net/slideshow/embed_code/42437460" width="425" height="355" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" style="border:1px solid #CCC; border-width:1px; margin-bottom:5px; max-width: 100%;" allowfullscreen> </iframe> <div style="margin-bottom:5px"> <strong> <a href="https://www.filipekberg.se/www.slideshare.net/fekberg1/mobile-services-lt3-web-api" title="Azure Mobile Services .NET Backend" target="_blank">Azure Mobile Services .NET Backend</a> </strong> from <strong><a href="https://www.filipekberg.se/www.slideshare.net/fekberg1" target="_blank">Filip Ekberg</a></strong> </div> </div> <p><a href="https://github.com/fekberg/TechEd-2014">Code samples available on Github.</a></p> <p>Azure Mobile Services just got a whole lot more powerful and I for one really enjoys working with it. How do you feel about these recent changes and what are your thoughts around Azure Mobile Services as it stands today?</p> https://www.filipekberg.se/2014/12/10/csharp-6-0/C# 6.0 Overview<p>Did you think C# was already the perfect programming language? Did you think there was no work left on refining the language? In this session I’ll walk through what’s new in C# 6.0, how the new open-source compiler helped and why we have an awesome time ahead!</p> <div class="video-container"> <iframe width="640" height="360" src="//www.youtube.com/embed/fNTf680fTHE" frameborder="0" allowfullscreen></iframe> </div> <p>2014-12-10T00:00:00Z2014-12-10T00:00:00Z<p>Did you think C# was already the perfect programming language? Did you think there was no work left on refining the language? In this session I’ll walk through what’s new in C# 6.0, how the new open-source compiler helped and why we have an awesome time ahead!</p> <div class="video-container"> <iframe width="640" height="360" src="//www.youtube.com/embed/fNTf680fTHE" frameborder="0" allowfullscreen></iframe> </div> <p><!--excerpt--> The slides from my talk are available below.</p> <div class="video-container"> <iframe src="//www.slideshare.net/slideshow/embed_code/42437422" width="425" height="355" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" style="border:1px solid #CCC; border-width:1px; margin-bottom:5px; max-width: 100%;" allowfullscreen> </iframe> <div style="margin-bottom:5px"> <strong> <a href="https://www.filipekberg.se/www.slideshare.net/fekberg1/c-60-what-c-is-being-updated-42437422" title="C# 6.0 - What?! C# is being updated?" target="_blank">C# 6.0 - What?! C# is being updated?</a> </strong> from <strong><a href="https://www.filipekberg.se/www.slideshare.net/fekberg1" target="_blank">Filip Ekberg</a></strong> </div> </div> <p>I am very excited about C# 6.0, the future of C# past this version and the changes in Visual Studio 2015! Do you have a favorite language feature?</p> https://www.filipekberg.se/2014/11/12/visual-studio-2015-preview-and-open-sourcing-dotnet-announced/Visual Studio 2015 Preview and Open Sourcing .NET Announced<h3>Having a look at Visual Studio 2015</h3> <p><img src="https://cdn.filipekberg.se/fekberg-blog/visual-studio-2015-preview-and-open-sourcing-dotnet-announced/VisualStudio2015.png" alt="" style="float: right; padding-left: 20px; width: 200px;">The next version of Visual Studio is right around the corner, it has previously been referred to as Visual Studio 14 but has now gotten its name; Visual Studio 2015. This new version of Visual Studio does not only include a bunch of new features that will make developers happier and more productive, but it also includes a new version in the family that means that you as a community contributor can get completely free version of Visual Studio 2015!2014-11-12T00:00:00Z2014-11-12T00:00:00Z<h3>Having a look at Visual Studio 2015</h3> <p><img src="https://cdn.filipekberg.se/fekberg-blog/visual-studio-2015-preview-and-open-sourcing-dotnet-announced/VisualStudio2015.png" alt="" style="float: right; padding-left: 20px; width: 200px;">The next version of Visual Studio is right around the corner, it has previously been referred to as Visual Studio 14 but has now gotten its name; Visual Studio 2015. This new version of Visual Studio does not only include a bunch of new features that will make developers happier and more productive, but it also includes a new version in the family that means that you as a community contributor can get completely free version of Visual Studio 2015!<!--excerpt--><br/><br/>As any new version of Visual Studio, it's packed with amazing features that makes our lives as developers much easier. If you have been following the news you know that Microsoft have completely re-written their C# and VB compilers which are now completely written in managed code, open source and is called the .NET Compiler Platform. I am extremely excited about this being the compilers that will ship with Visual Studio 2015. It means that it is much easier for Microsoft and other vendors to extend the experience when working with C# and VB applications.</p> <p>The power of the new .NET Compiler Platform has been shining through with Code Lense in the previous updates for Visual Studio 2013, which means that we have been getting a better experience when refactoring code out of the box with Visual Studio. With Visual Studio 2015 Preview, you will see analysers and refactoring packages being installed over NuGet, which will make it easier for anyone to distribute rules and fixes for common (and not so common) code issues. This will integrate nicely in the already very nice and pleasant refactoring experience in Visual Studio 2015 Preview.</p> <p><img src="https://cdn.filipekberg.se/fekberg-blog/visual-studio-2015-preview-and-open-sourcing-dotnet-announced/RemoveUnusedUsings.png" alt="" /></p> <h4>Lambda Expressions in Watch and Immediate Window</h4> <p>This new feature will give us a completely different debugging experience! Over the year’s one of the most annoying things have been to debug lambda expressions, but no more! Visual Studio 2015 Preview ships with a nice revamped watch and immediate window that will allow you to write lambdas and LINQ!</p> <p><img src="https://cdn.filipekberg.se/fekberg-blog/visual-studio-2015-preview-and-open-sourcing-dotnet-announced/LambdasInTheWatchWindow.png" alt="" /></p> <p><img src="https://cdn.filipekberg.se/fekberg-blog/visual-studio-2015-preview-and-open-sourcing-dotnet-announced/ImmediateWindow.png" alt="" /></p> <p>You can read more about the announcement of Visual Studio 2015 Preview and what it contains <a href="http://blogs.msdn.com/b/somasegar/archive/2014/11/12/opening-up-visual-studio-and-net-to-every-developer-any-application-net-server-core-open-source-and-cross-platform-visual-studio-community-2013-and-preview-of-visual-studio-2015-and-net-2015.aspx">at the MSDN Blog.</a></p> <h4>Download Visual Studio 2015 Preview</h4> <p><a href="http://www.visualstudio.com/downloads/visual-studio-2015-downloads-vs">You can download Visual Studio 2015 Preview from VisualStudio.com!</a> So what are you waiting for? It will install side by side with Visual Studio 2013, but if you have Visual Studio 14 CTP installed you will have to uninstall that first.</p> <h4>Visual Studio Community Edition</h4> <p>The new, FREE, version of Visual Studio can be found over at <a href="http://www.visualstudio.com/products/free-developer-offers-vs">VisualStudio.com/free</a>. If you are working with open source projects, this is definitely something you should be grabbing!</p> <h3>.NET Goes Open Source</h3> <p><img src="https://cdn.filipekberg.se/fekberg-blog/visual-studio-2015-preview-and-open-sourcing-dotnet-announced/DotNet2015.png" style="float: right; padding-left: 20px;" alt="" />Microsoft announced today that they are open sourcing .NET Core and if that is not enough, they are also targeting Linux and Mac!<br/><br/>This is big news for the open source community and for the future of development on .NET. We certainly have an interesting time ahead! <a href="http://blogs.msdn.com/b/dotnet/archive/2014/11/12/net-core-is-open-source.aspx">You can read the full announcement on the MSDN Blog.</a><br/><br/><a href="https://github.com/Microsoft/dotnet">You can check out the repository on Github for more information.</a></p> <p><strong>Don't forget to submit your feedback if you find anything that you like, dislike or if there is a bug!</strong></p> https://www.filipekberg.se/2014/11/05/microsoft-azure-mobile-services-powered-by-dotnet/Introducing the Azure Mobile Services .NET Backend<h3>Azure Mobile Services As We Know It</h3> <p>If you, as many others, look for an easy way to create a scalable and reliable backend, Azure Mobile Services is a viable option. Up until today, we have had the capabilities of defining the backend in Mobile Services using NodeJS. Even if you have used Mobile Services though, you might not have had to bother with the NodeJS parts because out of the box you have a dynamic data schema that adapts with the models you define.</p> <p>On-top of allowing you to easily define what the data looks like, you have been able to use NodeJS when inserting, updating or deleting data to for instance make sure that a user is authenticated. The word "mobile" comes nicely into play as developers of Mobile applications we do not want to focus too much on where we store data and how it is done; we want as low friction as possible! Thus having an extremely easy way to define, extend and scale a backend is highly valuable. 2014-11-05T00:00:00Z2014-11-05T00:00:00Z<h3>Azure Mobile Services As We Know It</h3> <p>If you, as many others, look for an easy way to create a scalable and reliable backend, Azure Mobile Services is a viable option. Up until today, we have had the capabilities of defining the backend in Mobile Services using NodeJS. Even if you have used Mobile Services though, you might not have had to bother with the NodeJS parts because out of the box you have a dynamic data schema that adapts with the models you define.</p> <p>On-top of allowing you to easily define what the data looks like, you have been able to use NodeJS when inserting, updating or deleting data to for instance make sure that a user is authenticated. The word "mobile" comes nicely into play as developers of Mobile applications we do not want to focus too much on where we store data and how it is done; we want as low friction as possible! Thus having an extremely easy way to define, extend and scale a backend is highly valuable. <!--excerpt--> However, the scalability, reliability and having an easily changeable backend is not all that Azure Mobile Services provides us. We also get out of the box support for introducing push notifications, authentication and authorization in our mobile applications. All of these are commonly faced problems and Mobile Services makes it easier for us to work with. The authentication and authorization allows us to login to our applications using providers we all love: Twitter, Facebook, Google, Microsoft and Active Directory. I would like to emphasise active directory, you can use your on-premises AD and hook that up to Azure so that your users can login to your application using their corporate AD account.</p> <p>Moving forward we have many interesting changes that have been introduced to allow for a more flexible backend. NodeJS is great, but in Azure Mobile Services it may feel a bit limiting and hard (in terms of debugging) to work with.</p> <p>I am very happy to be able to introduce the .NET powered backend in Azure Mobile Services by using WebAPI!</p> <h4>Exploring Mobile Services .NET Backends, Offline Data support and alternative data stores</h4> <p>I was invited to speak on this topic at TechEd Australia 2014 and the recording, and slides, are now available on Channel 9. As always, I hope you will enjoy the content and if you are left with any questions or have any feedback about Azure Mobile Services, please feel free to leave me a comment.</p> <div class="video-container"> <iframe src="//channel9.msdn.com/Events/TechEd/Australia/2014/WPD408/player" width="800" height="450" allowFullScreen frameBorder="0" scrolling="no"></iframe> </div> <h5>Download the resources</h5> <ul> <li><a href="https://github.com/fekberg/TechEd-2014">Download the code samples</a></li> <li><a href="http://video.ch9.ms/sessions/teched/au/2014/WPD408.pptx">Download the slides</a></li> <li><a href="http://video.ch9.ms/sessions/teched/au/2014/WPD408.mp4">Download the High Quality MP4 video of the talk</a></li> </ul> <h5>Errata</h5> <p>In the demos in the above talk, I show how you can change the backend data store to MongoDB from SQL Server. What I forget to highlight and change in the <code>TodoItem</code> is that it needs to inherit from <code>DocumentData</code> instead of <code>EntityData</code>. Without making this change, certain operations like update (PATCH) will fail.</p> <p><strong>Please do leave a comment letting me know if you find this useful, if you use something similar in your work or if you have suggestions on how this can be improved.</strong></p> https://www.filipekberg.se/2014/11/04/getting-started-with-continuous-delivery/Getting Started with Continuous Delivery<h3>Working in an agile environment</h3> <p>While working in a high paced and agile environment, building block by block to reach the ultimate minimal viable product, stakeholders will most definitely ask more than once if they can see what you have thus far.</p> <p>Agile, Scrum, continuous delivery and testing are not new concepts or buzz-words. Although they have all been around for a while they are still something well worth talking about and working on improving in your team.</p> <p>Over the years I have seen countless of products being worked on where there has been no real definition of, or well-thought through direction to get to, a minimal viable product. The main problem I see derives from the customer not being able to define a subset of features that are good enough for a first product release. If we put ourselves in the shoes of a customer, we might as well have been a customer or will be in the future, imagine having a vision of a great product and someone telling you to cut it in half and choose which side you like the most. It's difficult, right? 2014-11-04T00:00:00Z2014-11-04T00:00:00Z<h3>Working in an agile environment</h3> <p>While working in a high paced and agile environment, building block by block to reach the ultimate minimal viable product, stakeholders will most definitely ask more than once if they can see what you have thus far.</p> <p>Agile, Scrum, continuous delivery and testing are not new concepts or buzz-words. Although they have all been around for a while they are still something well worth talking about and working on improving in your team.</p> <p>Over the years I have seen countless of products being worked on where there has been no real definition of, or well-thought through direction to get to, a minimal viable product. The main problem I see derives from the customer not being able to define a subset of features that are good enough for a first product release. If we put ourselves in the shoes of a customer, we might as well have been a customer or will be in the future, imagine having a vision of a great product and someone telling you to cut it in half and choose which side you like the most. It's difficult, right? <!--excerpt--> Before we fall too deep into the rabbit hole here and go in a different direction, let me be perfectly clear on what message I want to give with the above. In a scrum environment, we work towards a goal, most likely towards a vision that a customer has. Working in an agile environment means that the customer is allowed to change their minds, more than once even! While we are working towards this goal, we know for a fact that the customer will change their minds and our processes needs to cater for this behaviour.</p> <p>While on the subject of scrum, the point of a sprint is to deliver a set of features that your team has agreed on. After this sprint, or even during the sprint, wouldn't it be very handy of stakeholders could see, and work with, what you are building?</p> <p>This is where continuous delivery comes into play. As we want to be transparent with our customers during the development, and we want them to be able to change their minds, being able to continuously give them a way to work with the product is key. So where does minimal viable product and choosing one side of the cake come into the picture? Before we answer that, let us define what continuous delivery is all about.</p> <h3>What is Continuous Delivery?</h3> <p>What “Continuous Delivery” means (as a set of words) is obvious, but what it means to product development and delivery may not be. Traditionally developers work on their local machines, when they're done for the day they hopefully push that into some kind of source control (or save it on a floppy drive).</p> <p>The code doesn't reach much further than that in this case though, everything that has been done that day is in the developers head, and maybe at best the developer updated the team board with information on what had been done for the day. </p> <p>Introducing continuous delivery into the mix would mean that once the source code is pushed, a second system is notified that there has been a change and a process of delivering what has been worked on the day is started. This process will build your code, run the tests and then deploy to your server(s).</p> <p>Is that all there is to continuous delivery? Certainly not.</p> <p>What is defined above is just what is supposed to happen when the code is pushed to the source code repository. Continuous delivery is not only about that, it is also about making sure that what is delivered is of somewhat a high quality.</p> <p>Each delivery through the continuous delivery pipe should in the developers point of view be a minimal viable product. This means when you check in your code into the main repository, you should be so certain of its high quality, that there should be no code compilation failures and unit tests should all run fine. Of course, this is not to be confused with the minimal viable product that the customer defined.</p> <p>Thus Continuous Delivery is a way for us to define a process for delivering features continuously and about making sure the deliverable is of high quality.</p> <h3>How do we increase quality of a delivery?</h3> <p>How long is a string (not the data type!)? This is where it does get a bit fluffy and philosophical. You will hear developers argue for days and days on how important, or not important, unit tests are. There are a few very important things to keep in mind: you can have 90% code coverage and still have an application that doesn't work.</p> <p>Hold your horses! What's this code coverage and why should I care about it? Every line of code that you write could have a unit test associated with it. If for instance all a method is doing, is printing a constant to the code, all you need to do to get a 100% code coverage (for that method) is to invoke it. Hence that there are no assertions being done in this case.</p> <p>If you have an if statement in your method, in order to get 100% test coverage you need to call the method and reach both inside and outside the condition. This means that if you have tons of nested conditions the amount of tests grow pretty large.</p> <p>However, testing individual pieces of code is a good start, but in the long run it would make a much bigger sense to write tests that verify end-to-end functionality.</p> <p>If you are working with a ASP.NET MVC website for instance, a test that starts the website, runs a <code>HttpClient</code> call to the website and verifies that the data it gets back is proper is worth much more than a few unit tests that tests if conditions. I would argue that acceptance tests, or integration tests are in the majority of cases worth a lot more than simple unit tests.</p> <p>Of course, in order to increase the quality of the delivery we need a way to ensure that the code is good and solid and that the feature we have been working on is functioning accordingly. A good way to get into the game is to start writing unit tests, get comfortable with trying to break your code and write tests that test negative scenarios.</p> <p>Remember that naming your tests are crucial to their success, don't just name your tests something generic but rather follow a pattern that your team conforms to. I tend to lean towards naming my test like the following: <code>Given_That_Username_Is_Empty_Login_Attempt_Fails</code>.</p> <h3>Deploying to Different Environments</h3> <p><img src="https://cdn.filipekberg.se/fekberg-blog/getting-started-with-continuous-delivery/BuildLightRed.png" style="float: right; padding-left: 20px; padding-bottom: 20px; width: 80px; " />When there's changes being pushed to our source control, hopefully the developers have already run all the unit tests locally to make sure there are no obvious errors. Unit tests are fast to run, as opposed to acceptance (functional/integration) tests which can take a long time to run.<br/><br/>The idea is that our continuous delivery process runs through the following steps:</p> <ol> <li>Run Unit Tests</li> <li>Run Acceptance Tests</li> <li>Deploy to Test</li> <li>Run Acceptance Tests for Test</li> <li>Deploy to Production</li> </ol> <p>Each step is only executed if the previous was marked as OK. I prefer to have a build light that tells me if the build fails or not!</p> <p>The different environments could have different test data, as they do resemble different states in the deployment. The closer you get to production, the closer you should get to testing with real data.</p> <h3>Recommended Tools</h3> <p>Continuous delivery should be on every team's radar, if you're not continuously delivering your product right now by introducing it you will most certainly blow more than one mind. Of course this is something we all want, unless we work in a traditional waterfall model where we are still swimming towards the current (although I don't think there's much of a current in a waterfall.</p> <p>To achieve good continuous delivery we have a bunch of tools that can help us, here are a few highlights (and I'd love to hear about your tools of choice!):</p> <ul> <li><a href="https://www.jetbrains.com/teamcity/">TeamCity</a> is a great tool to use for Continuous Delivery/Integration. It will monitor changes in your source code repository, help you build and deploy your product </li> <li><a href="https://octopusdeploy.com/">Octopus Deploy</a> will let you automate deployments, you could for instance deploy the product to 10 servers behind a load balancer once TeamCity marks it as OK </li> <li><a href="http://www.ncrunch.net/">NCrunch</a> for Visual Studio is a tool that continuously runs all tests in your solution as there is a change to a file. It also provides you with metrics on code coverage and visual indications if a part of the code is untested. This tool is a great way to get started with testing and getting a better test coverage of your code</li> <li>Azure is a great platform to host your solutions on, and for my blog for instance I have incorporated continuous delivery by always deploying the blog once I have added a post to the Github repository</li> </ul> <p><img src="https://cdn.filipekberg.se/fekberg-blog/getting-started-with-continuous-delivery/AzureDeploymnet.png" style="float: right; padding-left: 20px; padding-bottom: 20px;" /></p> <h3>Where to go now?</h3> <p>We've only scratched the surface of how to work in a continuous delivery environment, I hope this gives you a taste of how to improve your deliveries within your project.</p> <p>I'd love to hear from you what tools, processes and patters you and your team use!</p> <p><em>Thanks a lot to <a href="http://stevegodbold.com/">Stephen Godbold</a> for reviewing and giving a lot of great early feedback on this article</em>.</p> https://www.filipekberg.se/2014/10/31/microsoft-compiler-platform-aka-roslyn/Microsoft Compiler Platform aka Roslyn<p>A bit over a year ago I wrote and talked about Roslyn a fair bit, a lot has happened in this last year both in terms of the progression of the C# language and the compiler platform itself. Most notably is probably the decision to make the compiler platform open source <a href="https://www.filipekberg.se/2014/04/04/microsoft-open-sources-c-compiler/">which happened earlier this year</a>. With the decision to open source the compiler platform, it meant that the community could take part of what is the next version of the languages, what the compilers looks like under the hood and most interesting of them all: the decision making behind language features and directions of the project.</p> <p>I will not go into detail on the language features of C# 6.0 as there is an article published by me in the <a href="http://www.dotnetcurry.com/showarticle.aspx?ID=1042">DNC Magazine</a> on this. Instead we will take a look at how we can use what is available to us today.2014-10-31T00:00:00Z2014-10-31T00:00:00Z<p>A bit over a year ago I wrote and talked about Roslyn a fair bit, a lot has happened in this last year both in terms of the progression of the C# language and the compiler platform itself. Most notably is probably the decision to make the compiler platform open source <a href="https://www.filipekberg.se/2014/04/04/microsoft-open-sources-c-compiler/">which happened earlier this year</a>. With the decision to open source the compiler platform, it meant that the community could take part of what is the next version of the languages, what the compilers looks like under the hood and most interesting of them all: the decision making behind language features and directions of the project.</p> <p>I will not go into detail on the language features of C# 6.0 as there is an article published by me in the <a href="http://www.dotnetcurry.com/showarticle.aspx?ID=1042">DNC Magazine</a> on this. Instead we will take a look at how we can use what is available to us today.<!--excerpt--></p> <p><em>Disclaimer: The APIs discussed below can, and most likely will change before the final release. You can follow the changelogs on <a href="https://roslyn.codeplex.com/">roslyn.codeplex.com</a>.</em></p> <p><img src="https://cdn.filipekberg.se/fekberg-blog/microsoft-compiler-platform-aka-roslyn/roslyn_street.png" style="float: right; padding-left: 20px; padding-bottom: 20px;" />The idea is that we pass a chunk of code to the compiler and then we have the opportunity to analyse the semantics and the syntax that is produced by the compiler, before telling it to emit the code and make it runnable. You might be asking yourself why you would want to analyse code yourself, there may be multiple reasons for you to do so. Consider you are working on a project where you have some very specific code guidelines, in order for your team to adapt to these guidelines you may write a simply plugin using the compiler platform that analyses the code and based on passing or failing the guideline, it may fail the build for your or give you some indication that you need to change it.<br/></br>Another scenario is aspect oriented programming, you may want to analyse and when finding something particular, modifying the behaviour. I did a talk <a href="https://www.filipekberg.se/2013/05/02/utilize-roslyn-to-create-the-next-level-plugin-capability/">in 2013</a> about how to utilize this to create a fairly interesting plugin system. In this talk I used PostSharp to do the aspect oriented programming parts, but this could just as well have been done with the Microsoft Compiler Platform, Roslyn, instead. Take a look at the following image, here we have two representations as trees of an expression saying 10 + 20. The right hand tree shows how we have replaced the + with a -.</p> <p><img src="https://cdn.filipekberg.se/fekberg-blog/microsoft-compiler-platform-aka-roslyn/syntax_tree_rewrite.png" /></p> <p>This very simply example does not rightfully show you the power of what the compiler platform allows you to do, your possibilities are somewhat endless. Consider another scenario, where you use the compiler platform to find all method calls to a certain method, you replace the method call with a custom block of code that adds some logging, the following code sample shows an example of this.</p> <pre><code>// Original method call var result = MyMethod(10); // Re-written method call using Roslyn Debug.WriteLine("Calling {0} with first parameter value {1}", "MyMethod", 10); var result = MyMethod(10); Debug.WriteLine("Call to {0} finished", "MyMethod"); </code></pre> <p>Imagine also being able to add timers in here to see how long certain calls take, of course the analysis tools in Visual Studio still enables you to do so. Sometimes though you might want to get this type of data from a production environment, then you could just have a custom compilation that would replace all these method calls to include more logging, timing and so forth.</p> <p>Performing the actual replacing of nodes may not be as trivial as you expect though, it does take some understanding of the compiler platform and what the representation of code looks like from the compilers perspective. On a very abstract and basic level, the tree that represents a code block is immutable, what you do is that you tell the node that you are currently inspecting (the +) that you want to replace it with another node (the -). This will return a new tree representation that you can include in your compilation. You need to think of the replacement of nodes as replacements of a string, it will not do in-place replacing, but the structure is immutable!</p> <p>There are previous articles, and also my book that covers the basic understanding and how to do the code analysis with Roslyn, there has been changes to their APIs and changes that makes it suitable to re-iterate how it works.</p> <h3>Compiling code with the Compiler Platform aka Roslyn</h3> <p>To use the new Compiler Platform we first need to install it, this is easily done using NuGet. This means that we can, in a normal console application, web application or even WPF application, just pull in the files via the NuGet package manager. It is a pre-release so do not forget to append the attribute for that, as you see in the following image, the package <code>Microsoft.CodeAnalysis</code> is installed via the NuGet package manager.</p> <p><img src="https://cdn.filipekberg.se/fekberg-blog/microsoft-compiler-platform-aka-roslyn/nuget.PNG" /></p> <p>Installing this will bring in a couple of other packages as well:</p> <pre><code>PM&gt; Install-Package Microsoft.CodeAnalysis -Pre Attempting to resolve dependency 'Microsoft.CodeAnalysis.CSharp.Workspaces (≥ 0.7.4052301-beta)'. Attempting to resolve dependency 'Microsoft.CodeAnalysis.Workspaces.Common (≥ 0.7.4052301-beta)'. Attempting to resolve dependency 'Microsoft.CodeAnalysis.Common (≥ 0.7.4052301-beta)'. Attempting to resolve dependency 'Microsoft.Bcl.Immutable (≥ 1.1.20-beta)'. Attempting to resolve dependency 'Microsoft.Bcl.Metadata (≥ 1.0.11-alpha)'. Attempting to resolve dependency 'Microsoft.CodeAnalysis.CSharp (≥ 0.7.4052301-beta)'. Attempting to resolve dependency 'Microsoft.CodeAnalysis.VisualBasic.Workspaces (≥ 0.7.4052301-beta)'. Attempting to resolve dependency 'Microsoft.CodeAnalysis.VisualBasic (≥ 0.7.4052301-beta)'. </code></pre> <p>This will let us do all sorts of things such as analysing, replacing and emitting code to make it runnable.</p> <p>The first thing that we will add in this console application to test the power of Roslyn is the code that we want to compile. In this case I just want to add a code snippet that prints something to the console and says the standard <code>Hello World</code>. As seen in the following code snippet, we are simply doing this as an inline string, this could just as well have been a file on disk .</p> <pre><code>var code = @" using System; namespace AnalyseMe { class Program { public static void Main(string[] args) { Console.WriteLine(""Hello World!""); } } }"; </code></pre> <p>The intention here is to compile the code, look for any possible errors and then execute the file on disk. We can perform the final executions by hand, but do the rest with Roslyn. We are ready to ask for a syntax tree representation of our code, as the code snippet is C# we can use the static method <code>ParseText</code> on the class <code>CSharpSyntaxTree</code>:</p> <pre><code>var tree = CSharpSyntaxTree.ParseText(code); </code></pre> <p>We can then create something called a compilation, to this compilation we can append syntax trees, references and other information that is valuable to our compilation. As the code that we want to compile uses <code>Console</code> we need a reference to that assembly, which is where <code>System</code> lives. This is what is called a metadata file reference, the compilation uses this when it analyses and compiles the code passed as a syntax tree.</p> <p>The C# language has its specification and the parsing of the syntax tree adheres to this, however at this stage it is only represented as a syntax tree and nothing thus far is executable. This is why we need to add a reference to the assembly where the namespaces we use live. As the following code sample shows, we create the compilation, references an assembly and add the syntax tree.</p> <pre><code>var compilation = CSharpCompilation.Create("AnalyseMe") .AddReferences(new MetadataFileReference(Assembly.GetAssembly(typeof(Console)).Location)) .AddSyntaxTrees(tree); </code></pre> <p>We still cannot execute the code, as nothing has been emitted to an executable. However we can ask for a diagnosis of the code or we can ask for it to finally be emitted so that it can be executed. When asking for the diagnosis we can see if the things found are just errors or simple warnings, if it is just warnings you can compile, but if it is errors you cannot. That is not actually the entire truth, you can emit the code that does not in fact represent a proper program, and there will be no errors of doing so. The result binary will just be 0 in size.</p> <p>It is easy to ask for a diagnosis as you see here:</p> <pre><code>foreach (var diagnose in compilation.GetDiagnostics()) { Console.WriteLine(diagnose); } </code></pre> <p>If we remove a semicolor or a curlybrace from the code that we are compiling, you will see that the diagnosis will give different results.</p> <p><img src="https://cdn.filipekberg.se/fekberg-blog/microsoft-compiler-platform-aka-roslyn/compilation_error.png" /></p> <p>The final step in this process would be to emit the code and make it runnable, as an executable binary. As easy as we got the diagnosis we can create an executable by emitting the code using <code>compilation.Emit</code>. This method has two overloads where one lets you specify the file location and the other lets you compile in memory to a <code>Stream</code>. Having the ability not to go to the disk each time you compile is something that makes the new compiler platform so enjoyable and super-fast!</p> <pre><code>compilation.Emit("test.exe"); </code></pre> <p>The above will create an executable called <code>test.exe</code> which we can simply run and this will print <code>Hello World</code> to our console!</p> <p>Below is a full code sample of the above code</p> <pre><code>using System.Reflection; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using System; namespace RoslynDemo { class Program { static void Main(string[] args) { var code = @" using System; namespace AnalyseMe { class Program { public static void Main(string[] args) { Console.WriteLine(""Hello World!""); } } }"; var tree = CSharpSyntaxTree.ParseText(code); var compilation = CSharpCompilation.Create("AnalyseMe") .AddReferences(new MetadataFileReference(Assembly.GetAssembly(typeof(Console)).Location)) .AddSyntaxTrees(tree); foreach (var diagnose in compilation.GetDiagnostics()) { Console.WriteLine(diagnose); } compilation.Emit("text.exe"); } } } </code></pre> <p>Not only can we compile code with the Microsoft Compiler Platform, Roslyn. We can also analyse and manipulate the code that we have represented as a syntax tree.</p> <p>What excites you the most about the Microsoft Compiler Platform, aka Roslyn?</p> https://www.filipekberg.se/2014/09/23/whats-new-in-csharp-6-0/What's New in C# 6.0<p>I was again invited to write an article for DNC Magazine, this time on the changes that we will see in the upcoming language changes coming in C# 6.0.</p> <blockquote> <p>We will not necessarily see new keywords in C# vNext, but we will see semantic differences that will make it easier for developers to avoid boilerplate code. Some of these introduced semantic differences are much awaited and some of them are solving thinner edge cases; they are all very welcomed by the community! As the next version of the compiler is still under development, some of the language features may be taken out, some may be added and some may be delayed to the version after vNext. The evolution of C# is a proof that the language lives, people are using it and it is here to stay.</p> </blockquote> <p><a href="http://www.dotnetcurry.com/showarticle.aspx?ID=1042" target="_blank">Read the entire article in the DNC Magazine</a>!</p> 2014-09-23T00:00:00Z2014-09-23T00:00:00Z<p>I was again invited to write an article for DNC Magazine, this time on the changes that we will see in the upcoming language changes coming in C# 6.0.</p> <blockquote> <p>We will not necessarily see new keywords in C# vNext, but we will see semantic differences that will make it easier for developers to avoid boilerplate code. Some of these introduced semantic differences are much awaited and some of them are solving thinner edge cases; they are all very welcomed by the community! As the next version of the compiler is still under development, some of the language features may be taken out, some may be added and some may be delayed to the version after vNext. The evolution of C# is a proof that the language lives, people are using it and it is here to stay.</p> </blockquote> <p><a href="http://www.dotnetcurry.com/showarticle.aspx?ID=1042" target="_blank">Read the entire article in the DNC Magazine</a>!</p> <!--excerpt--> <h3>What's New in C# 6.0?</h3> <p>The next version of C# will include a bunch of interesting changes, for a deeper look at these features check out the article on <a href="http://www.dotnetcurry.com/showarticle.aspx?ID=1042" target="_blank">DNC Magazine</a>. Below is a summary of the features that we will see in C# 6.0.</p> <h4>Features we will definitely see</h4> <ul> <li>Primary Constructors</li> <li>Auto-Property Initializers</li> <li>Using statements for static members </li> <li>Dictionary Initializers</li> <li>Declaration Expressions</li> <li>Await inside a Finally block</li> <li>Exception Filters</li> <li>Null Propagation</li> <li>Binary </li> </ul> <h4>Features we might see</h4> <ul> <li>Binary literals and digit separators</li> <li>Expression-bodied members</li> <li>Event initializers</li> <li>Field targets on auto-properties</li> <li>Semicolon operator</li> <li>Using params with IEnumerable</li> <li>String interpolation</li> </ul> <p>You may also want to check out my presentation on an overview of C# 6.0.</p> <div class="video-container"> <iframe width="640" height="360" src="//www.youtube.com/embed/BA3sL783_Co" frameborder="0" allowfullscreen></iframe> </div> https://www.filipekberg.se/2014/09/12/csharp-vnext-6-0-overview/C# vNext (6.0) Overview<p>In this presentation I'm covering features we can expect to see in the next version of C#. We're also looking at some of the features that we may see in the coming language update!2014-09-12T00:00:00Z2014-09-12T00:00:00Z<p>In this presentation I'm covering features we can expect to see in the next version of C#. We're also looking at some of the features that we may see in the coming language update!<!--excerpt--></p> <p>As always, sit back, relax, enjoy some popcorn and enjoy the upcoming features of C# 6.0!</p> <div class="video-container"> <iframe width="640" height="360" src="//www.youtube.com/embed/BA3sL783_Co" frameborder="0" allowfullscreen></iframe> </div> <p>Are you excited about the changes in the next version of C#? I sure am! Although I'm probably biased as it's obvious I have a strong love for this language.</p> https://www.filipekberg.se/2014/08/31/xamarin-introduction-on-ssw-tv/Xamarin Introduction on SSW TV<p>Cross-platform development and Xamarin is something that everyone is talking about right now and rightfully so! It makes development for iOS, Android and Windows Phone a delight! I was invited to give an Introduction to Xamarin (+ some more bonus content at the end!) at the Xamarin Hack Day in Sydney.</p> <p>You can read more about upcoming Xamarin Hack Days around the world on <a href="http://xamarinhackday.com" target="_blank">xamarinhackday.com</a>.2014-08-31T00:00:00Z2014-08-31T00:00:00Z<p>Cross-platform development and Xamarin is something that everyone is talking about right now and rightfully so! It makes development for iOS, Android and Windows Phone a delight! I was invited to give an Introduction to Xamarin (+ some more bonus content at the end!) at the Xamarin Hack Day in Sydney.</p> <p>You can read more about upcoming Xamarin Hack Days around the world on <a href="http://xamarinhackday.com" target="_blank">xamarinhackday.com</a>.<!--excerpt--></p> <p>As always, sit back, relax, enjoy some popcorn and learn some Xamarin!</p> <div class="video-container"> <iframe width="640" height="360" src="//www.youtube.com/embed/9Kndm9fGUjo" frameborder="0" allowfullscreen></iframe> </div> <p>Have you found yourself around more Xamarin related opportunities later?</p> https://www.filipekberg.se/2014/07/02/what-is-xamarin-and-why-should-i-care/What is Xamarin and Why Should I Care?<p><img style="float: right; width: 100px; padding-left: 10px; padding-bottom: 10px;" src="https://cdn.filipekberg.se/fekberg-blog/what-is-xamarin-and-why-should-i-care/DNC201407.PNG" />I've had the honour to be invited by DNC Magazine to write a bunch of articles for them over the past two years and this time I got to write a piece for their 2 year anniversary issue about Xamarin! Below is an abstract from article and I hope you'll take the opportunity to <a href="http://www.dotnetcurry.com/magazine/dnc-magazine-issue13.aspx" target="_blank">subscribe to their free magazine</a>! The team begin DNC Magazine are truly making an excellent job putting together good and interesting articles and I hope you find my latest contribution interesting enough to keep subscribing!2014-07-02T00:00:00Z2014-07-02T00:00:00Z<p><img style="float: right; width: 100px; padding-left: 10px; padding-bottom: 10px;" src="https://cdn.filipekberg.se/fekberg-blog/what-is-xamarin-and-why-should-i-care/DNC201407.PNG" />I've had the honour to be invited by DNC Magazine to write a bunch of articles for them over the past two years and this time I got to write a piece for their 2 year anniversary issue about Xamarin! Below is an abstract from article and I hope you'll take the opportunity to <a href="http://www.dotnetcurry.com/magazine/dnc-magazine-issue13.aspx" target="_blank">subscribe to their free magazine</a>! The team begin DNC Magazine are truly making an excellent job putting together good and interesting articles and I hope you find my latest contribution interesting enough to keep subscribing!<!--excerpt--></p> <blockquote> <p>The past 5-7 years has been extremely interesting in the mobile world, especially considering the release of iPhones, Androids and Windows Phones. There has been a lot going on in the mobile spectrum even outside these three different brands. These three in particular share something though; they’re all easy to create applications for. This is of course subjective, it’s easier for some than for others, but if we compare the way we create native mobile applications for these three different platforms to what we saw 10 years ago; this is easier.<br/><br/> Over the years we’ve seen a lot of interesting abstractions that have made the development even easier. Consider that you have an application that needs to target all the major platforms; iOS, Android and Windows Phone. In general that meant to either develop one application natively for each platform or develop the application using a shared code principle or a wrapper such as PhoneGap. Both of these strategies for cross-platform development have their ups and downs. The problem with the first approach of creating one application natively per platform is that we need a team that specializes in each platform. That means three different teams understanding the same acceptance criteria, hence three times as expensive, in general that is.<br/><br/> The benefit of going all-in on Native, is that we get a specialized user interface and it performs fast. Compared to the approach where we use PhoneGap or similar to write an application in HTML, CSS and JavaScript that runs everywhere, the native approach wins performance and feeling wise. You can make an application good enough using PhoneGap, Sencha or similar, but it will never beat the native experience. However, write once – run everywhere has its benefits; you have one code base. This means one team developing the application, one team understanding the acceptance criteria and this means not as expensive.</p> </blockquote> <p><a href="http://www.dotnetcurry.com/magazine/dnc-magazine-issue13.aspx" target="_blank">Read the entire article in the DNC Magazine Issue 13</a>! The Magazine includes information on how you could be the lucky winner of a C# Smorgasbord ebook!</p> <p>Want to know more about Xamarin and Mobile Development? Here's a link collection of presentations and articles that I've done:</p> <ul> <li><a href="https://www.filipekberg.se/2014/03/26/xamarin-introduction/" target="_blank">Xamarin Introduction</a></li> <li><a href="https://www.youtube.com/watch?v=JwYVInQjY8g" target="_blank">Your first iOS Xamarin Studio Project</a></li> <li><a href="https://www.youtube.com/watch?v=VfoJCd_TMx0" target="_blank">Xamarin and REST APIs</a></li> <li><a href="https://www.filipekberg.se/2014/04/29/universal-windows-windows-phone-apps/" target="_blank">Universal Windows and Windows Phone Apps</a></li> <li><a href="https://www.youtube.com/watch?v=A7n4EVRPleg" target="_blank">Asynchronous programming</a></li> <li><a href="https://www.filipekberg.se/ https://www.filipekberg.se/2012/12/21/creating-a-windows-8-store-game-with-monogame-xaml-and-signalr/" target="_blank">Creating a Windows 8 Store Game with MonoGame (XAML) and SignalR</a></li> </ul> <p>Have you been using Xamarin lately? How are you finding the latest updates that include Xamarin.Forms? Leave a comment and let me know what you think!</p> https://www.filipekberg.se/2014/06/12/asynchronous-programming/Asynchronous programming<p>I was invited again to the Brisbane C# Mobile Developers to celebrate Xamarin's 3rd Birthday by delivering a half an hour talk on asynchronous programming. Asynchronous programming is more important than ever and it's extremely important to understand what is going on when we're working with it. We really want to do whatever we can to avoid deadlocks!2014-06-12T00:00:00Z2014-06-12T00:00:00Z<p>I was invited again to the Brisbane C# Mobile Developers to celebrate Xamarin's 3rd Birthday by delivering a half an hour talk on asynchronous programming. Asynchronous programming is more important than ever and it's extremely important to understand what is going on when we're working with it. We really want to do whatever we can to avoid deadlocks!<!--excerpt--></p> <p>Sit back, enjoy, don't forget to pop some popcorn and let me know if you have any questions, concerns or deadlocks!</p> <div class="video-container"> <iframe width="640" height="360" src="//www.youtube.com/embed/A7n4EVRPleg" frameborder="0" allowfullscreen></iframe> </div> <p><a href="https://cdn.filipekberg.se/fekberg-blog/asynchronous-programming/Filip-Ekberg_Asynchronous_Programming.pptx" target="_blank">Download Slides here.</a></p> https://www.filipekberg.se/2014/05/28/i-want-to-learn-programming-where-do-i-start/I Want To Learn Programming, Where Do I Start?<p><img style="float: right; width: 200px; padding-left: 10px; padding-bottom: 10px;" src="https://cdn.filipekberg.se/fekberg-blog/i-want-to-learn-programming-where-do-i-start/ReadingCSharpSmorgasbord.jpeg" />Rather frequently I get questions from friends, family and strangers asking me about what it's like to work as a software engineer. We've got a good reputation that we are well paid and have fun at work. At least that is what I've noticed people thinking about this occupation. It's not like we're paid as much as movie stars, even though some of us pretend that we are stars, but it still attracts people because of the wages and its reputation.2014-05-28T00:00:00Z2014-05-28T00:00:00Z<p><img style="float: right; width: 200px; padding-left: 10px; padding-bottom: 10px;" src="https://cdn.filipekberg.se/fekberg-blog/i-want-to-learn-programming-where-do-i-start/ReadingCSharpSmorgasbord.jpeg" />Rather frequently I get questions from friends, family and strangers asking me about what it's like to work as a software engineer. We've got a good reputation that we are well paid and have fun at work. At least that is what I've noticed people thinking about this occupation. It's not like we're paid as much as movie stars, even though some of us pretend that we are stars, but it still attracts people because of the wages and its reputation.<!--excerpt--></p> <p>While studying to become a software engineer, our class had the highest drop-out rate of all programs and largely because the misconception of what a software engineer has to do and has to learn. Some of the people just wanted to party, they would just have dropped out no matter what program they choose, others thought they would just play with computers all day. While "playing” with computers is what we do, it involves a bit more brain cells than playing an easy video game.</p> <p>When I meet up with family and friends, and strangers they often ask me: <strong>So what is it that you really do?</strong> This is the question that comes right before <strong>Wow, that sounds awesome, how would one become a programmer?</strong>. The answer to the first question though varies depending on whom I talk to. When talking to non-techie people I can't drop terms like "continuous integration”, "C#", "Azure” and whatnot; I have to use a language they understand. It's all about using a ubiquitous language, that goes for both working in and outside projects.</p> <p><strong>So what is it that you really do?</strong> I help customers solve problems, to help them increase productivity and revenue, by introducing new software, often hand-crafted to their requirements.</p> <p>This is a very wide ranged answer, it could mean anything and fit any job description. However, the follow-up questions is always to give an example. It's easier to talk about what kinds of applications I work with now that people are more used to downloading apps for their phones. Generally I tell my friends, family and the occasional strangers that I write websites or mobile applications that helps these customers solve their business problems; this to make their life easier.</p> <p>Most discussions stop here, it gets too technical when you start talking about "building websites” or "building mobile applications”. Occasionally though, you get a snappy response from someone saying: <strong>It's just a website with some fields and text, how hard can that be?</strong> That's when you give more examples which are met by a long <em>Oooh…. I didn't know that</em>.</p> <p>A bunch of my non-engineer friends are tech-savvy and I often do get the question: <strong>I Want To Learn Programming, Where Do I Start?</strong></p> <p>It's a very hard and interesting question, I could of course throw C# and a book on .NET programming in their face, but what good would that do? Is my preferred language really the best option for them as total beginners? Maybe? Maybe not. You have to consider what their goal is when asking this question. Do they just want to get a better understanding of how computers and programs work? Do they want to write prank-ware to joke with their friends? Do they want to solve a problem they're having? Do they want to make you redundant?</p> <p>First thing I try to do is of course to figure out why they want to learn programming, I think everyone should, but it's a good starting point to get an understanding of what they want to get out of it. Not that it would change my answer but it's still interesting because you can tweak the response.</p> <blockquote> <p>When you find yourself doing the same thing over and over again, consider automating that with software that you write yourself</p> </blockquote> <p>If you have a real world problem, or a real goal for that matter, it's easier to suggest a course of action. Writing the software and learning how to write it will most likely take a lot more time than just repeating yourself though, which is something to be honest about and to have in mind. However, when you've learnt how to write your first software, writing the second one should be easier or at least go a bit quicker.</p> <p><strong>I Want To Learn Programming, Where Do I Start?</strong></p> <p>It's easy to tell someone to try and solve a real world problem, but it still doesn't tell them how to go by it so what I try to do is to give them a good hand of tools to use. When recommending a tool, a programming language or a book you have to consider that it should not be a too high learning steep to get their first <code>Hello World</code> program running. If there is no fast results, it's highly likely that the person will just drop-out and give up. Programming isn't only about the code we write, it's about the <code>things</code> we connect together.</p> <p>I want the person to get the feeling of accomplishment as fast as possible, it doesn't matter if they wrote a single line of code or not, just that they put something that they can be proud of together. With the excitement of accomplished something quickly they'd be more likely to want to dig deeper and finally ready to start looking at a real programming language; be it C#, Java, Python or any other programming language out there. Early on you want the person to get into the thought process of: <code>if</code> i do <code>this</code>, <code>then</code> I want to do <code>this</code>, <code>else</code> I would like to do <code>this</code>.</p> <p>The last couple of years there's been a lot of involvement in teaching kids programming and when someone do ask me about how to learn programming that is my answer; <strong>learn it just like a kid would.</strong> How do we teach kids programming? There's a great resource called <a href="http://learn.code.org/">Code.org</a>, their approach is to let you put together programs in the web browser and it gives you a feeling of accomplishment quickly. You could for instance <a href="http://learn.code.org/flappy/1">create your own Flappy Bird clone with a personal touch</a>. This of course doesn't solve your repetitive work that you so desperately want to speed up, nor does it solve your immediate business problems. It does however get you a sense of what putting together software feels like and what it takes to connect two important pieces together.</p> <p>There's no simple answer to the question <strong>I Want To Learn Programming, Where Do I Start?</strong> but there is guidance to be given and depending on your skill and your willingness to learn, there are tons of resources out there for your disposal. Building something in the browser using Code.org is a first step to learning programming, but you have a long way to go. When you're feeling ready for the next step, you might want to pick up a good book at explains the basics of building software for your computer.</p> <p><strong>Really, I Just Want To Learn Programming, Give Me The Resources!</strong></p> <p>A lot of people just want to be spoon fed the knowledge and that is unfortunately not possible, it takes time and patience to learn programming. You will learn by making mistakes and you will get a lot of <strong>Oh wow, this is really awesome</strong>-moments. If you're really dedicated on learning how to build software for your computer, there are a bunch of books that are great for beginners. Even if you don't end up writing your own software, it's an invaluable knowledge that you will have real benefit from in this world of technology.</p> <p>When I was tutoring Java we used a book called <strong>Head First Java</strong> which turned out to be a great resource for beginners. A lot of the people in the course had never built anything for a computer before and the language and illustrations in the book really helped them greatly. <strong>Head First</strong> is a series covering a lot of programming languages and technologies, to get the least friction between where you are now and where you need to go to write your first <code>Hello World</code> program, I'd suggest <a href="http://www.amazon.com/Head-First-Python-Paul-Barry/dp/1449382673/ref=sr_1_11?ie=UTF8&amp;qid=1401064018&amp;sr=8-11&amp;keywords=Head+First"><strong>Head First Python</strong></a>.</p> <p>Dislike reading books? Then I'd really recommend checking out <a href="http://www.pluralsight.com/training/Kids">Pluralsight's <strong>Programming for Kids</strong> videos</a>.</p> <p>If you have kids, learning programming together with them will benefit the both of you. Kids generally have really interesting and good questions which broadens your mind and it's also a great reason to spend more time with your kids! Frankly, I look forward to the day I can teach my kids programming.</p> <p>After reading a book, playing around with Code.org and possibly watching some videos on Pluralsight you might feel like you're done; or you're feeling like you want more. If you want more I really suggest signing up for a university course or for a weekend/afternoon course in programming. Hopefully by then you'll have enough on your plate to build something interesting for yourself.</p> <p>That said, here's a list of links to resources that I'd suggest to anyone wanting to learn programming with no prior experience:</p> <ul> <li><a href="http://learn.code.org">Code.org</a></li> <li><a href="http://www.codecademy.com">Code Academy</a></li> <li><a href="https://www.codeschool.com">Code School</a></li> <li><a href="http://www.pluralsight.com/training/Kids">Pluralsight's <strong>Programming for Kids</strong></a></li> <li><a href="http://shop.oreilly.com/category/series/head-first.do">Head First Books</a></li> <li><a href="http://www.khanacademy.org/computing/cs">Khan Academy</a></li> <li><a href="https://groklearning.com/hoc/">Hour of Code</a></li> </ul> <p>As a final suggestion, imagine buying a little hardware, mounting it in your garage and having it signal your car when you get too close to the wall; that is something you can do with something called an Arduino. The possibilities are endless, you just need to find something that tickles your mind and makes you and your family more interested in investing time into programming.</p> <p><strong>If the discussion lasted this long with my friends, family or strangers they go away with a smile and longing to write their first program.</strong></p> <p>What is your answer to the question: <strong>I Want To Learn Programming, Where Do I Start?</strong></p>