Archive for the ‘Programming’ Category

A follow-up rant about Connect

Saturday, August 27th, 2011

So my last blog post got a sur­pris­ing amount of atten­tion, not least from a/the (no clue how many there are of those) Prod­uct Man­ager of Visual Stu­dio, which is pretty neat.

So, here’s a quick fol­lowup, in order to fully exploit my 15 min­utes of fame!

(more…)

What’s wrong with Visual C++ and Microsoft Connect?

Saturday, August 13th, 2011

Using Visual Stu­dio 2010 with Ser­vice Pack 1, try doing the following:

  1. cre­ate a new project of type Win32 Console Application, and under Application Settings in the project wiz­ard, select Console Application and Empty Project.
  2. cre­ate a sin­gle .cpp file
  3. add the code int main() {} to it
  4. hit build. (more…)

C++11’ish approved!

Saturday, August 13th, 2011

Not much to say here, other than that C++11, or pos­si­bly C++12, for­merly known as C++0x, has been approved unan­i­mously by ISO.

Hur­rah!

Appar­ently, it’ll take a few months for all the paper­work and such to catch up, and then the final stan­dard will be pub­lished by ISO (I haven’t been able to find a clear answer to whether or not this might drag the final release all the way out to 2012, but hope­fully, C++0x will be for­ever known as C++11).

The “I don’t care about version control, I just want other programmers to stop pestering me”-guide to version control

Wednesday, July 27th, 2011

Every so often, I come across a pro­gram­mer (usu­ally a stu­dent, or a self-taught hob­by­ist) who doesn’t use ver­sion con­trol (cue shock and horror).

Of course, when­ever some­one dares to admit this, they’re set upon by every­one and heck­led and pestered until they give in and install some VCS. And then they spend a few after­noons moan­ing about how they “could have been cod­ing instead”.

And it occurred to me that there doesn’t seem to be any short, sim­ple, min­i­mal­ist guide to set­ting up and using a VCS sys­tem. There are plenty of excel­lent tuto­ri­als and guides which explain every­thing about every­thing, and are an amaz­ing resource to those will­ing to actu­ally spend time to learn how to use their tool.

But new­com­ers to ver­sion con­trol are gen­er­ally some­one who’s will­ing to give it 2 – 3 min­utes, if it’ll shut every­one else up so they can get back to cod­ing. They’re not inter­ested in know­ing what their code looked like 7 months ago, or what exact changes were com­mit­ted on the 28th of June 2010 at 9:37 pm. And they don’t really see why they’d want to branch and merge their code.

Thus… (more…)

STM Status Page

Sunday, June 5th, 2011

As I men­tioned not too long ago, I’ve recently resumed work on the STM library I cre­ated for my Mas­ters Thesis.

It’s still not quite where I want it to be, but I felt that at the very least, it deserved a proper sta­tus page. So here it is. A brand new page on my blog. As I’m still rather busy, I can’t promise that much will hap­pen with the library over the sum­mer, but when some­thing sig­nif­i­cant hap­pens, that page will be the first to know.

Empty statement of intent

Friday, April 15th, 2011

I just want it on record that I intend to actu­ally bring my STM library into a feature-complete, robust and well-documented state, and then release it to the world. (more…)

C++ 2.0

Saturday, March 26th, 2011

Yes­ter­day, on March 25, 2011, the C++ stan­dards com­mit­tee signed off on the final draft of C++0x, the upcom­ing major revi­sion to C++.

After a month or so of edi­to­r­ial changes, proof­read­ing and inte­gra­tion of the last changes into the draft, it will be sent off for all the national bod­ies of ISO to vote on, and then we will offi­cially have a much-needed refresh of C++. Bar­ring any major sur­prises, the process should fin­ish later this year, offi­cially turn­ing C++0x into C++11.

Of course, many new fea­tures of C++0x are already avail­able in var­i­ous com­pil­ers, but later this year, all of them will become official.

A few reports from com­mit­tee mem­bers are already trick­ling out, and no doubt, there will be many more to follow:

I don’t have much more to add, other than to say a big thank you to the bril­liant peo­ple who have spent an awful lot of their time over the last 11 – 12 years to make this hap­pen. Of course, there have been a lot of casu­al­ties along the way (three “core” fea­tures were orig­i­nally envi­sioned for C++0x: an optional garbage col­lec­tor, con­cepts, and language-level sup­port for thread­ing. Of those, only the third sur­vived, although the two oth­ers may still make it into future revi­sions), but over­all, C++0x is a huge improve­ment to the lan­guage. Just a few of the fea­tures I am excited about:

  • lambda expres­sions
  • thread­ing support
  • rvalue references/move semantics
  • vari­adic templates
  • nullptr
  • sta­tic assertions
  • and of course, all the library addi­tions: hash tables, reg­u­lar expres­sions, type traits, tuples and many others.

Hating that which you don’t understand

Wednesday, January 19th, 2011

A few days ago, I came across an inter­est­ing rant about “Why C++ Tem­plates (and STL) Are Bad”.

As any C++ pro­gram­mer who reads my blog likely knows, I’m quite fond of both tem­plates and the STL — I feel those are largely what trans­forms C++ from a clumsy and out­moded lan­guage that should’ve died 10 years ago, into a mod­ern, expres­sive, high-performance and yes, even ele­gant lan­guage that I enjoy using. (more…)

“Good design”, and why OOP isn’t going to get us there

Sunday, November 7th, 2010
  • in which I prob­a­bly get stran­gled by a horde of angry OOP programmers…

I find OOP tech­ni­cally unsound. It attempts to decom­pose the world in terms of inter­faces that vary on a sin­gle type. To deal with the real prob­lems you need mul­ti­sorted alge­bras — fam­i­lies of inter­faces that span mul­ti­ple types.
I find OOP philo­soph­i­cally unsound. It claims that every­thing is an object. Even if it is true it is not very inter­est­ing — say­ing that every­thing is an object is say­ing noth­ing at all. I find OOP method­olog­i­cally wrong. It starts with classes. It is as if math­e­mati­cians would start with axioms. You do not start with axioms — you start with proofs. Only when you have found a bunch of related proofs, can you come up with axioms. You end with axioms. The same thing is true in pro­gram­ming: you have to start with inter­est­ing algo­rithms. Only when you under­stand them well, can you come up with an inter­face that will let them work.  — Alexan­der Stepanov

This post is an attempt at extract­ing some­thing coher­ent from a series of com­ments I recently left on a Stack­Over­flow ques­tion about “good design” (in what’s quite clearly an object-oriented con­text). The per­son ask­ing the ques­tion has been gra­cious and patient enough to deal with my count­less com­ments repeat­edly point­ing out that he’s doing it wrong, which would prob­a­bly have dri­ven a lot of peo­ple mad.

Many peo­ple have come up with many var­ied crit­i­cisms of the object-oriented pro­gram­ming par­a­digm. My prob­lem with it is not new — in fact it is pretty much exactly what Stepanov pointed out in the inter­view I quoted above (and which is def­i­nitely worth read­ing in its full length). The only real dif­fer­ence is that he is an extremely intel­li­gent math­e­mati­cian, and I’m… not. So I’m not able to express it as con­cisely. But then, on the other hand, maybe my take on it will be eas­ier to swal­low for oth­ers who also aren’t hyper-intelligent math­e­mati­cians. (more…)

STL, language lawyers and pedantry

Monday, August 16th, 2010

Any­one who’s been around a C++ pro­gram­mer for any length of time has prob­a­bly real­ized that we tend to be hor­ri­ble lan­guage lawyers: we only trust the ISO stan­dard describ­ing the lan­guage. We cer­tainly would never assume some­thing to work just because the com­piler hap­pens to gen­er­ate code that works right now. If it’s not in the stan­dard, we can’t count on it.

I’m fine with that. It’s often annoy­ing that we have to be so para­noid, that we so often have to double-check that our code not only com­piles, not only passes our tests, but also avoids the dreaded Unde­fined Behav­ior (where the behav­ior is not con­strained by the stan­dard), but you get used to it. And all in all, being pre­cise and spe­cific when talk­ing to a com­piler is prob­a­bly not a bad habit to get into, regard­less of which lan­guage you pro­gram in.

How­ever, every once in a while, peo­ple try to carry the same level of pedantry over into dis­cus­sions about C++. (more…)