Saturday, 18 January 2020

The Point Behind The Question

The first month of 2020 kicked off with a Parliamentary tussle when Minister Chan Chun Sing provided statistics on how employment in Singapore had increased by nearly 60,000 between 2015 and 2018. MP Pritam Singh challenged him to provide a breakdown across all industry sectors in the Industry Transformation Maps (ITMs); and furthermore, to provide breakdowns for the data between Singaporeans and Permanent Residents (PRs) because up to that point, Singaporeans and PRs had been categorized under a single group. Minister Chan responded with the following (rather defensive) rebuttal, which, incidentally, led to an amusing slew of memes around his retort "what is the point behind the question?"



"We can get you the numbers. But let me say this. What is the point behind the question? First, has local unemployment increased with all these efforts? The answer is a resounding 'no'. Our people are getting good jobs. Are our wages going up? Yes, and it's faster than many other countries. Those are proof points to show that we are doing right by Singaporeans.

But I'm always very cautious about this constant divide, Singaporean versus PR. The insinuation seems to be that somehow Singaporeans are not benefiting."

While I probably wouldn't have put it that way, I'm inclined to agree that while a breakdown would certainly provide more information, it's pedantic at best for the purposes for which this data was intended - to track how well the ITMs are doing. I assume that MP Pritam Singh was making the request out of purely academic interest, and admittedly viewing that data for the Infocomm and Media sector would be very interesting for me personally.

There is also the small matter of the other point that Minister Chan raised. Singaporean unemployment had gone down. But seeking the data in order to establish whether or not PRs were benefiting more than Singaporeans comes across as - dare I say it? - petty and small-minded.

Foreigners in the tech sector 

In certain segments of Singaporean society, there's been a fair amount of resentment towards foreigners due to the perception that they steal jobs that rightfully belong to "true-blue born and bred" Singaporeans. Hence the inclination to check if more higher-paying jobs are being occupied by foreigners than locals.

And you know what? They probably are. So what? Do people honestly imagine that these higher-paying jobs could be just as easily done exclusively by local talent? Without a certain amount of foreigners coming in to fill those positions, the global tech companies such as Facebook, Google, Amazon, IBM and Microsoft would have significantly less incentive to set up shop here. And that means the opportunities I've had for the past few years would be non-existent. I would probably still be sweating it out for cheap local bosses - you know, the kind who pay you just 3,000 SGD a month and expect your immortal soul in return.

Modern-day slavery.

Sure, I may not be earning as much as many foreigners. But I'm earning way more than I used to. Sometimes, comparing what you have now with what you used to have, makes a heck of a lot more sense than comparing it with what others have. With the former, you at least see progress. With the latter, you'll never be happy because your aspirations (what others have) will exceed your abilities (what you can get).

Simply put, I don't care who's doing better than me. I only care that I'm doing a lot better than I used to.

In my workplace 

When I tell people that I'm the only Singaporean developer in a team full of foreign developers, they're quick to jump and point to unfair hiring practices and foreigners being favored over locals, and that someone like me is being hired only to satisfy the quotas for local workers and increase the allotted quota for foreigners.

Firstly, that's rubbish. The foreigners I work with are on Employment Passes, which are not subject to foreign headcount quotas at all.

Secondly, Singaporeans have been interviewed for the job before. Exceedingly few of them made it. And if I'm an example of a Singaporean who survived that interview process, I shudder to think how shit unqualified the others must be if they didn't.

Thirdly, administration-wise, it is actually easier to hire a Singaporean than a foreigner. Employment Passes take time to get approved. And if candidates need to go through Government security screening, foreigners take roughly twice the time it takes for a local.

Lastly, of all the Singaporeans who actually got the job, very few stayed past one year. Apparently it was too much work for too little pay. I happened to have come from worse conditions; ergo I was happy to stay. Also, many Singaporeans have been conditioned to look down on contract positions and any position that has no potential for them to rise through the ranks. It helps that I've never wanted a higher-ranking post, because accepting that increase in responsibility for just a little bit more pay just never made any practical sense to me. I suspect quite a few people want those jobs not because they actually want them, but because they've been conditioned to think that they should want them. Because of "Career Progression" or some such bullshit.

So, no. In my organization's case, it's not that companies don't want to hire locals. It's more that locals are either disinterested or unqualified for my position.

Now, the Fair Consideration Framework isn't perfect, not by a long shot. But it's a heck of a lot better than nothing, which is pretty much what we had before 2013. The Government actually exceeded my expectations here. Instead of simply incentivizing companies that did adhere to the Tripartite Guidelines on Fair Employment Practices, they actively went after companies that tried to circumvent those rules.

Sure, there are always going to be people who deride this news, and label it Wayang. And they do have a point - it seems to be the smaller companies that bear the brunt of the investigations.

But you see, it is precisely these smaller companies that flout these regulations because they have a more intense need to. The bigger ones - the really huge ones - have too much to lose by not following the laws of the land. And they're less concerned about squeezing every drop of blood and sweat from their employees. Facebook is more interested in invading our privacy for profit. Google is more interested in tracking our every move and appearing not to be evil. As for Apple, they've got child labor in China sweatshops - quite legally too, as it happens - why would they waste time screwing over a relatively paltry number of Singaporeans on this tiny island?

So, if one of these mega-corporations doesn't want to offer you that cushy five-figure salary, it's probably not because they have any preference towards foreigners. It's more likely that you're just not good enough. These huge tech companies have very stringent acceptance criteria, and it's rarely a case of where you're from, but how qualified you are. More often than not, that describes a foreigner. And they're hardly going to break a sweat over losing prospective hires to employment regulations in Singapore, because there's an exceedingly long line of talented people who want to join their ranks.

Talent in various shapes and forms.

The other reason I want these mega-corporations around, is because I have relatively recent, very unpleasant memories of working for local employers with an exceedingly strong affliction of The Chinese Towkay Syndrome. Back then, in the tech sector, it was an employer's market and these bosses were as exploitative as they come. The presence of large multi-national tech corporations with a plethora of employee benefits and higher wages, keeps these guys honest because they're no longer the biggest or only game in town. And if this means that a big chunk of higher-paying jobs are going to foreigners, so be it.

Why employers seem to prefer foreigners 

The common misconception seems to be that foreigners are better workers - more diligent, more knowledgeable, more accommodating, more everything. And, of course, cheaper. Undoubtedly, some of them are. But that's not where their true value lies.

Foreigners are generally only able to work in Singapore if issued a pass of some sort - a Work Permit, S Pass or Employment Pass. When employment ends with an organization or the pass has expired, they have a limited time to stay in Singapore to find another employer willing to take them on. Things get complicated fast if they have family here, perhaps children studying in local schools.

Therefore, since their continued employment exists at the pleasure of their employers, foreigners are generally more obliging. Also, if they're here alone with not many family and friends, there's not much for them to do in their spare time and they're usually more than happy to take on extra work.

Eat shit, and like it.

Simply put, a foreigner will put up with demands that a local won't. They'll eat shit, and smile while they do it. Locals are far more likely to walk away if it gets too hot in the kitchen, because we can. Foreigners simply don't have that luxury.

So for those who like to complain about the lack of Home Ground Advantage, this is your Home Ground Advantage. And it's no small one. In fact, its so big that many companies would rather not deal with it. If you need proof of this, take your average docile foreigner and issue him or her PR status, and see how swiftly their attitude changes when their stay is no longer directly dependent on the goodwill of their employer.

Should the data be released to the public? 

Absolutely! Do it!

Assuming that disgruntled Singaporeans actually find evidence that more PRs are occupying higher paying jobs than Singaporeans, just what are they going to do about it? Move out of Singapore to greener pastures? If they actually had the ability to thrive elsewhere, I suspect they would have done it already, as opposed to squawking on Social Media.

Just go.

No, this is Singapore and we are a nation of Champion Grumblers. The late great Lee Kuan Yew said so himself. The Government should have faith that we'll accept the reality of the situation and get back to work. We complain excessively, of course, but when push comes to shove, we ultimately choose the most sensible and pragmatic option. Let's not ever change that.

Those that don't want to accept the reality of Globalization have the option of leaving. And they should. At the very least, it will give them a taste of what it's like to be a foreigner somewhere else and be the ones eating shit while those countries' locals complain about them for a change.

In closing 

Singaporeans are a competitive lot. We hate losing. And we especially hate losing out. That's a good thing.

However, being competitive is meaningless if we are not also competent. Aim high by all means; though if something is out of reach, better yourself in order to reach it. Demanding that the Government make things easier ("fairer") for us is one thing, but let's not abandon our responsibility for our own career development.

Does that mean I think that the noise-makers on Social Media clamoring for more transparency from the Government ought to tone it down a notch, then?

Oh heavens, no. Not a chance.

Sure, the Government's job would be a lot easier if we all simply went along like mindless sheep, but here's the thing: governance isn't meant to be easy. Anyone going into governance thinking that it's easy is under a severe delusion and needs to be disabused of it ASAP. Governance requires character of sterling quality. Running things for a few million loud complainers isn't easy... but neither is maintaining good standing and friendly relations with countless other nations with far larger populations and longer histories, some of whom have nuclear warfare capabilities. If a would-be Governor can't cope with the former, he or she has no business at all attempting the latter.

So keep holding their feet to the fire, you lovably noisy malcontents. Just don't forget to help the Government do their jobs by keeping yourselves employable. Because if all we're good for is raising a fuss on Social Media, Minister Chan Chun Sing's stated dream of locals one day taking those high-paying jobs may never come to fruition.

Pointedly,
T___T

Sunday, 12 January 2020

An exploration of JavaScript's variable declaration keywords (Part 3/3)

Now we come to the const keyword. Its rules are the strictest, and it should be used only in cases where the variable's assigned value is not expected to be changed.

The const keyword
It functions almost exactly like the let keyword, with one major difference - its value cannot be reassigned.

If you try this using the let or var keyword, this is legitimate and will be allowed.
let a = 5;
console.log(a);

a = 10;
console.log(a);


5
10


For const, you get an error. You can't reassign it some other value.
const a = 5;
console.log(a);

a = 10;
console.log(a);


5
Uncaught TypeError: Assignment to constant variable.


In fact, if you try to declare a variable using const, without an initial value...
const a;


...you get this error.
Uncaught SyntaxError: Missing initializer in const declaration


Needless to say, this wouldn't work either.
for (const i = 0; i < 5; i++)
{
   
}


Uncaught TypeError: Assignment to constant variable.


There is a way to get around this rule, though. Objects!

Say you declare an object variable using const. Let's call it obj, with properties a and b.
const obj = {a: 5, b: 10};

console.log(obj.a);
console.log(obj.b);


5
10


Now if you did this, there would be an error.
const obj = {a: 5, b: 10};

obj = {a: 10, b: 5};

console.log(obj.a);
console.log(obj.b);


Uncaught TypeError: Assignment to constant variable.


But if you do this, it works!
const obj = {a: 5, b: 10};

obj.a = 10;
obj.b = 5;

console.log(obj.a);
console.log(obj.b);


That's because it's the properties of obj whose values you're reassigning, not obj itself. Cool, huh?
10
5


In Conclusion

let and const introduce some rigidity into JavaScript, where it had previously been way too flexible for the comfort level of many programmers. It's possible to use var the same way too, but you'd have to be very disciplined. Maybe even extraordinarily disciplined. And when there are a lot of moving parts in your project, it may not be worth the effort.

I've been using var in JavaScript for a long time now out of sheer habit. Because I almost never use it in a way that would introduce problems, so far it hasn't given me many. But as times change, so must programming habits evolve.

Kind and constant regards,
T___T

Friday, 10 January 2020

An exploration of JavaScript's variable declaration keywords (Part 2/3)

In this next part, we'll take a look at how the let keyword is used. let was introduced in ECMAScript, tightening the functionality of JavaScript's variable declaration.

The let keyword

Like var, let is used to declare variables. In its simplest form, it's used similarly.
let a;

console.log(a);


undefined


let a = 5;

console.log(a);


5


If you declare a variable more than once using let, it'll produce an error.
let a = 5;
let a = 10;

console.log(a);


Uncaught SyntaxError: Identifier 'a' has already been declared


Unlike var, if you try to access a variable before it is declared, you'll get an error. Hoisting does not apply.
console.log(a);

let a;


Uncaught ReferenceError: Cannot access 'a' before initialization


Unlike var, a variable declared in a block using let cannot be accessed outside of that block.
let a = 5;

if (a > 5)
{
    let b = a;
}
else
{
    let b = a + 1;
}

console.log(b);


This is the error that will be produced. Variables declared using let are block-scoped.
Uncaught ReferenceError: b is not defined


Again, any variable declared using let cannot be accessed outside of the block it was declared in.
for (let i = 0; i < 5; i++)
{

}

console.log(i);


Uncaught ReferenceError: i is not defined


Where functions are concerned, let behaves just like var.
let a = 10;

function x()
{
    a = 0;
}

x();

console.log(a);


0


function x()
{
    let a = 0;
}

x();

console.log(a);


Uncaught ReferenceError: a is not defined


Now try this...
let a = 10;

function x()
{
    let a = 0;
}

x();

console.log(a);


When you try to access a at the end, you get 10 instead of 0. That's because a is now declared as a variable using let, within function x(), thus the value of that a can't be accessed.
10


What we've learned

let is block-scoped. Thus if a variable is declared inside a block, it cannot be accessed outside of it.

Any variable declared using let cannot be redeclared, though its value may be reassigned.

let is stricter than var and is subject to more limitations. This is a good thing in the sense that rectifying (or better yet, avoiding altogether) the resultant reference and syntax errors will in turn help the programmer avoid logic errors down the road.

Next

Examining the const keyword.

Wednesday, 8 January 2020

An exploration of JavaScript's variable declaration keywords (Part 1/3)

With the creation of ECMAScript, JavaScript's days of being derided as a "loose" scripting language have come to a halt. Well, not really, but at least proponents of a variable definition stronger than the traditionally-used keyword var have had their prayers answered in the form of let and const, in 2015.

This post is maybe five years too late, but what the hell. Today, we're going to take a look at those.

The keyword var

This is used to declare variables. They can be declared just about anywhere.
var a;

console.log(a);


undefined


var a = 5;

console.log(a);


5


You can access a before even declaring it. Although, I really can't think of a reason why you'd want to.
console.log(a);

var a;


undefined


If you declare a variable twice using var, it will take the most recent value assigned to it.
var a = 5;
var a = 10;

console.log(a);


In this case, it's 10.
10


Let's try this again, explicitly declaring a again, and setting the value to undefined.
var a = 5;
var a = undefined;

console.log(a);


So far so good.
undefined


But what if the second time, you didn't specify a value?
var a = 5;
var a;

console.log(a);


In this case, it's 5. JavaScript uses the most recent value assigned to a.
5



JavaScript assigns the default value of undefined to all variables that haven't been declared, or declared but not assigned a value. This is known as hoisting.
undefined


A variable can be declared using var inside a block...
var a = 5;

if (a > 5)
{
    var b = a;
}
else
{
    var b = a + 1;
}

console.log(b);


6


... then redefined outside of the block.
var a = 5;

if (a > 5)
{
    var b = a;
}
else
{
    var b = a + 1;
}

var b = 10;

console.log(b);


10


Just for good measure, try this!
for (var i = 0; i < 5; i++)
{

}

console.log(i);


You'll notice that you can access i outside of that For loop! That's because the For loop is a block.
5


var can be used to declare a variable outside of a function, then accessed within that function.
var a = 10;

function x()
{
    a = 0;
}

x();

console.log(a);


0


However, if var is used to define a variable inside of a function, it cannot be accessed outside of it.
function x()
{
    var a = 0;
}

x();

console.log(a);


This is the error that will be produced.
Uncaught ReferenceError: a is not defined


You can use var to redeclare a outside of the function and assign a value to it.
function x()
{
    var a = 0;
}

x();
var a = 5;

console.log(a);


5


What we've learned

var is function-scoped. Thus if a variable is declared inside a function, it cannot be accessed outside of it.

Any variable declared using var can be redeclared. This can lead to confusing scenarios. The looseness of JavaScript can be a boon in the sense that it's very forgiving, but in large-scale scripts, this can make errors hard to detect.

If JavaScript is the only language you have ever used, you probably won't think much about this. But if you learned other languages before this, var's behavior will seem really nonstandard and inconsistent to you. It's predictable enough; you just need to understand the rules behind it.

Next

Examining the let keyword.

Saturday, 4 January 2020

The GovTech Experience

Late last year, I went through a delightfully different recruitment experience.

Someone from HackerTrail called me up and asked if I was interested in a position in GovTech. For some background, GovTech is a Singapore Government agency that deals with software, internet infrastructure, cybersecurity and all that good stuff. It's a restructuring of the former Infocomm Development Authority of Singapore (IDA).



I was under contract to another firm (and still am!) and when you're in that kind of position, you simply don't say no to an opening like that. Besides, all HackerTrail asked me to do was take one of those online coding tests.

And, you know, I absolutely love that shit. When I have time, I actually do these for fun. And now I get to have an interview opportunity if I pass?! Son, you had me at Hello World.

Stage One

The test took three hours and it was by no means easy. The coding problems were certainly straightforward enough, and since my Apache server happened to be up, I did all of it in PHP. The first few tests ran beautifully, but my solutions probably failed on efficiency. Still, I documented my code, submitted and put it out of my mind. I probably wouldn't get called up, I reasoned; any serious algorithms practitioner could do better.

Online coding problems.

To my surprise, a few days later, HackerTrail called again and informed me that I'd been selected for a recruitment event at GovTech next week.

Wow. A recruitment event. With a table of events, opening speech and everything. It would begin at 3PM and last until evening. Stage Two would start around 3:45PM after an opening speech. This would be followed by a catered dinner and networking, and Stage Three at 7PM.

At this point, I was under no illusions that my code had been exceptional or anything. In fact, considering I hadn't heard of this event until now, one week before it was scheduled to begin, I suspected that attendance was low and I'd simply been drafted to make up the numbers. Still, other than half a day's leave, what did I really have to lose? It was a job opportunity that looked worth exploring.

Also, I liked the way they hooked me with an online coding test first. It may not have been guaranteed to bring in the finest minds, but if they had intended it to attract people who actually liked doing this, well, that was pretty damn clever. And the fact that the coding test had not been stack-specific, was a bonus. Some companies want to hire for a particular technical stack only, a practice which I consider really short-sighted. It suggested to me that GovTech was hiring based on foundational skill rather than experience in any particular language, and in my opinion that's the right way to go.

I should also mention that HackerTrail offered all candidates a 20SGD Grab Voucher for the specific destination and time of the event. Nice. These guys were covering all the bases. They must have really wanted attendees bad.

The event begins...

The day arrived and at 2:30PM, I was having a leisurely drink at a nearby cafe. The HackerTrail representative actually called to ensure that I was on my way. I'll be damned, these guys seemed even more anxious about attendance than I was.

At 2:45PM, I made my way to the lobby of the Sandcrawler Building that housed the GovTech headquarters. There, I was brought up the office to register my attendance, where I was issued a pass for the evening and told to enter my particulars in an online form.

Now, my opinion on the ultra-lame practice of filling in forms at an interview has been well-documented (or perhaps I should elaborate even more at a later date) and while their online form was well-designed, this only served to make the experience only slightly less lame. At the risk of coming off as arrogant, I didn't apply for this. They invited me. And now they wanted to act like they didn't already have my particulars? Something seemed a little off here.

The candidates took their seats. There were maybe forty of us. Later in the evening, someone told me that over a hundred online profiles had been shortlisted for suitability and invited for Stage One. Apparently, only forty of us had passed. The others had somehow failed, or more likely, hadn't even bothered.

Sweet! A ping-pong table!
Decor was pretty nice, though. Just the right mount of casualness (non-matching couches, funky fonts on the walls) to give off a hip and comfy vibe. Even had a ping-pong table! Not that I actually play ping-pong, but still.

Stage Two

After an opening speech which, if I'm going to be honest, wasn't particularly interesting and I didn't pay a lot of attention to, we were split into groups of four. Each group was sent to a room where we introduced ourselves to each other. Guy A was a Ruby On Rails dev, and sounded Filipino. Guy B was a DevOps type dude who used Docker. Guy C had an Indonesian accent and called himself a "full-stack .NET developer".

A group of
random devs.

And then there was me. No special labels to speak of.

We were set a project that was to be completed within ninety minutes - an impossibility in itself considering the scope - and graded on our cohesion, presentation and problem-solving approach, all under a tight deadline. Guy A pretty much took charge and broke the project down into tasks so we could each do stuff. Halfway through, I realized that my Git wasn't working, and contented myself by being totally useless acting like some glorified Project Lead and trimming the list of User Stories down to size.

Not my finest moment, to be honest.

Then again, I'm not sure any of us really covered ourselves in glory here. Guy A handled the database schema, Guy B failed to get Docker running, and Guy C pretty much hard-coded the front-end. As a team, we were an absolute failure.

Dinner And Networking

Then it was time for dinner. And let me just say the buffet spread catered for this event was more than just decent. It was smashing. Fish, seafood, huge chunks of roast chicken, dessert. GovTech certainly wasn't holding back.

Fancy.

It was at this time I took a look at the door gift that the reception area had given me upon registration. Oh, wow. A wireless mobile charge with the GovTech logo on it! Too bad my mobile phone was an older model. That aside, this was pretty cool.

There weren't enough assessors to conduct Stage Three for everyone at once, so some of us had to wait. As we waited for Stage Three, we got to talking. Like me, everyone here had been headhunted by HackerTrail. We started discussing, like a bunch of programming geeks, how each of us had solved the coding questions in Stage One. Surprise, surprise - just about everyone else had gotten similar results. No one I spoke to got a 100% score, or even a 50% score. This made me feel a little more optimistic about my chances.

Stage Three

I was ushered into a room with a HR Representative, who told me that we were waiting for an engineer to arrive. She looked tired. "Long day?" I ventured sympathetically, and she exhaled in affirmation.

The engineer tasked to assess me presented me with a pair programming exercise - and to my surprise, they reused the same coding question I had been posed in Stage One. The coding problem had been modified slightly so that I could reuse my earlier code to solve the problem with the updated specs. Only, this time, I was using a borrowed Mac from my ex-boss and didn't have Apache server installed, so I couldn't reuse my old code. The engineer was pretty nice about it and even offered to let me download the software onto his Mac, but seriously, it was just code. I could do it in vanilla JavaScript just fine.

Pair programming.

To heck with it, I just redid the whole thing and modified the code on the fly. Sure, my code wasn't up and running by the time limit, but he hopefully got a good grasp of my thinking process.

The engineer looked kind of tired too. I wondered aloud just how many times he'd had to walk through the same damn coding problem today, and he responded with a chuckle.

Finally, the representative from HR and the engineer sat down with me for some good old Q and A. It was the very standard "tell me about yourself" and "why do you want to join GovTech" shtick. The engineer asked me about a few projects I'd worked on in my spare time, and gave me the opportunity to brag. I have to give this guy props; he understood the dev mindset very well.

I was then given a chance to ask them some questions of my own. I'd actually prepared a few over dinner, many of which were applicable either to HR or co-workers. To their credit, they answered in adequate depth and detail and with little hesitation. I wasn't really looking at the answers themselves - I'd probably find them out myself in due course - but rather how they answered them. Did they appear confident? Evasive? If by some miracle I managed to get in, what kind of people would I be working with?

Aftermath

Finally, it was done. I shook their hands, filled up the goddamn exit questionnaire, and left. The time was 10PM. The entire recruitment process had taken seven hours. Exhausting yes, but I suspect it was worse for the event organizers.

Two weeks passed. No one from either GovTech or HackerTrail got back to me, and I have to confess here - I'm disappointed.

I'm disappointed not because they didn't want to hire me. Expecting them to choose me out of forty talented candidates would be a tall order. My ego isn't that big.

But Christ... would it have been too much to send a polite mass email to the ones who didn't make the cut? It's not like I expect this from interviewing companies normally; but the amount of work GovTech had put into the recruitment effort had let me to believe that their rejection efforts would meet the same standard.

Someone dropped the ball there. It's a blot on what was otherwise an amazing experience.

Final thoughts

No regrets. It had been fun. I was there, done that, got the t-shirt (in this case, it was a wireless mobile charger) and I had an interesting tale to tell my friends and colleagues.

I saw this on the GovTech blog.



Show us some code - open source contributions, side projects and school projects.


Since my tech skills aren't anything spectacular, I can only surmise that I was selected due to my online presence, which includes my GitHub repositories and website. And it's always nice to know the work I put into those, paid off.

Another nice thing was that I told my colleagues about what I went through, and they were not only happy for me that I got the opportunity to experience it, they didn't use this as a stick to beat me with or a knife to stab me in the back with. See what I mean about contractors? We stick together.

The fact that I gave them the wireless mobile charger to use, probably didn't hurt.

Ah, well. Another day, another opportunity!

The path of true Gov never did run smooth...
T___T