Technorama

An omnibus of tech posts by a Futurologist on software development primarily.

Sunday, 7 January 2007

 

The D language, C++0x and threads




It's interesting to see our programming languages evolve, C++ is one of my favourites because it is so flexible for programming performance critical real-time apps like video games -- you really need to get as close to the metal as you can for speed, while the OO approach helps with modularity.

The question is how to improve our lot from what we have at present? I would like to see some compiler and developer environment improvements:
I'd also like to see better systems libraries, such as Boost and other middleware; people don't/shouldn't need to write their own classes for half the things they do at present.

C++0x will be finalised in the next few years. D is also available now, D is developed as an improved version of C++. It brings lots of interesting ideas, like multiple return args and the null keyword (C++0x will have nullptr I hope). Couldn't spot a pure keyword, would be handy for abstract bases will have this so they don't have to use =0 as at present! Maybe even some D ideas will pass back to C++0x. Would there ever be enough momentum to switch development to D? I don't think it is different enough from C++ for companies to want to make the shift.

I'd like to see a good system for managing memory pools in the standard library, perhaps Boost pool. OSs provide a good heap, but often fragmentation still happens. The heap doesn't know the expected lifetime of an allocation when it chooses where to place it. If a coder can help by separating their same-sized (or even smaller) objects to come from a pool that could help with performance.

Threads in C++ is still under discussion, Hans Boehm has proposed an idea, and Howard Hinnant of Apple has proposed something similar to Boost's thread mutex. Both are different from the pre-processor approach of OpenMP.

Interesting times ahead!

Labels:


 

2007, the year of software reliability?




A new year is upon us, and everything feels so different! I've been pondering if 2007 could be a year to remember for software. Reliability is definitely one area I can see which has scope for improvement in this year's releases.

Following on from my last discussion: The problem with programming? Do we as software developers really need to expose ourselves and users to crash opportunities as at present? It's an interesting point to debate. C++ gives programmers control over memory resources, direct address access and pointer arithmetic. Invalid data can cause out of bounds memory accesses and likewise programmers are only fallible humans which can make mistakes as well. Programmers shouldn't count on being able to always beat the language at what it does best!

As Bjarne says "People push what they know and what they have seen work; how could they do otherwise?". It's surprising to see people code C++ like they do C, pointers arithmetic, allocating memory and magic globals etc which should be neatly wrapped up in a state system, design pattern or other standard approach.

A few examples of problems in C++ which can trip programs up:
Would it be better to write non-kernel/system libraries in a language which does not permit these issues? It seems logical to cut down on the opportunity for errors.

In practice I see that performance critical crunching code (like a quantiser etc) really benefits greatly from a C++ implementation which can use the points above; the compiler just can't convert the code into as optimal an implementation itself. Let's only write a more optimal block of code when we really need to though, the profiler shows us when that is necessary ;)

Labels: ,


Saturday, 6 January 2007

 

The problem with programming?




Interesting Q&A session with Bjarne in these two interviews: The Problem with Programming + More Trouble with Programming. I echo the sentiments of those who detract from C++'s successes, it's a professional's language for high-level coding when suited. If an engineer mismanages memory or makes improper use of pointers and addresses then there will be problems.

I love the flexibility C++ allows, templates and our own memory management mean we can get the most out of each embedded system. Likewise STL is great, as are custom templated fixed size containers. In addition, Boost has lots of useful functionality not in the standard. Object-Oriented programming is really a necessity to handle the complexity of projects. C++ lets me think about applying algorithms, structures and maintainability my way, its a meritocracy of code ;)

The flip side is if flexibility allowing such a degree of control is suited to all engineers? Essentially, do we really need to change to a constrained language to prevent high-level coders accidentally making mistakes which cause crashes and bugs? One solution is coding standards, they are great and I adhere to the rules in place on each project. However, if the risky language feature isn't available then there does not need to be a rule book to prevent its use.

At over 20 years old, C++ is still v.cool!

Labels:


Archives

February 2003   March 2003   April 2003   August 2004   September 2004   December 2004   May 2005   June 2005   December 2006   January 2007   February 2007   March 2007   April 2007   July 2007   August 2007   September 2007   October 2007   November 2007   December 2007   January 2008   February 2008   March 2008   April 2008   May 2008   June 2008   July 2008   August 2008   September 2008   October 2008   November 2008   December 2008   January 2009   February 2009   March 2009   April 2009   September 2009   November 2009   December 2009   January 2010   April 2010   September 2010   October 2010   November 2010   December 2010   January 2011   February 2011   March 2011   April 2011   May 2011   June 2011   July 2011   August 2011   September 2011   October 2011   November 2011   December 2011   January 2012   February 2012   March 2012   April 2012   May 2012   June 2012   July 2012   October 2012   December 2012   March 2013   May 2013   August 2013   September 2013   October 2013   November 2013   March 2014   May 2014   June 2014   July 2014   September 2014   October 2014   December 2014   January 2015   February 2015   March 2015   April 2015   May 2015   June 2015   July 2015   August 2015   September 2015   October 2015   November 2015   December 2015   March 2016   April 2016   May 2016   July 2016   August 2016   September 2016   October 2016   November 2016   December 2016   January 2017   February 2017   March 2017   April 2017   May 2017   June 2017   July 2017   August 2017   September 2017   November 2017   March 2018   April 2018   May 2018   June 2018   August 2018   October 2018   December 2018   January 2019   March 2019   May 2019   August 2019   September 2019   March 2020   April 2020   May 2020   September 2020   October 2020   February 2022   June 2022   July 2022   October 2022   December 2022   February 2023   April 2023   September 2023   October 2023   May 2024   June 2024   July 2024  

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]