Learning Python: The journey begins…

I’ve dealt with Microsoft technologies for most of my career, and have worked on the development side for around 15 years or so. I’m not so much moving away from .NET or giving up on .NET, but I see the landscape has changed… dramastically… and I feel compelled to make adjustments to my professional development, accordingly!

Wait, what’s wrong with .NET – what happened?
Nothing is wrong with .NET, it’s just that things are changing. Here is how I see it. In the olden days, that was easy because there were a few sub-platforms within the Microsoft platform:


Life was simple. For the most part, you were either a desktop developer or a web developer! End of story.

However, everything changed in the late 2000’s. HTML5/CSS3 came about, the mobile revolution exploded, and Windows 8 came out. These 3 things ended up fundamentally changing the landscape. Now, to me, things look more like this in circa 2015:


WinForms: WinForms/desktop development has been “dead” since Visual Studio 2008, arguably. That, along with: command-line, and Windows Services will be around forever, but there is no innovation there by anyone. That means those are legacy, and they will follow the path of COBOL. That is, they will be around forever, it will be miserable to work on them, and those will be the lowest paying jobs. If you want to work in technology, these will be the least-fun, lowest-paying jobs – in my professional opinion.

WPF: especially within the enterprise, this is a great – and large step forward. The developer can migrate to XAML and the MVVM model – all while the end-users can start getting use to a different user interface. It’s a win-win for everyone. If the developer did things correctly, the app will then be well-positioned to turn into a Windows Store “app”, or into a web/mobile app. This brings the app, the developer, and the user to more modern standards, and positions all of them ALL better.

WPF is a very effective gateway drug that helps developers AND end-users migrate to the future user interfaces.

At my employer, I will be doing what I can to introduce Modern UI for WPF as our core framework. I’m very impressed with it and think that it makes the migration to MVVM and XAML all that much easier.

Windows Store / Windows Phone / XBox / Universal Apps: this is it’s own ecosystem. Although these are cool technologies, there are not many jobs in this sector, and this isn’t really on the radar of enterprises – which is where the lion’s-share of developer jobs are. So, it’s not that I don’t like these technologies, I relegate them to “hobbyist” or “entrepreneur” status, because those are the only ways in which I’d invest in those platforms.

ASP.NET: Here is the tricky one. Have you see ASP.NET vNext? It’s really a big departure from everything we know. That’s OK, because the web world has been changing just as dramatically. Notice how we went from mostly server-side processing to mostly client-side processing? Look at how the responsibilities have migrated from the server to the client, in just the last few years:


For web applications, for me, at this point – all I really need is SOME web server to host my HTML because I’m going to write a web application in AngularJS. That means the only thing I need the server for, is for AJAX calls. The ONLY thing I need from a web server technology now, is a way to get JSON data and that’s it.

So, what was once the HUGE silo of ASP.NET and it’s supporting technologies, has been relegated to a mere data vending machine!

So, just like a fraction of 64 over 128 – you can tell just by looking at it that it can be reduced; simplified.


I see the same thing with web technologies. First, we’d bring back all of the data when a page loaded, and then use AJAX to get updates. Then, we started having some pages that just return HTML and jQuery and ALL of the data loading is done by the client side! When I “reduce” and simplify that in my head, I see that the “future state” is that the app is loaded into the browser, and all of the data is to be retrieved from REST service calls. There are already many apps that work that way, and it’s my belief that is the future.

There is simply no need for a server-side “stack” anymore. We just need something to handle OAuth and AJAX – and something that can server regular html/css/js files. If that is what ASP.NET will provide, that isn’t such a big deal anymore. In fact, if that’s all that we really need – LOTS of technologies could easily handle that. The advantage of ASP.NET was that you had this whole stack which did so much for you. Now, if we go client-side, ASP.NET doesn’t really stand out anymore, does it!?

So, what is the “future” of ASP.NET? Well, in addition to Web-API, they are still talking about MVC – but in my professional opinion, that is basically irrelevant at this point. No one would build an MVC site knowing what we know now. Everyone wants a dynamic, responsive site. You do that with a client-framework (like AngularJS) and you get all of the data you need from REST services. Those services COULD be Web-API – but they could also be any number of other technologies.

Where does that leave the average .NET developer?
In short, it’s time to move your butt! Not move away from .NET – but expand your horizons:

  • If you only know WinForms, learn WPF (and even Modern UI for WPF – that will help!). If you don’t, you job prospects will/already-are dwindling and you have likely hit your salary ceiling!
  • If you only know ASP.NET WebForms or MVC, learn Web-API and ideally a client-side framework, like AngularJS. If you don’t, you will be stuck in that world where there is no innovation, and you will likely not make any more money.
  • If you are up for anything, do the above – and now is a great time to look around for other technologies that capture your interest. The Microsoft development footprint got dramatically reduced, so it wouldn’t hurt to keep an eye for other opportunities, right?

For me, ASP.NET has all but been eviscerated. The only relevant thing left is Web-API and SignalR. Within vNext, those are really the only things from ASP.NET that are on my radar. However, I don’t really want to build my whole career around that. Plus, outside of work I’ve been expanding my horizons and I found a very interesting lily pad to which to jump…

Introducing Python.
I was/am only peripherally familiar with Python. I see it everywhere, and the syntax seems to be very simple and clean. I say “introducing Python” when I myself, barely know it. However, I have been extremely impressed every step of the way with it. So, despite me being a novice, let me see if I can maybe sell you on it.


First, what can Python run on? You name it! C-Python, the main interpreter was written in C. Where can C run? Everywhere. Likewise, here is a short list of just some of the OS’s who fully support Python:

  • AS/400
  • DOS
  • OS/2
  • z/OS (mainframe)
  • Solaris
  • OpenVMS
  • HP-UX
  • Raspberry Pi / Banana Pi / Orange Pi
  • Every distribution of Linux…
  • Every version of Windows…
  • Every version of Mac OS…

Wouldn’t it be amazing to write code and have it just work on any platform? Not “most” platforms, but EVERY platform? I of course am talking about console or server-based applications – GUI’s are where things get complicated. So, in terms of web servers or web service technology – can you see the potential?

Next, it has a package manager! It’s called “pip”. As you might imagine, if you need a package, you just called “pip install [package-name]” and it’s that simple. Since you are working with an interpreter versus a compiler, all packages are available on all platforms (as far as I know).

Remember I was saying that the future of web development is now all about a client framework which needs to make AJAX calls to a REST web service? Well, imagine if that was written in Python. That would mean that you could write robust, rich web applications which run on everything from a Raspberry Pi, to a VMS Alpha or z/OS mainframe – all with the same code. That’s a very exciting prospect, to me.

If you are coming from .NET, you might say “Yes, but Microsoft is branching out now! You will be able to use the KLR and write apps which run on Linux and Mac OS!”. True, and that is very cool – but Python addresses more problems, for me.

So, in summary Python buys me:

  • Runs every server environment that exists.
  • Has a simple, easy syntax.
  • Has very robust developer community.
  • Truly has “write once, run everywhere” – because it’s interpreted.
  • Has cross-platform package manager.
  • Opens up more computing platforms.
  • Makes you more marketable / creates more opportunity.

For me, this makes a lot of sense.

Getting started with Python, for the .NET Developer:
My first exposure to Python was on the Raspberry Pi, playing around with little programs I found to use on it. I found the “barrier to entry” to be very low. Usually, when learning a new technology, I find a lot of obstacles:


but with Python, I was constantly finding “welcome mats”:


with people, websites, blogs, sample code being VERY helpful. I was quite surprised at just how helpful the community is – my kind of people!

So, if you are a .NET developer, where do you start? With Visual Studio, click File –> New Project and choose Python. There will be a project template which tells you how to install the Python Tools for Visual Studio – see the following:

Python Tools for Visual Studio – Overview

Python Tools for Visual Studio – Download

In particular, check out the video on the main page of the CodePlex site – here it is, it walks you through the whole process and gives you a general feel for it:

As you can tell, Python in Visual Studio is not some afterthought – this is a major initiative, and a first-class-citizen! There is deep, robust support from the REPL through to the debugger, and even tying in with MSTest! So, when I talk about “welcome mats”, this is the first example:


There are complete templates and wizards for each of these! Django is perhaps the most popular web framework, and it gives you the equivalent of a default ASP.NET project – except in Python! Not to pick on F#, but that is one of my criticisms – you can only create class libraries or command-line projects with it!


That means if I want to create a web app (a very reasonable request), before I do anything else, I have to pioneer how to create a web application with F#, troubleshoot that, THEN I can start using the language! That creates, to me, a very high barrier-to-entry!

Back to “welcome mats”, on the Raspberry Pi platform (which runs Raspbian Wheezy, a Debian-Linux variant), Python and pip are easy to use, and the “nano” editor understands Python syntax and gives me color coding!

Here’s an example of using pip (the package manager) to install a module called “memory_profiler” on the Pi – very simple:


and in the nano editor:


So, as I was playing on the Raspberry Pi, I continued to find “welcome mats” everywhere I looked, with Python. The above is on a Raspberry PI, here is the same thing on a Mac:


and the same thing on Windows:


Now THAT is cross-platform! I REALLY like that once you learn what you need, it simply applies everywhere: Windows, Mac, Linux, Pi, whatever!

What about the actual language, itself?
Yes, all this talk of popularity and interoperability, what is the language like? Well, it’s dynamically typed – not my favorite. Worse, is that as you’ll see below, those aren’t really “variables”, they are just sort of names for values – because there is no strong-typing. The philosophy, and it is a purposeful philosophy, is that you should publish your intentions with good names, and “”” comments – and if errors happen, just let them bubble.

As an example, you can set a variable to be an integer and then immediately set it to a string. That means the compiler and run-time can’t really help you – it puts the onus on the consuming developer to treat your object right!

But with that said, the syntax is very straight-forward. In fact, if you know any other programming languages, here is a quick sample which might answer several of your questions:


That has many of the basics: creating a class, defining a property, defining a method, Intellisense comments, if..then logic, how to make an constructor with optional arguments, etc. Double-underscore is how you make something private, which is why self.__dateOfBirth is decorated that way. “self” tells the run-time that the member is affiliated with that class instance.

Again, I’m still very new to this language and the technologies behind it, but like I said – I like what I see so far, so I’m working on getting to know this language and platform better.

Bottom line:
If you are .NET developer – start with Python Tools for Visual Studio. If you are going to do web development, start with Django. I know very little about it, but I do know that it seems to be the most popular web framework and it’s supported everywhere. Even better, this is always a good sign:


11.6 million results on google – so chances are, you’ll find your answers!

For me, that is my “jumping off point”. I want to see if I can bring up a web service + AngularJS site on a Raspberry Pi. If I can do that, I think I could get a website going just about anywhere. In reality, I plan to start in Visual Studio and get some similar going here first, since it’s a more familiar environment to me.

I’m kind of excited to dig in! In addition to staying current with .NET, I expect to also start including posts about various accomplishments in my Python education too – so stay tuned!

Posted in Computers and Internet, Development Tools, General, Python, Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.


Enter your email address to follow this blog and receive notifications of new posts by email.

Join 9 other followers

%d bloggers like this: