Coding in Assembly

In my work, I often come across a younger generation of engineers who are interested to write software. When asked on tips on how to be a better programmer, I often tell them to study assembly. The result is usually a mixture of shock and incredulity.

Assembly programming is taught as a matter of course, in any electronics engineering program worth it’s salt. It is a very important skill to learn as it is one of the key areas of programming that require a certain level of technical engineering knowledge to understand. Therefore, as engineers, we have no excuse to be afraid of assembly programming.

Most of the time, these people are coding in C/C++ and not one of the sexier languages. I often remind them that C was only invented around 1970 and humans were perfectly capable of writing complex software in assembly, well before that. Today, many people still write assembly code when they’re forced to deal with certain hardware registers or because there isn’t a suitable C/C++ construct to access specialised features of the processor.

It is in this realm that the electronics engineer comes in handy – to work on software that runs close to bare-metal.

Therefore, it saddens me to think that the younger generation of electronics engineers today think that embedded systems programming means using something like the Arduino. While I think that the Arduino is an absolutely useful tool for developing embedded systems, it is not a great tool to teach it to electronics engineers because it abstracts everything away.

In fact, learning to read and write assembly is an absolutely amazing way of improving one’s programming skills in any language. After doing it enough times, one can truly appreciate how all the software constructs are reduced to machine operations. It basically teaches a person to think like a compiler and allows us to truly instruct the machine to do what we want it to do.

It feels like magic.

PS: Look at the amount of code that was written in the past. Think at how much work went into that. Lines of code? Try volumes of code.

Engineer a Better World

Although targeted at young girls, the message in this video is equally applicable to boys.

Here’s to the day-dreamers, the distracted, and the intrigued – the ones who will go on to engineer our world.

Being Whiplash

One of my interns mentioned to me that her internship experience at my company reminded her of the film, “Whiplash”. I wasn’t aware of this film and looked it up – turns out that enjoys a very respectable 8.6 score on IMDB.

According to my intern, I have pushed them quite hard and she has taken it positively as she has also learned a lot during her internship with me. Personally, I do agree with the view taken by the villain in the film, that is a person cannot achieve greatness unless they are pushed to their limits.

That said, it doesn’t mean that I am a villain!

I just don’t treat my interns with kid gloves, especially if they’re already in their penultimate year. I am of the opinion that, in a society that has descended to a state where people are rewarded for simply turning up, it is our duty as part of the industry, to train our interns to produce quality work because an engineer that produces sub-par work can kill.

Well, to give you an idea of the film, here is the trailer:

PS: She has not been physically harmed by me, yet.

On Blended Learning

There is a growing trend in tertiary education to use blended learning methodologies in running courses. As a result, my interest piqued when I learned that our local public universities were the first in the world to use Massive Online Open Courses (MOOCs).

By using MOOCs, students are able to learn at their own pace as lectures are delivered by video. A student can rewind the video to better understand a difficult concept and pause for toilet breaks.

Also, most MOOCs have online activities and assignments that a student can complete to evaluate their understanding. Their progress through the MOOC can also be tracked.

In general, MOOCs are popular worldwide and I use MOOCs to pick up new knowledge too. Some of the top universities in the world provide access to their courses, online, for free. World-class knowledge is no longer out of reach of anyone with an Internet connection.

But at first, the cynic in me suspected that our public universities were outsourcing education by getting the students to learn from MOOCs instead of their lecturers.

But after reading the article, I realised that they were actually producing MOOC content – Islamic Civilisation and Asian Civilisations (TITAS), Ethnic Relations, Entrepreneurship, and ICT Competency. This got me truly excited.

I quickly checked out the reported MOOC portal but that URL turned out to be a dud. While I think that the Government and media should get URLs right in this day and age, I overlooked this typo as long as students are able to find it.

After using a little Google-fu, I was able to find the correct Malaysian MOOC portal that contained the said courses.

It sure looks nice but beyond the beautiful facade, come the implementation details.

Each subject is produced by teams from different universities. As such, they each have a different layout, quality and structure.

For example, to get to the course materials, you have to navigate under ‘Topics’ for Introduction to Entrepreneurship, ‘Units & Activities’ for ICT Competency, ‘Topik & Aktiviti’ for Ethnic Relations, and ‘Modul & Aktiviti’ for TITAS.

Being a Coursera user, this was rather confusing for me. While things are also organised differently in Coursera, at least the ‘Video Lectures’ are labelled as such under different courses from different universities.

Therefore, I think that this is something that our Malaysia MOOC needs to look into – some form of standard navigation structure so that students do not expend unnecessary brain power trying to navigate the system, especially if they intend to extend the MOOCs to cover all courses in Malaysia.

Some courses have an introductory video and text on the front page, while one only had a video and no text.

I think that having a written introduction is important as not everyone will load the videos due to bandwidth constraints. The written introduction would let them decide if a course is right for them, particularly those who are not required to sign up for the course.

However, I get the sense that these early MOOCs are not targeted for the general public, which is unfortunate because these localised MOOCs could benefit a much wider audience than mere university students.

The first thing that they ask for when you sign up for a course is which public university you come from and what your student ID is.

However, I have to add that it does not restrict sign-ups to public university students. Anyone can sign up for the courses including the general public, without keying in any student ID.

Therefore, this exposes these courses to public scrutiny like never before. Having taken both TITAS and Ethnic Relations before, I have to say that I found some of the material offensive. With the general public able to experience these courses first-hand, I hope that these courses will be improved in quality over time.

I would also like to see this effort extended to all existing courses in Malaysia. The success of various existing MOOCs has shown that it is a viable way to provide quality undergraduate-level education to anyone with an Internet connection. Having more MOOCs, particularly localised courses, will benefit the general public.

Also, there is no reason to stop at university courses. Any Neal Stephenson fan knows that this concept can be extended to all levels of education. Knowledge deserves to be set free. Imagine a Malaysia where anyone can have access to quality education, any place, at any time.

In conclusion, I have to state that I am not against the idea of using MOOCs in our public universities and I am not being critical of government effort in this field.

However, as with all early efforts, there is plenty of room for improvement and I hope that our public universities get things right, ultimately. – See more at:

Gender Gap in STEM

A QUESTION has always vexed me – where are all the women?

If you drop by any college, you will find a healthy number of women studying STEM (science, technology, engineering and math) courses. The numbers may vary from school to school and programme to programme, but taken as a whole, the numbers are fairly healthy.

Anecdotally, about half my classmates were women when I was a student, and just under half my students were women where I previously taught engineering.

However, step into industry and you will find that the numbers drop dramatically. STEM jobs seem to be heavily male-dominated everywhere you look.

This trend has always puzzled me because the numbers don’t seem to make sense.

If we look at the Kajian Pengesahan Graduan KPT study conducted by the Ministry of Higher Education of Malaysia in 2010, the overall ratio of female to male graduates for various Information & Communications Technology (ICT) fields at various public and private institutions of higher learning was 1.04:1.

This means that there is nearly a 1-to-1 ratio in schools and in fact, the number of female ICT graduates is marginally more than that of male ICT graduates.

Logically speaking, the number of women and men in the industry should be similar. However, that’s not the case.

According to a World Bank report in 2002, only about 30% of the ICT professionals in the Malaysian software industry are women. Although there is an imbalance, this doesn’t seem too bad, yet.

If we look at the numbers for engineering instead, the overall ratio of female to male graduates for the various fields of engineering is 0.47:1, which ranges from 0.2:1 for Mechanical Engineering through to 0.99:1 for Chemical Engineering.

While the gender imbalance for engineering is worse than that for ICT, overall, it still does not correlate with the situation in industry.

According to a research report citing numbers from the BEM (Board of Engineers, Malaysia) in 2005, only 12.8% of registered graduate engineers were women, while a mere 2.7% of registered professional engineers were women.

So, from an overall ratio of 0.47:1 at the point of graduation, the ratio decreases to 0.15:1 at the graduate engineer level – that is, those who end up working as engineers – and finally drops to 0.03:1 at the professional level (that is, those who end up using the title Ingenieur or Ir.).

To put this into perspective, for each woman that you find studying and working in engineering, you will find two other male classmates, seven other male engineering colleagues and 36 fellow male professional engineers at the end. A female professional engineer is a rare find.

These numbers are alarming and are reflective of a larger problem in STEM industries. While there may or may not be a gender imbalance at school, it worsens significantly in industry.

Unfortunately, this is not merely a Malaysian problem. The situation is similar in other parts of the world.

According to Forbes, women hold only 27% of all computer science jobs and make up only 20% of the computer science graduates in the United States. According to QS (which ranks universities worldwide), women make up 12% of engineering students and 4% of engineering apprenticeships in the United Kingdom.

Among the many reasons suggested for the gender imbalance, gender stereotypes are commonly cited. This is probably why women shy away from Mechanical Engineering, which is often seen as ‘dirty’ when compared to something like Chemical Engineering.

Honestly, I won’t pretend to know the solution to the gender gap problem but various groups are trying different things.

Lego, the world’s largest toy-maker, has acknowledged this problem and is launching a new line of female scientist figurines to help address this issue. While having female Lego figurines is a good start, a figurine does not make a good role-model, nor a useful mentor.

Grassroots-driven female-focused events like Rails Girls KL and Penang – a one-day workshops that introduce beginner-friendly web application development to women of all ages – are an excellent effort to inculcate an interest for programming in women. Efforts like this help encourage women to take up STEM careers by building awareness and interest.

Women are increasingly being recognised for achievements in the field. An example of this is the Young Woman Engineer award given out by The Institution of Engineering and Technology (IET), Malaysia. These sorts of things should help develop role-models in the industry by highlighting their careers and achievements.

However, even at women-friendly events such as a recent Rails Girls workshop that I attended, where the participants were all women, the mentors were still nearly all male.

I think that we need to do something to address that too. This is where I think that the female minority in industry can and should take the lead. I hope that more women, from industry, volunteer at outreach events, and organise and run such events too.

Having more diversity in the work place is a good thing as it will bring different ideas and capabilities to bear, and I hope that the question will not vex me for too long.

First appeared on DNA here.

Online Dating: OKCupid in Malaysia

Article originally appeared on DNA here.

I HAVE been dabbling a little in online dating recently but unlike most people who dabble, I did some quantitative research on it out of curiosity. Blame it on the academic in me.

I even wrote an academic paper on it for part of my law degree. The actual focus of my research paper was on the effectiveness of techniques for detecting fake profiles.

I wonder what the lecturer thinks of the results. Anyway, I thought that I’d share some findings here.

If you browse around, you will find a lot of research on online dating. However, such research is largely focused outside of Malaysia while my data collection was focused purely on Malaysian, specifically Klang Valley, profiles.

Also, I limited my data collection to OKCupid (OKC) users only.

If you search further, you will find a lot of research done on OKC by its own users. There is even an interesting TED talk on how people can work the system to optimise their chance of success. OKC itself has admitted conducting experiments on its own users too.

My research was neither as big nor as ambitious, but I learned some interesting things about Malaysian OKC users nonetheless.

As usual, I started by sizing up the demographics of the pool. I limited my population to users who had used the service within the last month only as I wanted to count the profiles that were relatively active, and discard non-active ones. Otherwise, the numbers would just be too unwieldy.


The graph above shows the distribution of the profiles, segmented into age groups (Umur) and divided by gender (Lelaki = male; Wanita = female).

The shape of the curve itself is probably as most would expect it to be – that is, a lot of people in their 20s and early 30s on the site, and fewer as one gets older. This, of course, assumes that people report their age accurately, which I have found to be true.

However, the more interesting finding from this is the ratio (nisbah) of men to women on OKC. While the average (purata) is about 2.8 men to each woman, the number peaks at around 4.1 men to each woman in the under-21 age group and drops to 2.0 men to each woman in the 41-45 age group.

Then, things pick up again in the 50s.


Read what you will into these numbers, but fellows, be warned: The competition is pretty stiff. If you are a woman on OKC, the odds are definitely in your favour. You are definitely going to get hits, but whether the candidates meet your criteria are another matter entirely.

From the conversations that I’ve had with several women who use OKC, the problem that they have is that they generally get inundated with messages and various propositions. So, they need to spend some effort in filtering the hits from the misses. This is actually a good problem to have.

Therefore, if you are a man trying to message a woman on OKC, don’t be surprised if your message gets lost in the pile. You may have already experienced this, but you now know how high the deck is stacked.

So, that initial message needs to catch their attention fast, or you risk your message getting ignored, deleted or blocked.

Now, with regards to the authenticity of the profiles, the results are interesting as well. The results for both genders are fairly similar and so, I’ve combined the results into a single graph.


As you can see, fake (palsu) profiles start to pop up in the 20s and 30s as the number of authentic (tulen) ones start to drop.

I think that this graph could also serve as a corollary for the growth of social networking sites. This is probably due to the techniques that I used to verify a profile.

The most effective technique that I used was the reverse image search. This technique allowed me to detect if the photographs that were used in these OKC profiles were found elsewhere. Based on the context where the photographs were found, the profiles were classified as fake or otherwise.

So it is likely that the profiles of younger users could be easily verified as they tend to be users of Twitter, Instagram, Pinterest, and various other social networking sites, while the profiles of older users could not be verified as easily as they have generally missed the social network bandwagon.

This also means that people need to be careful with the photographs that are posted online as these could be used by others for various purposes. I know of one OKC user who has even resorted to threatening those who do so with a lawsuit, but I don’t know how effective that strategy is.

Finally, the main takeaway from all this is that you cannot really tell if the profiles are fake or not for the vast majority out there. Therefore, one should always exercise caution when dealing with other users of online dating sites.

Agreement Disclosure – Non!

This article first appeared on DNA.

THE non-disclosure agreement (NDA) has come to be known as the ‘Silicon Valley Handshake,’ and is now de rigeur in our local industry, especially when dealing with technology companies.

It is often signed right after exchanging our salam (greetings), before any serious business is done.

Over the years, I have developed a certain disdain for the venerable NDA and I now refuse to sign any, as a matter of general principle. Needless to say, I have lost some valuable business due to this as it is often considered sine qua non in commercial relationships with certain types of companies.

And it seems that I’m not alone in this. IBM refuses to sign one unless it is required to receive specifically identified confidential information, while Intel and Microsoft include clauses that exclude from the NDA any information that their employees manage to keep in their heads.

But my personal bias aside, there are some real issues to think about when one is considering whether to sign an NDA or otherwise.

First is the issue of practicality.

When I released my first product in the late 1990s, I was advised to get everyone to sign an NDA before showing it to them. This is what a lot of startups do these days too. I was told that this would help to protect my intellectual property.

Not knowing any better, I blindly followed the practice.

Later, I learned how silly this was as it is impractical for me to enforce the NDA anyway, due to a lack of financial means.

I also learned that business relationships are built on trust. The NDA does not build trust but actually erects hurdles to idea exchange and increases the cost of information management.

Besides lawyers, I do not know of anyone who actually thinks that it is ever a good idea to enforce an NDA in a costly legal battle. It is well known that prevention is better than cure. Therefore, the best way to protect truly confidential data is to, simply, never reveal it.

Second is the issue of legality.

As someone reading law, I have learned that a mere NDA is not enforceable as it often lacks legal consideration – a required element for any enforceable contract. In legal parlance, consideration in this case means receiving something for a promise to keep the secret.

As an example, a legally enforceable NDA is one that a new employee signs at point of hire because he or she receives a job for a promise to keep the secret. But one that is signed after the person is gainfully employed is not usually enforceable unless there is additional consideration given to the employee.

Therefore, asking a potential investor to sign one before a product pitch and getting an external consultant to sign one before preliminary discussions are two situations where the NDA is not enforceable for want of consideration.

Third, an NDA may force the signee to violate fiduciary duties.

This is true for company directors under S.132 of our Companies Act 1965. Amongst other things, it requires a director to consider only the interests of the company alone and no one else, not even personal interests, when exercising his duties.

A company director who signs an NDA can be caught in a situation arising out of a conflict between the company interests and the NDA signed with another company. In such a situation, said director can be sued as a result of not acting in the best interest of the company.

This is also true for consultants. It goes without saying that professionals, such as engineers, owe a duty of care to our clients foremost amongst others, but a consultant will have other clients in the future, often the competitors of their current client as they are operating in the same sphere or industry.

A consultant who signs an NDA can be caught in a situation of conflict between the interests of their future clients and the NDA signed with the current client. They can then be sued by their future clients under negligence for not providing a professional standard of service.

I’d also like to highlight that a registered engineer can get deregistered under S.15 of our Registration of Engineers Act 1967 for a disgraceful act, which includes things like revealing client secrets.

Therefore, an NDA actually creates a no-win scenario for the signee, such as registered professionals and company directors, or anyone else who owes a fiduciary duty to another.

In conclusion, I personally think that NDAs are a silly thing to have and the distasteful practice should be discontinued. In most situations, it is neither legally nor practicably enforceable. It is much better to never reveal trade secrets or to get all intellectual property properly registered and protected.

A good recommendation is that one should only sign an NDA if, and only if, the other party signs an agreement indemnifying the signee against all future lawsuits arising from a conflict between the NDA and any future agreements or fiduciary responsibilities. Personally, I like this idea.

As per my usual disclaimer, I am not a lawyer.