Archive for the ‘Programming’ Category

Getting back on track

Sunday, November 29th, 2009

We’ve more or less set­tled in our new apart­ment, and we’ve got inter­net… sort of! (more…)

Being functional in an imperative language

Saturday, October 3rd, 2009

By now, I’ve read an awful lot of papers about STM sys­tems, and cer­tain trends are really start­ing to stand out, not so much in terms of the algo­rithms used or the clever schemes invented to make trans­ac­tions appear atomic, but in how they inter­face with the actual language.

It has really under­lined to me just how deeply entrenched most Java, C and C++ pro­gram­mers are in the imper­a­tive mind­set. (more…)

A .NET Developers Guide to C++ (part III)

Thursday, October 1st, 2009

We’re near­ing the end!

Part I focused on the very fun­da­men­tals of C and C++, mak­ing sure that you under­stand the build sys­tem and the very basics of the syntax.

Part II expanded on this to teach you all the C++ you’ll need to do basic work in the lan­guage, includ­ing a few use­ful parts of the stan­dard library, such as vec­tors and strings.

You now know all the basics we need, and the actual Win32 API should now be very sim­ple to deal with. Not ele­gant or con­sis­tent, but com­pre­hen­si­ble as long as you keep a close eye on the doc­u­men­ta­tion and take noth­ing for granted.

(more…)

Software Transactional Memory

Saturday, September 26th, 2009

As I men­tioned a few weeks ago, I’m writ­ing my master’s the­sis on soft­ware trans­ac­tional mem­ory (STM).

Of course it is still early in the process, and while I’ve got some ideas for my imple­men­ta­tion, and have started pro­to­typ­ing parts of it, most of the time has been spent catch­ing up on all the exist­ing work in the field.

Lit­tle did I know when I accepted the sub­ject that there’d been writ­ten that many papers about it over the last decade. Phew… A com­menter asked me for the ref­er­ences I found use­ful, so here’s an incom­plete list: (more…)

A .NET Developers Guide to C++ (part II)

Tuesday, September 8th, 2009

Wel­come to the sec­ond install­ment in my guide of “what you need to know if you’re a .NET pro­gram­mer who wants to be able to write C++ code and call native APIs”. It took me much longer to get this posted than I’d hoped. My work on my the­sis has kept me more busy than I’d orig­i­nally expected. Sorry for the delay!

In part I, I went through a min­i­mal “Hello World” pro­gram in some detail, and attempted to explain the arcane work­ings of the C/C++ com­pi­la­tion model. Some may argue that this had no rel­e­vance to my tar­get audi­ence, but I think it is a nec­es­sary evil. Almost all C++ pro­gram­mers get tripped up at some point by the the dif­fer­ence between com­piler and linker errors, and what exactly the #include direc­tive actu­ally does. Hope­fully, by read­ing part I, you’ll be able to avoid this.

With that out of the way, we can get started on the inter­est­ing part, though. Part II will focus on actual C++ code. We won’t con­sider man­aged interop or even the Win32 API yet, though. This part will still take place in native C++-land only. In short, the pur­pose of this part is to enable you to write sim­ple C++ pro­grams, and more impor­tantly, to under­stand the C++ sam­ple code you prob­a­bly run into from time to time.

(more…)

Thesis, yay!

Saturday, August 29th, 2009

Been a bit quiet on the blog front lately. I’ve been busy get­ting my master’s the­sis off the ground.

But now it is offi­cial. (more…)

A .NET Developers Guide to C++

Monday, August 17th, 2009

One of my cowork­ers is essen­tially a self-taught pro­gram­mer, but he is inter­ested in, and wants to learn, absolutely every­thing. A year or two back, he asked me to give him a crash course in C++, because he felt it was a prob­lem that when­ever he needed to do some­thing that required func­tion­al­ity not exposed by the .NET frame­work, he essen­tially hit a wall.

So we took an after­noon out to run through some basic C++ code, and while we had fun doing it, and I’m pretty sure he found it inter­est­ing, it didn’t really achieve the goal of mak­ing him com­fort­able with writ­ing small C++ pro­grams to com­mu­ni­cate with native APIs such as the Win­dows one.

(more…)

The Great Pointer Conspiracy

Thursday, July 30th, 2009

One of the great tragedies of C and C++ is that they are taught wrong — that a num­ber of per­fectly straight­for­ward fea­tures are taught and described as if they were myth­i­cal and super­nat­ural enti­ties that no mor­tal can truly under­stand. Mem­ory man­age­ment in C++ is one such fea­ture (it is actu­ally very sim­ple, once you know the trick), but the biggest of all is prob­a­bly pointers.

Every­one who learns C++ fears point­ers. Every­one who is new to the lan­guage, or who has merely heard of the lan­guage con­sider point­ers to be some kind of magic — arcane con­structs that give the pro­gram­mer access to Real Ulti­mate Power — a fea­ture that both mark C/C++ as supe­rior and more pow­er­ful than other lan­guages, but is also feared as dan­ger­ous or unsafe*.

None of this is true.

Point­ers are simple.

Point­ers are not magical.

Point­ers are safe (as long as you use them only as allowed by the language)

(more…)

Thesis

Tuesday, July 28th, 2009

Finally, after too many years study­ing at DIKU, I’m about to start on my master’s the­sis. That feels weird.

But I’m still not sure what I want to write about. I’ve got a few ideas, mainly by ask­ing some of the pro­fes­sors I might want as advi­sors if they had any inter­est­ing projects lying around. (more…)

Markdown and web typography

Tuesday, July 21st, 2009

As a gen­eral rule, I swore years ago to stay as far away from web design and web devel­op­ment as at all pos­si­ble. I still believe that this is one of the fun­da­men­tal rules of hap­pi­ness, and I haven’t regret­ted it, but for once, I was actu­ally impressed (rather than depressed, which is what web devel­op­ment usu­ally makes me feel like) with a few pieces of web design, and so I decided to make an excep­tion and talk about it for a moment.

After launch­ing this blog ear­lier today, I spent a bit of time research­ing how to get a more intu­itive syn­tax for for­mat­ting my posts. I’m not really a fan of “rich text” text edi­tors like the one Word­Press uses by default (luck­ily it can be dis­abled). It offers lim­ited con­trol, is awk­ward to use, and just doesn’t lend itself to well-formatted posts.

So I decided to look for alternatives.

(more…)