microsoft

Microhyde and FrankenSoft

Microhyde and FrankenSoft

I've probably written this post a bunch of times over the years, some versions only in my head, others languish in my drafts folder.

This post is about Microsoft, specifically the painful lessons of their legacy and their marching into recreating a whole new set of painful legacy problems for the next generation.

Windows - not so smooth operator

I'm not really sure who is running the OS Division these days: Engineers or the Sales and Marketing departments. They appear to have been at war with their users for some time. Perhaps it's always been that way and I just didn't notice.

From the days of IE anti-trust lawsuits or of Bing's attempts to counter Google search, Cortana as a response to Siri, the envy of seeing other App Stores ecosystems thrive while MS Phone store withered and died (I loved my Win phones too).

Search market share

The rise of tablets and mobile computing, which recently saw Android become the most used operating system, has seen Windows make ever more user-hostile attempts to maintain its market share and relevance.

OS market share

The dirty tricks employed during the 'Upgrade to Windows 10' SaaS campaign defied belief at times, so hostile were they to those who simply didn't want it following the version 8 and 8.1 disasters.

The 'hints' that chrome is slow and "wouldn't you like edge instead" are a throwback to the IE-bundling behaviour that I think isn't really working out.

Brower market share

The latest round in the OS-war on users is the introduction of adverts in the disappearing/reappearing start menu. I cannot imagine this is what users actually want.

For the time being, however, windows is still by far the dominant desktop OS, but I do wonder if the Windows 10 stats would be quite as high if they hadn't tried every trick in the book to force users to upgrade.

Desktop OS Marketshare

I get it, though. I'm not their target demographic, a developer, a power user with no interest in an closed-ecosystem app store and no desire to use even a fraction of the 'features' like Cortana, Bing, Edge etc.

The problem with this thinking though, is that there are the millions of people like me who help their families with their computers, who advise businesses on future technology and who develop the ecosystem of non-MS produced applications that help make software ecosystems successful.

Windows OS Marketshare

The admittedly hilarious Ballmer chants of "Developers, Developers, Developers" ring somewhat hollow these days when it comes to the OS side of things. I'm sure their dominance on desktop still makes developing UWA's for the Windows 10 store financially appealing, but with cloud and mobile apps now dominating overall, there is more incentive than ever to spend your development dollars elsewhere.

Full disclosure here, if it wasn't already obvious: Having used windows since it came on 5 multi-coloured 5 1/2 inch floppy disks, last year, I have mostly ditched it for Linux Mint as my daily OS and I really don't miss it.

The only thing still keeping me on Windows is Visual Studio and my work (which is on Windows 7 with no plans to upgrade at present).

Windows just seems like a hostile environment these days because I choose not to use their 'features'.

Browsers & the law of unintended consequences

I remember that Internet Explorer as far back as version 3 produced IE-only features baked-in to the browser. Further, the browsers have consistently been baked-in to the operating systems.

Given the life spans of XP, Windows 7 and IE versions 6-9 with its platform dominance - doubly so in corporate environments - there were, and still are, a huge number of applications written as 'optimised' for IE (an oxymoron if ever there was one).

As a developer who worked on and off with SharePoint and CRM for many years, each new IE browser often crippled these applications and would start the 'compatibility-mode' bum-fight which is still continues to this day.

Rewriting any software that extended these systems every three years was a game that got really old, really quickly.

Worse still, are the silent mass of desktop applications that use the 'embedded browser' control with embedded content that is 'IE optimised'.

Further compounding these problems, the compatibility-mode renderer wasn't even consistent between later versions of IE.

The decision to bake in browsers to specific operating systems is arguably one of the worst, most backwards-compatibility-hostile acts of enforced obsolescence in the history of computing.

Consider how much time, effort and money must have gone into rewriting broken browser-based applications. It must surely be measured in billions of dollars.

Chrome, far and away the most popular browser on the planet, as well as Firefox, Opera all have cross platform versions. There is no reason for a browser to be baked-in to an operating system.

And now with Edge, only available on Windows 10, it's more of the same. Edge, at this time, feels more like an alpha product to me, some way behind all the major browsers.

Both IE and Edge still don't support Server Sent Events (SSE) - perhaps because they have an abstraction for the transport selection in SignalR - but it's a notable omission which has been under review for years now, along with a number of other features already supported by all the other major browsers.

CSS Grids recently provided an example of the difference between the major browser vendors' approaches.

CSS Grids

Edge nor IE was among them.

One of the most interesting and exciting features that has the potential to create a tectonic shift in web development is WebAssembly. Again, no Microsoft representation here either.

If you, like me, still to this day, have to cope with the issues surrounding a bunch of IE-optimised (embedded like a blood-sucking tick) applications in your environments, perhaps you understand where I'm coming from.

These compatibility issues cast an extremely, EXTREMELY long shadow.

Microsoft themselves must have viewed the IE situation as unrecoverable from a reputational point of view to have effectively tomb-stoned IE in favour of Edge on Windows 10. Yet they chose exactly the same approach of baking-in Edge to the OS.

They really haven't learned from their past here at all.

Appetite as a measure of success

When .Net first came out, there was a quick uptake. It was a clear improvement over classic ASP. The framework had plenty of pain-points but it shipped alongside tooling that let people write production-ready apps from day one.

When .Net MVC came out, there was a quick uptake and a viable path to launching production-ready apps. Again, it was a great improvement over WebForms by decoupling the markup from business logic. Improved testing, much better extensibility and streamlined execution pipeline were the motivators to switch.

However, again, there were pain-points for those creating large-scale apps baked into the MVC design.

Other .Net MVC frameworks arose in this time as a reaction to those pain points such as Nancy, FubuMVC and ServiceStack.

Many developers also left .Net altogether as alternatives like NodeJS or Ruby on Rails came out. Many '.Net is dead' 'Why I'm rage quitting MS' posts were written.

Let's be clear: this post may be one big gripe directed at MS, but I'm not quitting .Net. I think it has a bright future, in fact, more so than at any other time since it first came out.

MS tried to reinvent JQuery with their own JS DOM abstractions but after a number of years gave up and threw it under a bus. Same with their JSON deserializer. They introduced the service locator pattern!.

There is nothing wrong with reinvention as an attempt to compete and improve. May the best one win....but using the platform, defaults and tooling to create lock-in generates chronic long-term pain and a ton of legacy apps out there that will struggle to be refactored around the baked-in designs which require a more scorched-earth approach to update.

There is a larger issue here with the introduction of .Net Core, however.

How a cloud fought an emperor and x-plat was reborn

Azure runs on Linux, in fact most, if not all, the major cloud platforms run on Linux. SQL Server is going to run on Linux. Visual Studio for Mac shows a non-windows IDE is possible. So I expect sooner or later that it too will run on Linux (especially if Project Rider proves popular). Windows resurrected its POSIX/Linux subsystem and, again, it wouldn't surprise me if the future of windows is as a Linux distro.

So it's not that surprising that .Net Core was announced to much excitement and enthusiasm. I shared that enthusiasm and still do. It opens up choice and some genuine competition. People can choose the OS and development stack they want knowing that there won't be feature-disparity or lag between platforms. Creating cloud apps for Linux reduces licencing and hosting costs.

At NDC London last year, Scott Hanselman quipped that Microsoft didn't really care which platform you ran on, they just wanted your for loops on Azure.

It goes further than that, as you're not tied into Azure either. You can choose any cloud provider and that's really great for driving healthy competition.

Version 1.0 and 1.1 are out and 2.0 is on the way. It's a grand effort to re-imagine .Net cross-platform without the split effort of mono as well as fixing some mistakes of the past. I love that!

So, now, we are a year or two into .Net core but the landscape is very different from the original ASP.Net and MVC introductions.

They aren't releasing something new, so much as re-creating something that already exists, but cross-platform and without the framework installer dependency. From this huge undertaking, understandably, there's a lot of 'stuff' missing from the initial releases.

However, rather than focus on this missing stuff, the debates on GitHub revolve around reinventing established frameworks (including MVC), libraries, concepts and of 'baking-in' anaemic versions of popular full-fat .Net libraries, rather than focusing on feature parity, tooling and migration.

Their OSS efforts here are definitely an improvement. When you see the sausage factory in action though, it often isn't pretty.

But publishing your source code online isn't Open Source. Nor is steering your language, tooling and frameworks in ways that drive your parallel commercial interests.

There is a fundamental conflict of interest here that few other development communities have to deal with.

One of my main gripes here is not that they changed their minds numerous times throughout the process - that's entirely fair I think - but that they split the platform and tooling efforts.

In their honest desire to join the club of increased release-cadence, the split in tooling support has crippled many developers' efforts to port early versions of their established projects to .Net Core.

Even with two versions out and the third imminent, there are remarkably few libraries shipping with multi-targeting for .Net Core and I suspect even fewer production apps out there in the wild running on Core.

There simply isn't nearly the same uptake that happened for .Net and .Net MVC either.

Their packaging, tooling and versioning schemes have been confusing and disjointed. Their seeming willingness to throw established well-maintained OSS projects under the bus by baking-in the lowest common denominator abstractions is confusing as well.

The effect, even if they end up dominating the space, is that 'baked-in' is always expensive and painful for applications to 'bake-out'.

It's a preference for frameworks over libraries that creeps in over time. A lack of using simple dependency-free components that when chained together become greater than the sum of their parts, i.e. the Unix philosophy in action.

Breaking compatibility with both tooling and frameworks ends up isolating and atrophying applications that become enslaved for those who can't expend the resources on yet another rewrite/upgrade.

It is the kind of scenario in which many experienced developers, so valuable to the ecosystem, just give up altogether for alternative languages and platforms.

It's hard for me not to view all this as wasted energy, of building monoliths, while they, along with the industry, preaches on the value of reducing complexity through building components with clearly-defined boundaries.

By not focusing on educating developers and decoupling their own products, aren't they just storing up the next round of future backwards-compatibility headaches and perpetuating the problem all over again?

The root cause, is a lack of educating, teaching, guiding.

You don't teach kids Maths by giving them a calculator. You first show them how to do it themselves. THEN and only then do you give them the shortcut tool.

Should it really be Microsoft's job to teach, however?

They are, in the end, a business, there to sell products and make money. They are not a charity or educational institution.

Their desire to give developers ready-made solutions to provide the quickest possible productivity-gains makes sense from an IDE perspective; but when this bleeds into the frameworks and tooling, I think it just perpetuates the industry-wide epidemic of failed software projects and quite frankly industrial-scale mountains of crappy designs and code.

My view is that in the long-term this approach does much more harm than good.

Whether they view it as their responsibility to improve the overall state of the industry or not, the effect of providing OOTB designs that developers don't properly understand and which are poorly implemented nor explained, often results in predictably poor applications.

Over time, the cumulative effect is that it's not the application developers who suffer but the language, platforms and tooling that get a bad reputation as being responsible for producing poor software.

So they ocean-boil and re-brand, now it's new, shiny and all better, you just have to rewrite all your apps again.

It's the law of unintended consequences again, and this thinking displays a lack a reverence for learning from past mistakes and looking at the underlying motivations for these repeated patterns of re-invention.

I know, it's easy to criticise the big guy, but I've read so many threads, thanks to the openness of the process on GitHub, where MS have been warned repeatedly about the choices they are making by well respected and experienced developers. In too many instances IMO, they have paid no heed.

Mac attack!

Scott Hanselman recently called me out on some hyperbole in a reply on GitHub.

comeuppance

He was absolutely right, of course. I have nothing but respect for Scott, always a voice of reason, a nice guy, a gentleman, and I did make a silly comparison in my first sentence of my response.

What is a shame, though, is that my tongue-in-cheek hyperbole undermined the rest of my point. He really didn't engage with what I was trying to get across about 'reinventing' and efforts towards tooling.

I've lost count of how many times I've seen tweets like this one in my timeline just today.
I see this a lot

I'm sure both Microsoft and other .Net developers will disagree with me on this, but I think they ARE wasting time re-inventing things; there HAS been a chronic lack of focus on the tooling and there IS more than an aroma of ocean-boiling going on in a few areas.

It's one thing to focus on shipping features in MVC, Razor, SignalR etc when you have the core stuff down.

No, my poorly-worded off-topic point, was that only when you have the basics right with .Net Core's tooling, should the focus then be on delivering the frameworks and framework-tooling to build on top of it.

Creating shims over yeoman, MSBuild, Nuget, test runners etc is not advancing the core areas, and it just looks like they are trying to copy the CLI's of others out of a fear of being left behind somehow. It brings nothing new to the table.

They really haven't got that part right at all.

MSBuild

Looking through the now open-sourced MSBuild code is like stepping into a decade or two of cruft and backward-compatibility bolt-ons.

Now, that isn't unusual, a lot of critical long-lived projects end up like this but I would far prefer that more of their considerable resources were focused on tidying this project up and improving it for the next generation of application development. There is so much more they could be doing here.

The MSBuild sourcecode is laden with feature-based pre-processor directives to cleave off platform-specific code. This IMO is code-smell that should have been be refactored and logically grouped into feature-specific abstractions and implementations.

It reeks of bolting on x-plat support in a hurry.

The logging and error handling is sprawling and hard to follow. The collections, immutability, async, scheduling and queuing are bespoke implementations that look like they haven't been updated using the advances made in those areas in the .Net framework. Maybe that's just my failure to grok the code though.

My biggest bugbear by far, however, is the project system.

Laden with Visual Studio and Windows-specific hooks for SDKs and options for things installed with Visual Studio, this is the cause of so much developer pain.

I personally have spent far too many hours of my life working around this stuff.

The build system is the bedrock of any stack, it is the core of organising, compiling, tooling and continuous integration. So to have heard so many times over the years the same old discussions around "install the IDE on a build server" for solving CI issues should be an obvious red flag for discomfort, like an infant-behind-you-screaming-continuously-on-a-12-hour-flight obvious.

Out of this pain arose an army of VS plugins, MSBuild shims and, in more recent times with the arrival of Nuget, packages that counteract this M.A.D. coupling between IDE and Build system.

Why should it be left to the VS EnvDTE to be able to manipulate a project, adding files or folder or changing configuration settings? It's awful stuff to work with.

At this time, there still isn't a set of MSBuild nuget packages that you can reference to load, parse and manipulate a project prior to compilation sans-Visual Studio.

MSBuild is being worked on and their roadmap shows that they are working towards a dependency-free x-plat nuget package, but there is no timeframe for this.

Given that we are nearly 3 versions in for .Net Core, it clearly hasn't been given the same prominence or resources as the 'shiny stuff'.

Microsoft won't back-port either the tooling for .Net Core projects to VS 2015. This, again, is likely because of coupling.

Yet, in the Roslyn and typescript compilers, they showed clearly that they understand why this separation is important and useful.

You can watch Ander's discuss the how and why in this great video on compiler construction and you might get a sense of why I think MSBuild is sorely lacking a VS-decoupled project as a service API.

Roslyn

Roslyn was a huge undertaking by Microsoft that genuinely did something unique in the compiler space no one had done before.

All compilers (that I know of...) before were black boxes where source code and settings went in and artifacts came out.

Every implementation of intellisense had to effectively recreate the lexical parser of a compiler, and often the semantic model too if you wanted things like type-checking or flow-analysis in your IDE.

Roslyn's remarkable abilities exposed these things as consumable services which allowed any IDE to leverage them. One implementation, provided directly by the compiler.

Anders discusses in that video above how the same approach drove them when they were building the Typescript compiler.

With Roslyn, the compiler black box is no more, it's a rich pipeline that when you tap into, can be leveraged in amazing and interesting ways.

One huge disappointment with Roslyn is that they stopped short when it came to adding compile-time hooks for sourcecode rewriting and generation to enable all sorts of interesting AOP-style projects to be born.

Roslyn has been RTM'd nearly two years now and the uptake for design-time code analyzers and fixes has been healthy, but there still isn't a good story around compile-time hooks.

It is a hugely difficult problem when you dig into it, but, it is the type of feature that can only really be delivered by the language teams, and not, as I have frequently read in response to requests for it, "we are waiting to see what the community comes up with".

IMO it should be prioritised over every other language feature for one reason.

It has the potential to create an entire ecosystem of libraries, tooling and innovation around it. Advances like pattern-matching and record types whilst important, do not.

The best option for compile-time code generation currently available for Roslyn seems to be Andrew Arnotts CodeGeneration.Roslyn. It's a great start at wiring up the build hooks for doing attribute targeted generation but it is still only capable of nibbling at the edges of this feature.

Zed's dead baby, Zed's dead

MVC vNext briefly created the ICompileModule with a weird folder/file hook convention for compiling MVC Razor views, a similar but again limited approach to source generation, but this was scrapped in favour of source generators.
A feature, as yet unreleased, that again looks somewhat stilted from the docs and with a demo project that references non-existent packages (publicly at least).

The opportunities in this space are immense, like eliminating lots of expensive run-time reflection or expression-heavy code.

The next object mapper could just generate left right code.
DI containers could achieve invocation performance parity with new Foo() without compiled expression tree trickery.
The next Postsharp or Fody AOP framework could just re-write the code instead of expensive ILWeaving.

It's disappointing that this hugely difficult but interesting problem hasn't been more of a priority so far.

S'all bout the bootstrapping y'all

Microsoft have talked a lot about wanting to streamline the process of on-boarding with .Net Core using CLIs, templates, etc.

Yet when fundamentals like the build and tooling dependencies are not explicit and instead powered by magic or coupled to an IDE, you end up with projects you cannot just clone, build and run. There ends up being steps to install this, configure that.

So when a new IDE version comes out and you're building on a cloud platform that doesn't yet have part of that IDE installed on the virtual machine images, well sorry, you're out of luck.

Now, they have made progress of sorts in this area. On the 3rd March they announced Visual Studio Build Tools as part of the VS installer. Its back to the installable-SDK approach for CI environments but it's still coupled to the VS installer for some reason. No other build tool does this kind of stuff. It's an archive file or a single binary usually.

There also recently released VSWhere but, again, is just a Band-Aid on the issue of not being explicit about the build tooling and resorting to 'find dependencies by magic'

They just seem to have an eternal blind spot when it comes to this stuff.

The build and tooling should be independent from the IDE. Period.

Going further I'd like to see the IDEs consume an MSBuild project service, much like intellisense and analysis with the Typescript and Roslyn compilers.

Part of the reason for this coupling between IDE and building, I think, stems historically from TFS. A build server with all the same shared guts as Visual Studio and shipped together. It was easy for Microsoft to just recommend using both, and all those coupling issues were solved.

I'm old enough to remember when Microsoft charged enormous fees for TFS. In the face of rising competition from CI servers like TeamCity and Jenkins they basically started giving it away.

Now with the rise of cloud and online VCS providers like GitHub and BitBucket, services like AppVeyor are once again transforming the CI server landscape and TFS (or Visual Studio online) are further away than ever from dominating in a more competitive ecosystem.

Maybe this dual VS/TFS coupling was done to block competing IDEs and CI servers; perhaps it largely worked in a windows-centric, MS-only corporate environments before the cloud was even a spec on the horizon.

With the rise of cloud CI services and the imminent arrival of the first credible Visual Studio contender in JetBrain's Project Rider, there has never been a more compelling reason for Microsoft to ditch these old coupling tricks.

JetBrains IDE's

One only has to look at the foundations of Rider's IDE to understand that when you don't have a platform or ecosystem that locks in developers for visibility and market share, you cannot provide a substandard tightly-coupled product and still hope to succeed.

Jetbrains built their own lexical parsers for a wide range of languages that the ReSharper core uses, along with a unified plugin system that is powered by the same x-plat IDE.

This isn't an accident. It's a good business strategy that doesn't try to take customers hostage to up-sell them TeamCity or YouTrack.

Each has to live and die on its own merits.

The road to hell is paved with good intentions

Now I've been bashing Microsoft here a lot, but I'm not one who subscribes to the "Microsoft is evil" camp. I don't believe they are malicious or hell-bent on destruction or anything like that.

There are plenty of really great, hard-working, honest and sincere people working there who only want to do good.

They're a big corp, lumbering...yes, sometimes overbearing, misguided plenty and often confused as a result, I think any organisation that size suffers from the same syndromes.

For developers, since the introduction of .Net and with Scott Guthrie at the helm, things definitely improved a lot in a lot of areas over the years.

Creating the closed ecosystem is old Microsoft thinking.

I'm just not sure that new Microsoft thinking is any different when it comes to its tooling...

yet.

what do you think?

Typescript is great but...did MS just tell me to go **** myself?

image by @jrecursive

tl/dr

TypeScript is great for c# developers but the deployment pipeline is a crummy afterthought.

The what...

I work on some web apps that have lots of javascript. I've been working with web apps for years and there are some areas I feel I can write clean, sensible code. Javascript has never really been one of them.

Part of that, heck most of that, is on me as I'm too lazy to care about things like block vs function scope and callback contexts.

The why?

I'm not a fan of the (function(){ bracket soup; })() and weird var _this = this; stuff that goes on. It all looks so unseemly and I just never feel that productive coding in it.

I've tried (and failed) with the less brackety coffeescript and perhaps it was the tooling, but spending ages looking for the rogue whitespace or incorrectly indented function had me reaching for the asprin and a gun.

Part of our apps were written in coffeescript. They worked ok, but it hadn't been smooth sailing and the code just didn't seem well structured, nor I that productive.

Enter typescript (yass)

Yet another superset. Nothing to see right?

Perhaps it's less jarring from switching between c#, where I spend most of my days, or maybe its because I'm refactoring existing code but when I started experimenting with porting some of our code away from pure js or coffeescript implementations, something magical starting happening.

I started enjoying writing client-side script and my productivity went up; way way up.

Training Wheels

Modules, classes, interfaces and straightforward preservation of scope with lamda style syntax just made me feel at home. The type-checking appealed massively to my desire to have tooling which could help me spot the howlers, I like training wheels on my dynamically typed languages.

Within a short period of time, I had worked my way through a bunch of existing code and it was cleaner, more composable, easier to extend and with fewer errors thanks to the type checking. I think this stuff can scale nicely.

So I'm ripping through code conversions like a boss and having fun doing so, figuratively drunk at the wheel...

When a couple of guys who were up to no good...

starting making trouble in my neighbourhood.

  • Unit testing
  • Deployment

I usually run unit tests as part of deployment so its only one thing really, but the fresh prince quote was too tempting...I digress.

So after a bit of googling I found a few candidates, chutzpa, tsUnit and I already use R# with phantomjs.

One problem with all these is with handling external references and having to reference both ts and the js files for dependent libraries like jQuery et al.

Now typescript tooling, as of VS2013 Update 2 RC made a mistake IMO by automagically adding or inferring all your script references and going ape-daft when you reference js files from ts files. So now one has to add chutzpa only references or for R# keep a second copy of jquery.js named as jquery.ts for testing...seriously?

So leaving aside testing for a moment to running things on a build server ...

oh wait, it wont run on a build server...

So ts files are created in your IDE and it goes like this...

  • MSBuild properties and targets are imported into your .csproj file
  • You get a project property page giving you some options
  • A 'TypeScriptCompile' buildaction for your .ts files
  • Generated js and optionally js.map files are not added to the project
  • the compile tsc.exe is installed in %programfiles32%\Microsoft SDKs\TypeScript\IHateBuildServers
  • the build props and targets are referenced from %programfiles32%\MSBuild\VisualStudio\Vx.x\TypeScript\IHateBuildServersMore

Now I've had my battles with MSBuild targets and SDKs for clickonce, licensing transforms, satellite references and publishing before and each time I feel like the MS guy on my side was off that day. I'm not alone in wanting better.

Installing things on build servers can be done but is not my preference. A more portable solution is to check it in to source control

The build friendly thing to do, would have been to use nuget to deliver both the compiler and build targets sans VS integration so please vote for the issue above if you agree.

Going further, I want much more control over my js build pipeline than ECMA version, js maps and AMD, CommonJS support and remapping base paths. It should be easy to use my own pipeline for bundling, minification, obfuscation etc.

To misquote Kanye...

Microsoft doesn't care about build processes

Please MS, sort this hot mess out!

I really like TypeScript, I really dislike deploying TypeScript.