Saturday, 23 February 2019

Its all a question of metier

I've had one of those moments, taking the wife to a new hair dressers, I had to sit and after giving up the pile of decidedly feminine magazines as a bad job I used my phone to crib up on a problem I'm having setting Code Collaborator up properly.

The problem aside, it's just one of those things, I needed to read the info.

About fifteen minutes into my reading and with many female voices cackling merrily away their 11 o'clock comes in with her husband in tow.  He takes the seat with me and we do the usual nod of the head and tut at the flapping the girls are all doing cooing and fawning over one another.  It really is all a bit beyond me, some form of communication is taking place, but I'm not certain what kind.

Alas, five minutes after our perfunctory nod and his going through the self same magazines he strikes up a conversation "you reading something good?"

I reply, good naturedly and we're washed over with a wave of cackling.

"Computers eh?" he says it like it's some mystery force in the universe, "our lads into them, doing his A-Levels".

I listen again, "Yeah he wants to go into using them, looking at his degree options and he got into Nottingham".

So, I do the dutiful thing, I ask what degree... I'm expecting computing, programming, systems or something...mathematical maybe physics at an outside edge.

"He's going to do English Literature"

I don't really think about it, I just ask what's the link to computers then?

"Wants to work with them".

And I can't help it, but we're in this rabbit hole and I ask "How does he jump from English Literature to working with computers?"

The guy fumbles a little here, I think this maybe the first moment he's thought about the tenuousness of the connection from A-Levels in Sociology, English Lit and Physical Education, a degree in English Literature and the wish to work in Computers.  But he gathers himself in a flash.

"He uses a right good laptop for his home work".

Game over, good night vienna, sensible has left the building.

Our conversation peters out some at this moment and I just leave him to this thoughts as my wife's done, but I can't help think about the metier here.  Computing is a goal, or the lad enjoys playing games, but he's studying completely unrelated topics, with no seeming extra curricular things, and he'll no doubt be out trying to get any computer related job, I don't know what, maybe sweeping out server rooms.  But he'll be cheaper than a qualified person in a computer academic bent.


Thursday, 21 February 2019

RAF Tornado Retires

I'm quite sad to see the retirement of an icon of my age, born in 1978 I saw the Tornado come into service and has a lad had a cool postcard poster of one coming into land, it was such a modern thing and to my eyes still is, the forward angle on the air intakes, the vaunted carrying capacity and the potential for this pan European jet to enter service and serve us well.

Which she has, the Tornado has been a mainstay for the RAF, its replacement isn't even clear cut, as the aircraft was so versatile, we see the Eurofighter Typhoon taking on the air-superiority and potentially some of the light strike capabilities, we see the F35 coming over from the US to augment the fighter force, but they're machines at the moment, they're things.  The Tornado for me, she has a certain personality.


Friday, 15 February 2019

Coding Standards - About Scopes (again)

Consistency is good, consistency is light, consistency is really what you need think about when creating code, no matter what format, language, platform or project you're on do things the same way, and even on your first pass do them your way consistently before you apply any locally demanded view of the code....

What do I mean by view?  Well, I'm talking about coding standards, but the non-functional side of things, hence the view.  You can look at code from any angle you choose, indeed there are multiple ways to achieve the same solution within code, the difficulty is to get things out there, put them down, then sort the wheat from the chaff.

I've done this in a couple of videos, where I move pieces of code from their own coding layout to my own, I have labelled these "coding standards", but in retrospect they've just the coding view.

One of my big points is the notation for the scope of variables, I love to use scoped notation.  Having been brought into programming when Hungarian notation was not only taught to you academically as required, but demanded by all projects you worked on (basically as you had no code completion tools, so knowing the type of a named variable whenever you utilised it was really very useful) but that was twenty plus years ago, now we have code completion I strongly feel your tools should be made to work for you.

Therefore, when I complete a call or variable name, I want that to communicate something to me, and the most useful is to check the scope, the code completion tells me the type and the name, but scoping isn't really fully covered in the tooling (please post below any suggestions for Visual Studio, Atom, CodeBlocks or Visual Studio Code which perform scope notation or checking on the fly).

When I complete my typing and pause I want to see all the m_ members together, all the c_ constants all the s_ statics and so many coding standards documents define these three.  However, it's just not far enough, what happens when you have locals named 'angle', 'view' and 'Gregorian'?  They're at very different points within the code completion window which pops up, you have to remove your hands from the keyboard to begin scrolling through them; or worse still start typing letters in order to guess the name (for instance we may start to type a c to see if 'Gregorian' comes up actually as 'calendar').

My solution?  The solution I've been pushing time after time, post after post, video after video?  Scope more things.

We can add "local" as "l_", parameters as "p_", we can compound them, so a static constant maybe "sc_" and we can tailor this in whichever manner we feel fits best, but be consistent.

Let me be utterly clear, this is not Hungarian notation of old, we are not adding "i" to integers or "l" to longs, we are not defining the type within the name, we are simply defining the scope and helping the tools to help us by grouping the various scopes of variables together.

I find it incredibly hard to read documents which go half way, defining members as "m_" (or just a leading m) is extremely common, ditto for constants and even statics, it's only with parameters people get a little squeamish.  "p_" is sometimes reserved for pointer, but that's a style edging back to Hungarian you're notifying the reader of the type and use rather than the scope, therefore I push "p_" as a parameter.  But I can also see arguments for "i_" and "o_" for parameters, which tell you it's an input or output to the function.  If one wanted to be a pedant you could go so far as to stress this with "pi_" and "pi_".

This isn't to say I'm for everything, for example in returning from a function:

int foo();

I will not define an "r_" as the return scope, I'm not interested in the semantics to that extent, and I don't feel code like this:

int foo()
{
int r_result(0);

... Some code to set r_result

return r_result;
}

Is communicating anything useful, so often in my code you will find:

int foo()
{
int l_result(0);

... Some code to set l_result

return l_result;
}

As the result remains a local until returned.

Which brings me back to my second bug bear of the month, one which I've already blogged about returning early.  I'll let you remind yourselves of my opinions.




And just a note to the world at large, if you're coding "m_" for members, but ALSO add Hungarian notations "m_iInteger" stop, stop it now... and yes that includes when you're doing pointers "int* m_pIntegerList"... argh, I want to pull my own arm off just to have something to throw at the screen when I see this one, it's a hybrid as annoying as the Alien in Alien Resurrection.


What's my solution?... Well the completely sane idea I use is "m_IntegerListPtr"... Yes, it's a pointer... I tell myself it's one, I'm not strange at all... Alright, maybe a little.


Sunday, 10 February 2019

The Lost Router

Its gone... Just gone.. Puft... Up and gone... I remember it in the box, I remember packing it... Puft, gone, where is it?... Have you seen it?....

LOST


LinkSys WRT AC1900

Responds with the SSID "XelNet"

Likes to sit on the side serving internet pages to the house and the occasional belly rub....


It's just lost.. I've come this weekend to sort out my network situation, so I've finally gotten an afer market ADSL modem to replace the BT Home Hub, I've got a powerline network adapter to carry network upstairs to the wired office (rather than running wires through ceilings just yet).

I've gotten the hub for the garage and the hub for the office sorted... And all the smaller ethernet cables all crimped to perfect length to stop wires trailing all over under my desk and behind the TV.

But, then I go to find my router and it's just missing... I remember boxing it back in it's own box on moving day, I remember doing that.... I remember it distinctly.

I think it went into my car, not the wifes... My car is now clearly empty, I emptied it... So I've been through EVERY box in the garage three times, been through the loft twice, I've been through every nook and cranny I can find...

My thoughts are that maybe, perhaps, it's at the in-laws house, I've asked them to look and they just said "no"... But I think it's there by their PC and they don't realize the box which looks like theirs is mine.

So frustrating!


--------

Update, the wife came with to go through EVERY box in the garage with me... Guess what... No, no... She didn't come up smug (I knew you'd think she would)... The thing is still LOST... GONE LOST VANEEEEEEEESHED.... Gah.

I think I have to go look at the in-laws.