Posts tagged C#

.Net’s Stagnation and Brain Drain

Recently Justin Angel posted an essay he’d written titled “The Collapse of the .Net Ecosystem, V3”. It’s an interesting read and very well could be flawed in many meaningful, statically and logical ways. But if you haven’t popped your head up in a while there are noticeably less .Net jobs then there were in 2006-2010. This could be relative or absolute, but when I was looking for a  job a few years ago the C#/.Net listing were few and far between.


The jobs that are out there aren’t at startups, they mostly aren’t working on solving interesting problems, they are Line of Business applications.  Head over to and see how many of their 8,400+ startups are using C#, hint it’s less then 2.5%.

There is nothing wrong with Line of Business applications or enterprise app development. You can make a very good living doing this and get to work on some cool stuff, maybe. But without new people, new ideas, different points of view and fresh perspectives the .Net Community becomes an echo chamber. As a whole it will lag behind other more cutting edge development techniques and methodologies because we aren’t exposed to them, as people aren’t flocking to be .Net developers.

You may be saying to yourself, “That’s fine I don’t want to work for a startup anyways” and that’s a perfectly valid opinion. But it’s undeniable that startups attract the younger developers, who can take the risk and the commitment to the startup pace. These then become the next generation of enterprise developers. If there are only a handful of .Net startups what does that say about the possible new input into the .Net Development collective? How many developers are leaving? I’d bet you we have a net loss in people leaving the .Net community verses new minds coming in. As I sit here the path that is currently laid out for .Net developers is the track languages like COBOL followed.

For the last few years Stack Overflow has done a developer survey. You can head over to SO and check out the results. The section I want to focus on is “Most Popular Technologies”. Here you can easily compare 2013, 2014 and 2015 trends.


Here is the breakdown for C# for the last 3 years:

2015 2014 2013
C# 31.6% 37.6% 44.7%

In 2 years C#’s popularity on SO has dropped 13.1%. To be fair JavaScript dropped 4.5% as well from 2014, but they call out Node.js (13.3% and AngularJS 13.3%) and Angular didn’t have any numbers for the 2014 survey. The trend may not be alarming to all, but at a minimum it should let you take notice and stock of what the future looks like.

.Net will be around for a long time, but in 5 years how much new development will be done in it compared to how much maintenance? What about in 10? I love the C# language and the .Net Framework, it’s elegant, complete and very capable. But would I want to just fix bugs on a 10 year old legacy system day in and out with it? Sure you will be able to find C# work, but is it going to provide the challenges that keeps us developers engaged and provide job satisfaction?

I don’t blame Microsoft for this (ok maybe just a little), they are responding to what the market wants. You can’t continue to just push you language/framework as the only way to do things. Hell even Apple announced that they are open sourcing Swift. But times have changed, in the past you needed to do .Net for Windows development. Web application weren’t very good and to build any decent Windows Apps you used .Net. Eventually those Windows Apps got ported to ASP.Net, then ported to MVC. We went from Windows where really only C++ and .Net mattered to the Web where, well lots of things matter. Now to build a “Metro” app you can JavaScript or C++, no .Net required and there are tools to utilize “Metro” apps in the normal desktop.

I think with Microsoft Open Sourcing a good chunk of their ASP.Net stack they can compete better with Java, companies that don’t run Windows can use straight .Net now on their Linux/Unix boxes. Yes there was always Mono but that never really took off as I had hopped. So there is some light on the end of the end of the tunnel, hopefully it’s not a “No Exit” sign.

Resgrid is a SaaS product utilizing Microsoft Azure, providing logistics, management and communication tools to first responder organizations like volunteer fire departments, career fire departments, EMS, search and rescue, CERT, public safety, disaster relief organizations, etc. It was founded in late 2012 by myself and Jason Jarrett (staxmanade).

Milo Engineering Problem #2

I’m a fan of Ted Dziuba and enjoy reading his blog. I follow his twitter and he sent out a tweet a couple hours ago, apparently Bryce over at SctollingText posted his solution to his company’s (Milo) engineering challenge. You can take a look at Milo’s Engineering Challenge #2 for yourself. It’s a great little logic problem and engineering puzzle. The problem, Bryce got it wrong, opps. And he forgot to credit Milo, double opps. Oh did I mention it’s the MILO’s ENGINEERING CHALLENGE!!!!

I hate posting results to evaluation challenges, usually I play with them behind the scenes. But seeming this wrong answer is in the wild I wanted to take a crack at it. I’m using my language of choice, C#, and because the challenge mentioned language specific features I used Linq, TPL, auto properties, etc. Seeming Ted’s a *NIX guy I’m sure he doesn’t realize how bad he’s got it compared to us Windows programmers.

I time boxed 30 minutes to get something done. I went a little over but not by too much. Factor in this blog post and I’m probably a little over an hour spent on it. I didn’t have enough time to get to the 3rd part of the challenge, and it seems the most time/code intensive bit. My working theory was creating an array of all the unique parts of a name (length of 2 or more chars), then searching for an occurrence of any of those in the target string.

Logic.cs File

using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;

namespace EP2CS
	public class Logic
		public List<Product> Products { get; set;}
		public List<Customer> Customers { get; set; }

		public void PopulateProductsAndCustomersLists(string productsFileLocation, string customersFileLocation)
			// Reset our lists
			Products = new List<Product>();
			Customers = new List<Customer>();

			// Load and read the products file
			if (File.Exists(productsFileLocation))
				string[] lines = File.ReadAllLines(productsFileLocation);

				Parallel.ForEach(lines, line =>
				                        		Product p = new Product();
				                        		p.Name = line;

				                        		p.IsNameEven = (p.Name.Length % 2 == 0);
				                        		if (p.IsNameEven)
				                        			p.Multipler = 1.5f;
				                        			p.Multipler = 1f;



			// Load and read the customers file
			if (File.Exists(customersFileLocation))
				string[] lines = File.ReadAllLines(customersFileLocation);

				Parallel.ForEach(lines, line =>
				                        		Customer c = new Customer();
				                        		c.Name = line;
				                        		c.VowelCount = StringHelpers.CountVowels(c.Name);


		public List<Suitability> ScoreCustomersAndProducts()
			if (Products == null || Customers == null)
				return null;

			List<Suitability> suitability = new List<Suitability>();
			List<Customer> pickList = new List<Customer>(Customers);

			Parallel.ForEach(Products, product =>
			                           		Customer c = null;
																		lock (pickList)
																			while (c == null)
																				c = pickList.First();

																		Suitability s = new Suitability();
			                           		s.Customer = c;
			                           		s.Product = product;

																		if (product.IsNameEven)
																			s.Score = c.VowelCount * product.Multipler;
																			s.Score = c.ConsonantCount * product.Multipler;


			return suitability;




Epic Cool Prod
Epic Cool Prod II
Epic Cool Prod III
Cheap Junk
Imported Lead Filled Toy

The Result:

Scoring Result

Result Count: 5
Total Score: 12

Product: Cheap Junk
        Length: 10      Multipler: 1.5
Customer: Dean
        Length: 4       Vowels: 2       Consonants: 2
Score: 3

Product: Epic Cool Prod II
        Length: 17      Multipler: 1
Customer: Debbie
        Length: 6       Vowels: 3       Consonants: 3
Score: 3

Product: Epic Cool Prod
        Length: 14      Multipler: 1.5
Customer: Gabe
        Length: 4       Vowels: 2       Consonants: 2
Score: 3

Product: Imported Lead Filled Toy
        Length: 24      Multipler: 1.5
Customer: Shawn
        Length: 5       Vowels: 1       Consonants: 4
Score: 1.5

Product: Epic Cool Prod III
        Length: 18      Multipler: 1.5
Customer: Terry
        Length: 5       Vowels: 1       Consonants: 4
Score: 1.5

Spent more time on it then I wanted but I think it’s working for the first two requirements. My initial thoughts on completing the third part would be pretty CPU/Mem intensive so I’d have to play with it a little to come up with a more elegant solution.

Download the source

The Dangers of Copy/Paste Coding

One of my blogging hero’s Jeff Atwood blogged about this a few months ago, but it never really hit home for me until recently. I’m a “Don’t reinvent the wheel” kind of guy, I much rather spend time building direct business value then working on plumbing. So being the blatant rip off artist that I am I use Google for answers to things I think are common.

I stumbled upon BouncyCastle a little while ago when trying to find a way to move away from Chilkat’s encryption library to one that would allow me to compile my assembly with the “Any CPU” flag. But to my dismay they have a very limited amount, bordering on none, of the samples and documentation I needed to use their library. So I turned to my old friend Google for some answers.

What Google returned for me was a post by Havard Stranden on his blog, someone who I’ve read before and even used his Copyable software before. Havard had exactly what I was looking for, and some code examples, I was so happy. So I begun the art of copy and paste and was on my way.

I’ve started to use Unit Tests a little more then in the past. I’m not part of the religion by any means, more of an observer waiting and watching for the spiked punch to be rolled out and the show to begin. I usually use Unit Tests to fix problems or reaffirm my knowledge, because I still didn’t have a lot of information on BouncyCastle I wrapped Unit Tests around my RSA encryption and started testing.

Well some of my Unit Tests failed and some others threw exceptions. I blamed everything but the code I copied and pasted from the Internet. I changed my encoding at least 5 times, I changed my wrapping and conversion functions another 5 or so times, and so on. I wasted about a week trying to figure out what was wrong, why could I correctly encryption and decrypt a small block of test, but not a larger one.

Finally I stepped into the code, line by line and observed what was occurring, and I finally found the issue. This was the inner loop of my encryption and decryption methods, which basically chunk through and array and encrypt and decrypt each chunk. Can you guess where the problem was?


What I found out was chunkSize was going negative, or to zero, a lot. If what I was encryption was less then the blockSize, which is how many parts of the array the RSA encryption function can handle at a time, the I was good. But if it was a larger amount of data it would completely bomb out.

What I ended up with was more then I think one line can handle, but I could be wrong. Basically there were three cases I saw, and I put some if statements in to handle them.


I don’t know why I didn’t dawn on me to check my copy/paste programming first, but I’m so used to finding code that just works I rarely check to to ensure it does. The code probably was a quick sampling or a mock up and not his actually production code. I have no idea where it came from but assuming it was ‘live’ code was the wrong thing to do. When I started having problems that’s probably the first thing I should have looked at, as it was the only thing I didn’t completely understand or write myself.

So word to the wise all you Copy/Paste programmers, check from time to time to ensure the code works properly, else you could burn many hours tracking down issues.

P.S. Sorry Havard, but I don’t know the Alt code for that special A.

Go to Top