Hungarian Notation: What to do?

1 minute read

Edit: FYI, by Hungarian notation, I mean Systems Hungarian such as bIsSucky.

It seems I’m in some kind of pickle. For some reason, two of the programmers at the company I work for still use Hungarian notation.

In case you don’t know what that is, in short: Hungarian notation prefixes an abbreviation of either the data type or purpose of the variable to its name. For example, Microsoft’s WINAPI still uses it, hence we have things such as hInstance, nShow, szCompany, etc. So it’s quite ugly and confusing to the programmer.

Yet these two programmers still cling to their old ways and refuse to give up on this ancient method. Even in VB.NET. One of these programmers happens to be Joe the Programmer mentioned before, go figure.

I was asked by one of them “Why not use Hungarian notation?” In case you dind’t know, dear reader, the name of the variable should give away the data type, use UpperCamelCase and logic for your naming conventions. Turns out, UpperCamelCase is a programming convention in this company, so why we were arguing, I don’t know. Now if only logic were a convention, we’d be set.

But it was like pissing against the wind as neither them nor I were persuaded in the end. How would you persuade a person to switch to a different methodology? By them using Hungarian notation, people who will eventually take over their source code will want to shoot themselves.

What if .NET would be Discontinued?

1 minute read

I’m not known as a person who particularly likes the .NET framework but I still have to use it. The .NET Framework is basically a massive library of general purpose functions, much like the Standard Library is to C or the Standard Template Library is to C++.

But what if it all would be discontinued?

It’s not an impossibility and rather likely considering Microsoft’s track-record. The millions of applications, libraries and websites created with .NET would be useless.

I’ve been fortunate enough to be part of a VB6 (CGI) to ASP.NET (VB) conversion team and, trust me when I say this, you don’t want to be part of such an effort. These conversions require truckloads of time and money, and if you work for a mid-sized to large corporation, this could easily lead into the millions of dollars.

Now imagine all of your code obsolete. Everything you’ve coded since .NET 1.0. What would you do? Let’s take FoxPro as an example. Microsoft bought FoxPro in 1992 and released a couple of versions under the “Visual”-family of products. The last version was released in 2007 and a statement of Microsoft suggests that this is the last version.

No migration tools to any other language are being provided.

Another product would be J#, which will be retired in 2015. Keep in mind that J# is a fairly recent product and was only released with Visual Studio.NET.

How far will .NET go before a turning point is reached? Consider that .NET was first released publicly in 2002 and will be a decade old in less than four years. Knowing Microsoft, the end is quite possibly much nearer than you think.

Amount of Digits in an Integer

1 minute read

Here’s another little snippet that might come in handy in your programmatic travels. I’ll show you an example of usage below, which might also be of interest to you. The code presented is in C, not C++. First, the code to count the amount of digits in an integer:

Read 498 more words...

Flattening Multidimensional Arrays

1 minute read

Edit: Thank you, fixitman for the insightful comment; the code has been fixed to work with non-square arrays as well.

In an effort to produce a better performing multidimensional array, I would like to share the following with you. Say we have a Matrix (or multidimensional array) of 5 x 5 integer elements, M. In order to allocate such an array in C++, we use the following code:

Read 489 more words...

CriticalSection wrapper class

2 minute read

2023 Update: You probably don’t want to use this code since there are likely some serious issues with it. But, fun fact: a major tech company reached out to me to clarify what the license for this is. So, if you want to screw yourself over and use it, let’s say it’s MIT licensed and call it a day.

What: A C++ wrapper around both WINAPI (Microsoft Windows) and PThreads (POSIX threads) functionality.

Why: To abstract cross platform functionality.

Remarks: On windows, CRITICAL_SECTION objects cannot be shared cross-process. This means that the class is tied to your application or DLL process. Comments are in Doxygen/Javadoc style.

Read 568 more words...

Preliminary view of DirectX 11

less than 1 minute read

Following is a list of the major features that have been announced to be included in Direct3D 11, the next generation Graphics API included in the DirectX SDK. In my opinion, the changes (rather, additions) brought into this API are excellent so far. It seems as if the API has finally grown up and is in no way, shape or form comparable with older DX versions and deprecates OpenGL 3.0 at this point.

Read 115 more words...

Don’t worry, it’s just a warning.

less than 1 minute read

I don’t like Visual Basic, yet in many Microsoft shops, VB is still being used especially in combination with ASP.NET. The problem with Visual Basic is that it’s not very strongly typed. Conventions are often thrown out of the window and Senior VB developers often hold their seniority as experience which, is more fiction than fact.

How many more times do I have to see Functions which don’t return anything and should have been declared as Subs.

Or:

Variable 'XYZ' is used before it has been assigned a value.

Or:

Variable declaration without an 'As' clause; type of Object assumed.

Ugh. You’d think that people with 15 years of development experience wouldn’t dismiss this kind of stuff and just do the right thing.

OpenGL 3.0 - 1 hour after

1 minute read

Artistic License?

Once upon a time there was a little old API, struggling for its life amongst the giants of software. Little old OpenGL knew that in order to survive it had to adapt to a strange, bewildering and new environment; it was a strange new world indeed. For two years, rumors of old OpenGL’s struggles reached the user-groups and there was much rejoicing indeed. But on one faithful day, August the 11th of 2008, OpenGL perished. Its age and idleness had (as with all things good and bad) caught up with him and slayed little old OpenGL in its path.

After reading the spec and looking desperately for the promised object model, I felt quite like a (self-censored) taking the newsletters seriously and writing about them so explicitly.

For those who haven’t read the specification yet, it’s OpenGL 2.1 plus and minus some stuff, hardly the fruition of two years labor. The anticipation that followed the initial announcement of OpenGL 3.0’s Object Model was tremendous. For the first time in a long time, people started noticing OpenGL again and maybe a place for it in modern multimedia applications such as PC games besides id Software’s titles.

Alas, it was not to be. Woe is me for my old API is truly dead. D3D, hello.