Tag: programming

C# 9.0 Immutable Records – Yes!

Mads Torgersen, C# Lead Designer recently posted about development for upcoming C# 9.0. There’s a whole bunch of features that made me say Yes, Do It, When Can I Get It, Just Yes! But first a story to explain why I’m so enthusiastic. F# What? I thought this was about C#! Patience, grasshopper… Project Last year I was lucky enough to build a small system in F#. I work for a large company with development mostly in C# and TypeScript. We’re in the middle of a major shift into the cloud so there’s a lot of learning going on for…

Read More »

Both Angular 1.x and React Feel Familiar

I’ve used AngularJS 1.x for 18 months on a greenfield internal project, and then used React + Redux for 6 months on a bigger commercial web project.  I’ve been interested to find strong parallels with other UI frameworks I’ve used in the past. AngularJS 1.x AngularJS 1.x was an excellent framework to build a modern single-page web-app.In learning it I was struck by the similarity with WPF.  This rich client framework from Microsoft, along with its similar cousins Silverlight and WinRT, have some similar pros and cons. Pro: clear separation of view/controller/service (WPF view/view-model/model) simple 2-way binding between view and…

Read More »

Allowing Parallel Solutions

I recently watched an interesting talk by Guy L. Steele Jr. showing how different problem solving approaches can allow or prevent a parallel implementation. Vocabulary The vocabulary you have to discuss solutions and algorithms affects how you approach new problems. Guy Steele showed that everyone in his audience already understood ideas for iterative, sequential solutions (loops, lists, accumulators), but only a minority already understood ideas for potentially parallelizable solutions (parallel prefix). Like design patterns for object-oriented programming and monads for functional programming a higher-order vocabulary of parallel programming idioms would help us both communicate with each other and helps us…

Read More »

Faster Visual C++ Builds

I always knew precompiled headers mattered if you were using Visual C++. I didn’t know how much they really mattered. What’s a precompiled header? I’ve worked in a number of places. Where I am now is probably the biggest codebase I’ve worked on, well over a million lines of code with many projects in a large Visual C++ solution. Most of the places I’ve worked have been C++ and Windows shops so I’m used to Visual C++ creating a pre-compiled header by default for each project with the usual Windows headers. I knew the Windows headers were huge so compiling…

Read More »

Reasoning About State in Multi-threaded Systems

Reasoning about modern software systems can be hard. Debugging modern software systems can be hard. Whether you’re working on a multithreaded service or re-entrant UI code, tracking responses from network services or running many asynchronous IO tasks, understanding the overall state of your application especially when there’s a hard-to-reproduce bug can be very hard. Common styles of older multithreaded code are the worst. Shared state and locks, manual coordination between threads, fighting with race conditions, deadlocks and live-locks. It’s very hard to diagnose problems and common to have applications that have been running for weeks suddenly lock up and never…

Read More »

Teaching .NET Dispose Better

I’ve been struck recently by strong parallels between how resource handling and exception safety are usually taught and presented in C++ and in .NET, or more accurately how poorly I think they are often taught. This post focuses on .Net and the Dispose pattern. I’ll look at C++ in a future post. What’s Wrong with the .NET Dispose Pattern? The .Net Dispose Pattern is the standard resource-management pattern for C# and VB programmers, taught as an essential technique to new developers. I think it is unnecessary and promotes bad programming practices. // Full IDisposable pattern from https://msdn.microsoft.com/en-us/library/fs2xkftw%28v=vs.110%29.aspx // For Reference…

Read More »

Broken Metaphor: Software "Maintenance"

Recent reshuffling in my team brought up the division between maintenance and new development that many long-term software projects have and I started thinking about Software Maintenance itself. I realised: Software isn’t maintained. There is no such thing as software maintenance. Buildings and bridges need to be maintained. The Sydney Harbour Bridge has a team constantly repainting it. But this was planned when it was built. It was understood that some parts wear out and need replacement every few years, some coatings weather and need repainting every few years. Cars need maintenance. The oil needs changing, tyres get damaged and…

Read More »

C++ Boost::Range vs .NET LINQ vs Scala

In my day-job most of my development is in C++ so I’m always comparing ideas from other languages against what’s available in C++. I’ve been experimenting with boost::range, a C++ library that makes it easier to compose algorithms in a functional style. I’m comparing it to .NET LINQ and to for-comprehensions in Scala. My example: List of orders, each order has a discount and list of order-items. We want the total cost of all Bread items with discounts applied. Scala for-comprehension def orders: List[Order] = List( new Order( 25, List( new OrderItem("Eggs", 12, 0.50), new OrderItem("Bread", 4, 1.25) ) ),…

Read More »

Contrasting Active Objects vs Tasks vs Actors

Contrasting ideas helps me see what’s special about each idea and what they have in common but maybe in different forms. Different tools, different languages show off different ideas, and while some work best with specific language features there’s always something to help in other languages in my day-job. So today I’ve been thinking about some models of concurrent programming. The Coursera course on Reactive Programming explored the Actor model and I’m contrasting that with the Active Object pattern from POSA2 which I saw in detail in another Coursera course last year and with Tasks which have quickly become one…

Read More »

Learning the Future of Programming – from 1973

I’ve just watched Bret Victor from the recent DBX conference.  If you haven’t seen it the link’s at the bottom, you’ll be glad you did.  The rest of this post has spoilers and I wouldn’t want to ruin your enjoyment so go watch it first, my little rant can wait. I spent the first 15 minutes of the talk giggling at the references – He’s using an OHP! He has pens in his pocket!  He stayed in character the whole way through, it was great.  I couldn’t stop laughing. Then I spent the rest of the talk crying over the…

Read More »