Tag: programming

Functional Programming in C++

This is not a new topic, and there have been plenty of comments recently from various C++ developers. But most comments are only about lambdas and using them as higher-order functions.  While I can’t claim any deep knowledge of functional programming (some experience with functional techniques in Scala, F# and C#) I can’t help think the real functional programmers are laughing at us for missing the point. Yes it’s called function-al programming, functions are in the name, but that doesn’t mean functions are the only important feature to consider before we can make use of functional techniques in C++. Possibly…

Read More »

Divide in C++ resource management

There seems to be a divide in ideas about C++ resource management, which I’m going to grossly exaggerate and call the “Stroustrup” and the “Sutter” positions, based on comments by these titans in recent online videos.  These are of course not opposing positions, merely shades of opinion that depend on the application domain and target environment.  But there does seem to be an underlying difference of emphasis on how resource management, and memory management in particular, are best dealt with in modern C++. To summarise: “Stroustrup” “Sutter” Focus on stack object managing resource Focus on heap object conveniently managed by…

Read More »

Microsoft Build 2011

Just watched the keynote address from Microsoft Build 2011. Microsoft’s new take on what a modern software platform should be. Clearly heavily influenced by a reaction to Apple’s success with the iPad and the App Store. But where Apple are now trying to bring some of that success back to the Mac, Microsoft are really starting from scratch in this space and are building a strong unified platform. Some of the main themes from the demos as part of the Build keynote were clearly reactions to the new market for tablets New Metro tiled UI Touch Low-power, fast-start Serious work…

Read More »

Agile and non-agile project timing

Agile versus business On an agile project one of the core principles is an on-site customer. A customer embedded in the development team and available all the time for questions and to help clarify new features. I realised this week that the reason this is so important is a timing problem. The business works on long cycles, maybe quarterly sales targets or monthly reporting periods. A business query might need to be bounced to someone’s boss or discussed in meetings before a response comes back a week later. The agile team works on a two week iteration cycle. When they…

Read More »

WPF/Silverlight Layout Gotchas

Coming from WinForms or even older technologies like MFC, WPF and Silverlight are a revelation. A consistent framework to layout simple forms, draw graphics, add video and 3D images and animation and styling. All in the same window. Woo! But there some places where WPF and Silverlight behave differently to initial expectations and which can waste a lot of developer time or even put some off entirely from experimenting with them. Interactive Demo Most layouts in WPF use a Grid control. It’s very flexible and has a lot of powerful features. The classic demos for WPF for WinForms developers show…

Read More »

Experiments with Silverlight

So how easy is it to take a WPF project and run it as Silverlight instead? As with so many things – it depends. OK, so the code I converted was fairly trivial and completely unrepresentative but it was interesting to see just how easy it can be, and how frustrating it can be. How things change Basic classes Exception – in .Net – Serializable, in Silverlight – not so much. So simple exception subclasses need conditional code. I wasn’t expecting problems with code quite so trivial. My approach was basically try and compile it and if it broke flip…

Read More »

Dependency Injection in C++ – cppdepinject

While I’ve seen plenty about Dependency Injection and IOC containers in C# and Java, I recently had a reason to use one in C++. There are some existing IOC containers in C++ but they are not widely used. While there are differences in the types of software written in C++ compared to other languages I think the largest difference is the way the community works. The Java and C# communities grew up with the Internet and open-source code and expect to use code and ideas from various sources and the style of their applications has changed rapidly. The C++ community…

Read More »

Improvements in UI

I’ve been playing with WPF. I’ve seen some good talks and demos of quite beautiful user interfaces and wanted to start getting some practical experience. I’ve also read a lot about the MVVM pattern which sounds like it gives a clean, easily understood separation of display and code, reducing those moments when you look at something and have to ask “should this be in the model or the controller/presenter?” So new project. I’m going to write Noughts and Crosses. On a computer. Because no-one’s ever done that before! Ok, so not very original but the point was to give a…

Read More »

A Simple Algorithmic Puzzle

A friend recently introduced me to a new coding puzzle. This led to a new algorithm that I hadn’t seen before. As usual while figuring out I came up with several mad approaches, so I thought I’d write them down and see if they showed anything about the way my brain works. The Problem: Given an array of integers, for each calculate the result of multiplying all the other entries in the original array except the current entry. Oh, and you can’t use the division operator. Oh, and it’s possible in linear time i.e. there’s a solution which is O(n)….

Read More »

Simplifying Software with Udi Dahan

I saw Udi Dahan this week at an event at Onalytica, Udi and a small group of around 20 developers. Onalytica’s CTO acted as host and made it an interview with Udi while giving him plenty of time to talk. This interesting format was pleasantly different than the usual technical talk where the speaker picks the topic. This was more wide-ranging and covered some of his early background as well as current topics in large-scale system design. This was the first time I’d seen him speak and he was as good as everyone had said, very funny and very thought-provoking….

Read More »