Archive for c++

Chimera wishlist : !NullReferenceException

What features from other languages do you wish your main development language had?

As someone whose first real applications were written in C++, the thing that always bugged me about C# and Java (after they got generics and autoboxing sorted) was the way they handled references. In my C++ mind, C# and Java pass pointers around, and pointers are allowed to be null. So every single time I have to use them, I have to check them for null, or set up the caller to make sure they’re not null. As Anders Hejlsberg points out, that single fact causes more problems than anything else in C#.

Also, I wish C# allowed const references like C++ to guarantee an object isn’t modified within a method when passing by reference, which is always useful to avoid copying large objects. C# would have to support const methods too, of course.

50% of the bugs that people run into today, coding with C# in our platform, and the same is true of Java for that matter, are probably null reference exceptions. If we had had a stronger type system that would allow you to say that ‘this parameter may never be null, and you compiler please check that at every call, by doing static analysis of the code’. Then we could have stamped out classes of bugs.

But peppering that on after the fact once you’ve built a whole platform where this isn’t built in… it’s very hard to pepper on afterwards. Because if you start strengthening your APIs and saying that you can’t pass null here or null here or null here, then all of a sudden you’re starting to break a bunch of code. It may not be possible for the compiler to track it all properly.

Anyway, those are just things that are tough later. You sort of end up going, well ok, if we ever get another chance in umpteen years to build a new platform, we’ll definitely get this one right. Of course then we’ll go and make other mistakes! But we won’t make that one.

http://www.computerworld.com.au/index.php/id;1149786074;pp;3

So, what do you wish for?

Leave a Comment

Genetic Algorithms

I wanted to post a new blog here via Flock, but Flock and Blogger won’t play together :-( this post is also available here.

I had a great time at the Tech MeetUp (@techmeetup) in Glasgow this week. If you want to meet up with other tech minded folk in Scotland, it’s definitely worth checking out. See the details at the end of this post.

At the meeting this week, I got talking to a few folk (including John Gallagher who gave a great talk) about AI and Genetic Algorithms. This inspired me to dig out my old experimental code for doing GAs using C++ Templates. The code’s very rough and ready, and it was written long before I discovered TDD or subversion, but it should be standards-compliant, and it compiles in the latest GCC (I can’t vouch for other compilers, if you try it, let me know). As it’s a source-code library, you’ll have to compile it yourself, but if you don’t know how to use a compiler, you’re probably reading the wrong blog anyway. I will be tidying up the code and creating a wish list as I get the chance, but I’m throwing it out there in case it’s useful to anyone.

If you’re interested, check it out at the link below and let me know what you think.

Genetic Algorithm Templates

If you’re interested in Tech MeetUp, you can see videos from previous talks at their website


The Tech MeetUp is the informal opportunity to meet other developers and tech companies, to showcase your hacks or projects, and to find out what’s happening around us. Help build the tech community – set up a profile and come along to a Tech MeetUp.

Home – Techmeetup

You can find out about upcoming meetings on their mailing list


Description: An easily accessible and friendly community of tech minds, skills and startups around Scotland and Northern UK.


Tech Meetup | Google Groups

Leave a Comment

Genetic Algorithm Templates

I had a great time at the Tech MeetUp (@techmeetup) in Glasgow this week. If you want to meet up with other tech minded folk in Scotland, it’s definitely worth checking out. See the details at the end of this post.

At the meeting this week, I got talking to a few folk (including John Gallagher who gave a great talk) about AI and Genetic Algorithms. This inspired me to dig out my old experimental code for doing GAs using C++ Templates. The code’s very rough and ready, and it was written long before I discovered TDD or subversion, but it should be standards-compliant, and it compiles in the latest GCC (I can’t vouch for other compilers, if you try it, let me know). As it’s a source-code library, you’ll have to compile it yourself, but if you don’t know how to use a compiler, you’re probably reading the wrong blog anyway. I will be tidying up the code and creating a wish list as I get the chance, but I’m throwing it out there in case it’s useful to anyone.

If you’re interested, check it out at the link below and let me know what you think.

Genetic Algorithm Templates

If you’re interested in Tech MeetUp, you can see videos from previous talks at their website


The Tech MeetUp is the informal opportunity to meet other developers and tech companies, to showcase your hacks or projects, and to find out what’s happening around us. Help build the tech community – set up a profile and come along to a Tech MeetUp.

Home – Techmeetup

You can find out about upcoming meetings on their mailing list


Description: An easily accessible and friendly community of tech minds, skills and startups around Scotland and Northern UK.


Tech Meetup | Google Groups

Blogged with the Flock Browser

Leave a Comment

Follow

Get every new post delivered to your Inbox.

Join 937 other followers