Category Archives: Programming

Functional Programming with Arrays

As object oriented programming starts to fall out of favor with developers, functional programming is making a comeback. Reasons such as side effects and unit testability are hastening it. The Telerik developer blog has a great post up detailing functional programming with arrays.

They have examples of map, filter, and of the lesser known reduce. There is even a pretty easy to understand example of currying in javascript. All in all, if you are new to javascript or coming up to the newer syntax, this post is a great teaching tool. And honestly it is also a great reference to keep when you have that mid-day coding session brain fart.

Telerik blog: https://www.telerik.com/blogs/functional-programming-with-javascript-object-arrays

VS Code Text Buffer Reimplementation

The VS Code team has a really good article around their Text Buffer Reimplementation in the latest version. There is a lot of good information around performance and the implications of certain design patters revolving around file size.

Piece Tree Performance
Piece tree performance with a large file and multiple edits.

The part that is very interesting is how the piece tree seemed to be the clear cut winner. It wasn’t until they tested a large file with a large amount of edits, that it stumbled more than the array. Articles like this fascinate me when Javascript is pushed to its limits.

VS Code Blog: VS Code Text Buffer Reimplementation

Angular 2+ not working in IE11

Internet Explorer Logo
Internet Explorer logo AKA web developers sworn enemy

You’ve been a good developer. You are using the Angular CLI for your projects in its purest form. There isn’t a super custom build process. Application development has been going along well and then you get the email, “Hey the site won’t load in IE11?”

Frantically you open up the site in IE. Nothing. You see a console error, and you think that isn’t in MY code. Ages go by as you  mentally search through the code trying to figure out where you may have put some code that could be incompatible with IE. You remind yourself that Angular itself says that they work with IE11.  Finding nothing you go to the internet.

You read this Stack Exchange article and breathe a sigh of relief. I just forgot to add in the heavy poly fills. Once again you mutter about how you cannot wait until IE finally dies.

  • Stack Exchange: https://stackoverflow.com/questions/35140718/angular-2-4-5-not-working-in-ie11
  • Angular Docs: https://angular.io/docs/ts/latest/guide/browser-support.html

Visual Studio Code Tips and Tricks

Visual Studio Code
Visual Studio Code

As I’ve really started to use Visual Studio Code as my daily editor of choice, I can never remember all of the little tips and hints you hear on podcasts. Thankfully  the VS Code team has a great little doc up that you can use to refresh your memory. I really like the tip of using the automated script to allow command line access on the Mac. I couldn’t remember how to do that.

Visual Studio Code Tips and Tricks

John Papa – Readable Code

John Papa gave a great talk at NgConf this year about readable code. It is a great listen for new and old developers alike. The ideas in here are highly important, especially for projects with multiple developers and projects that aren’t your own. I’ve tried to take these ideas to heart and make sure all of my junior devs do too. Take 15 minutes out of your day to give this a watch.

Render Blocking CSS

When building a performant web site, we all always look to the complexity of our DOM, file sizes, and bundle size/splitting to drive the performance of our web site. One thing we always seem to forget is that CSS is a render blocking asset. The complexity and breadth of the CSS we built will block rendering and give the user a poor experience, especially on an underpowered device.

Google dev resources has a good writeup here.

Why Good Logging Is Important

One thing that you learn as you rise in your career as a software developer is that good logging is very important. I had a great experience of why writing out as much data as you can is important.

A client of ours has been load testing our application before their production pilot. During the load test I noticed in our single sign on routine that we were getting primary key errors on role insertion. Being that this was one of the first things I had worked on early in my career, I had not done any duplicate checking on the roles. After fixing that, we received the results of the second round of testing. We were still getting duplicate errors! I frantically and frustratingly went back an retested my logic over and over again. Not once would it try to insert a duplicate.

Finally after combing the logs I noticed one tiny discrepancy between the logging lines where the duplicate role was trying to be inserted. The process ID was the same, but the Thread ID was different. Because we are calling an external service before the insertion, we have a thread collision occurring and trying to insert the same user in two separate threads. Granted this is mostly due to the fact that there are only a few user id’s being used during the load testing, it still can be something that can be seen in production.

Had we not logged this out, I’d still be beating my head against a wall to try to figure it out. Now to come up with a bulletproof solution for the thread collision problem.