Tuesday, November 18, 2008

I love hg.

No no.. not the element.
I though I would share the rollback thing hg has and how neat and easy it is to use.

[edward@SXCE-Workstation]:/AuroraUX/KDE4/KDE4-Testing/kde4-specs-dev:~>hg rollback
rolling back last transaction
[edward@SXCE-Workstation]:/AuroraUX/KDE4/KDE4-Testing/kde4-specs-dev:~>hg head
changeset: 202:ebee44fa159b
tag: tip
user: evocallaghan
date: Tue Nov 18 06:06:13 2008 +1100
summary: Fix KDE bugID 175420

[edward@SXCE-Workstation]:/AuroraUX/KDE4/KDE4-Testing/kde4-specs-dev:~>hg commit -m "Add Kmix support, needs testing."
[edward@SXCE-Workstation]:/AuroraUX/KDE4/KDE4-Testing/kde4-specs-dev:~>hg head
changeset: 203:cbbcb0228bf2
tag: tip
user: evocallaghan
date: Tue Nov 18 16:04:20 2008 +1100
summary: Add Kmix support, needs testing.

[edward@SXCE-Workstation]:/AuroraUX/KDE4/KDE4-Testing/kde4-specs-dev:~>uname -sv
SunOS snv_99


Monday, November 10, 2008

Learn Ada, not C++.

Its common these days for students to learn C++ , and many apps are indeed written in C++ as a side effect of the above endless circle.

However, The truth is C++ is not all that great really.

**But why Ada..**

Over the next few blogs I am going to just throw(hehe) out a few examples and you can see for yourself.

The important thing here is to learn both before making calls on what is better for what. Clearly everything has its place. Although its good to know a little more then just past your nose ;)

Here goes...

Exception handling;

As you know exception handling consists of three components, the
exception (derr), raising the exception and handling the exception.
However, In C++ there is no exception type. When you raise an
exception you pass out any sort of type while selecting the exception
on its type. In Ada, there is a 'psuedo-type' for exceptions.

So here is some example code:

In C++

try {
} catch (declaration) {

In Ada

 when ident => clean_up();
 when others => clean_up();

OK, now here is a example where we call a function which we know may
raise a particular exception. Although it _may_ raise one that we
don't know about so we *must* pass everything else back up to whoever
called the function.

try {
} catch (const char* string_exception) {
 if(!strcmp(string_exception, "what_we_are_look_for")) {
} else {
} catch (...) {

OK, now in Ada:

 when what_we_are_look_for => handle_it;
 when others => raise;

Yes it even looks better !

This shows how much safer the Ada version is, we know exactly what we
are waiting for and can immediately process it. In the C++ case, all we
know is that some kind of exception occured of type 'const char*' had
been raised, we must then check it still further before we can handle

it !

I will try to keep these short, so that is it for now.


Edward O'Callaghan.