Coding in Assembly

margaret_hamilton
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.

Advertisements

TPPA – IP Chapter: Another Look

This article first appeared on DNA.

The Trans-Pacific Partnership Agreement (TPPA) has been getting a lot of attention recently, as the text has been released after years of secret negotiations.

In Malaysia, there is a special sitting of Parliament scheduled to debate the merits of the TPPA.

I had the opportunity to read the TPPA chapter (PDF) on intellectual property (IP) rights recently.

While the chapter itself is merely 74 pages of legalese, in order to make sense of it, I had to read relevant parts of other treaties – for example, the Agreement on Trade-Related Aspects of Intellectual Property Rights (TRIPS), Paris Convention, Berne Convention – and so on, as these are regularly referenced from within the chapter.

Additionally, I read up on the local legislation such as our Copyright Act, Patent Act, etc., to compare the differences between pre-TPPA and post-TPPA scenarios.

Let’s just say that there was a lot of reading involved for a single chapter, and I can appreciate why few have a real grasp of the entire agreement, and also why many are asking for more time to study it instead of rushing into signing in February.

Politicians and civil society have raised issues of biologics and pharmaceutical patents when it comes to the IP chapter.

However, I would like to point out that the IP chapter goes much further than pharmaceuticals and biologics, and I’m afraid that some other issues may have been overlooked.

I have commented on the issue of copyright extensions previously, and I won’t repeat those remarks here.

However, I’m interested in highlighting some other changes that piqued my interest while I was digesting the chapter.

Sounds and scents

Trademarks are undergoing interesting reform. Trademarks are currently protected under the Trademark Act 1976 in Malaysia.

However, our current law merely protects marks such as unique names, signs, and geographic indications.

Under Article 18.18 of the TPPA, each government must not deny a trademark application for merely being a sound and must also make best effort to register scents.

This means that trademarks are being extended to both sounds and smells. As an example, instead of merely protecting the name of Satay Kajang, one may soon be able to protect the unique smell of burnt satay and also the unique sounds made while it roasts.

Textiles

Industrial design is often missed when discussing IP as it is not primary protection. Industrial design is currently protected under the Industrial Design Act 1996 in Malaysia and typically covers designs such as product packaging and furniture, but not textile designs.

A PwC study (PDF) shows that the Malaysian textile sector is set to register the largest gains in export growth due to the trade effects of the TPPA. I’m sure that our local textile industry is happy to hear this.

Reading Article 18.55 of the TPPA together with Article 25.2 of TRIPS, each government must ensure that textile designs are protected under industrial design.

Also, reading it together with Article 26.3 of TRIPS, the period of protection is being extended to 10 years from the current five years.

As a result, while the textile industry in Malaysia is set to grow, it will have to pay licensing fees for the textile designs that are manufactured, even for designs that are way past season.

Online services

Under the Copyright Act 1987 of Malaysia, Internet service providers (ISPs) are burdened with the responsibility of policing copyright infringements. If a rights-holder complains to the ISP of an infringement, the ISP is required to take certain actions as detailed in the law.

Under Article 18.82 of the TPPA, the definition of ISP is being extended to include online services that store content; and provides links to any other online location using hyperlinks.

That pretty much describes every modern online service.

What this means is that any online service that provides user-generated content, which is pretty much any social media-enabled service, will now be responsible for policing copyright infringements. It even covers content that is automatically scraped and aggregated.

Trade secrets

Trade secrets are mentioned only in a single article within the entire chapter. Also, there is no specific Malaysian law that deals with trade secrets.

Therefore, it is easy to understand why this issue has gone under the radar.

Under Article 18.78 of the TPPA, each government must enact specific laws to deal with the unlawful disclosure of trade secrets and must provide for criminal procedures and penalties if such a law is breached.

I do not think that it is right for the government to incarcerate someone to protect the commercial interests of corporations. Unlike state secrets, trade secrets do not endanger the public nor harm the rakyat (citizenry). Think on that for a minute.

These are just some of the interesting ones but there are many other changes and I would recommend anyone with an interest in IP to read the chapter.

As someone who minds his own business, I will have to get myself ready for these changes as many of the provisions must come into force within two to three years after signing.

Personally, I think that the biggest beneficiaries of the IP chapter are the agents and lawyers. They will definitely see more business.

Maybe it’s time for me to start an IP firm.

Total Recall: Scholarship Woes in 1998

Our government has recently refined the national budget due to the slowing economy in Malaysia. One of the victims of the modified budget is the JPA scholarship programme. You will find details about it reported elsewhere.

I’m not going to talk about the rightness or wrongness of reducing the JPA scholarships. What I intend to do is share a story – one that is familiar with the scholars around my age.

The year was 1998.

We were promised scholarships to pursue our studies abroad the year before. Then, the Asian Economic Crisis hit and the government had to tighten its purse strings. One of the victims was the JPA scholarship programme, but it wasn’t the only one.

Those who were already overseas were fortunate as they were allowed to continue their studies abroad. However, there were many who were less fortunate.

Those who had just finished their pre-university studies and had gotten offers from various universities around the world, and those who were partly through their pre-university studies were hit the worse. These two groups were redirected to local universities – mostly UTP, MMU and UniTEN – and made to sign new local scholarship contracts that superceeded the overseas scholarship contracts that they had signed previously.

The worst hit were the ones who were only partly through their pre-universeity studies. Since the highest academic qualification that they had at the time was SPM, they had to reboot their education and start over. Effectively, they lost a year of their time preparing for a pre-university examination that they never took.

At the time when JPA announced its cuts, there were many other scholarship awarding bodies – such as PETRONAS – who did not announce any cuts. In fact, many PETRONAS scholars thought that our scholarships were safe because oil is traded in USD and PETRONAS was not that badly affected by the falling exchange rate.

However, due to government policy, other government related scholarship funds made similar changes. I got caught up by this as we were told that our scholarship program was cancelled. I will always remember the day that I received that letter printed on thick paper with a PETRONAS letterhead in the post box starting with, “dukacita dimaklumkan…”

Those of us who had yet to begin our journeys were redirected to local foundation programs and offered local scholarship contracts instead. We were the lucky ones as we had just finished our SPM and hadn’t yet gotten a foot on the plane yet, unlike our seniors who were kicked off the plane.

Some still managed to appeal the decision and got to go overseas but these were treated on a case-by-case basis and were far and few between and often required a trade-off.

I had a fellow PETRONAS scholar on a Chemical Engineering programme who opted to switch to a MARA scholarship for Accounting as he was insistent on going overseas and he didn’t really care what course he did.

When I was asked to reconsider my engineering course for an accounting one, I barfed at the idea.

I had a room-mate who was one of those JPA scholars who had already completed his pre-university and had received an offer from a university in the UK. He was extremely unhappy with his change of situation and expressed his frustration very visibly.

However, we all got on with our lives eventually.

Orientation week at our local university was like attending an AA meeting. We would begin by introducing our names, then telling each other what course we were supposed to pursue in whichever country we were supposed to be in. This was followed by our current course at the local university.

In a way, I think that this was therapeutic as we were surrounded by hundreds of others who were caught in the same situation and were equally as frustrated and unhappy. This also helped us to bond as a group as we were going through adversity together.

In the end, I think that things turned out for the best as I still had a wonderful time at university.

I think that our lecturers enjoyed teaching us too as we were essentially the crème-de-la-crème of the country who would have normally ended up studying abroad but are now studying locally instead. They certainly gave us a lot of room to work and shine independently.

Looking back at this experience, I think that it taught me the lesson that there are many things beyond our control in life and plans do not always go the way they were inteded. However, it isn’t the end of the world. Life is much more than an overseas education experience.

As they say, “when life gives you lemons, make lemonade.”

In the end, I still managed to work my way to an overseas education for my PhD, at one of the top universities in the world.

So, this story has a happy ending.

 

Unwanted at Home

I just read an article on TMI about Malaysians who give up their citizenship. While everyone has the right to renounce their Malaysian citizenship, I was curious as to why this was happening. One such person was quoted as saying that:

Lim, a single mother in her 40s, said the idea of renouncing her Malaysian citizenship was not foreign. She had grown up being told that as a Chinese, she was not welcome in the country.

What struck me was that, she had grown up being told that as a Chinese, she was not welcome in the country. I truly wondered who the hell told her such rubbish?

So, I thought back on how things were during my time growing up in Malaysia. The only people whom ever repeated such rubbish were the local Chinese community. I have never been told such things by my school teachers, by the government official or by any other random non-Chinese person on the street.

Therefore, I wonder if such a myth has been perpetuated through the generations, within the community, without any real pith or substance?

I can understand how such a myth could have started. When I was young, I used to be told that the local Chinese are unwanted and therefore, we have to work hard in order to survive. There are a lot of rather unkind sayings about the local non-Chinese community that often accompany such statements. So, being unwanted serves as a sort of motivational push to force the kids to excel at school so that we could all go overseas and leave this godforsaken place.

If that was the reason for creating such a myth, then I can understand the reasons for it but it is a myth nonetheless.

The scary thing about this myth is that I often see it spouted by those who have very little contact with the non-Chinese local community such as those who grew up living in local Chinese neighbourhoods, attended local Chinese schools and had friends mainly from the local Chinese community. These are often the people who shout about it the most.

While I have never attended Chinese school, I have heard rumours of their teachers spouting such nonsense. I would think that the purpose was to motivate the kids to study so that they could all go overseas for their education. In the end, I think that many are encouraged to go overseas including to places like Taiwan, where there is an active effort to attract Malaysians.

However, what I fear is that the myth has become self-perpetuating and is turning into a reality simply because everyone believes it to be true. Unlike in the past, today, we hear more and more stories of people saying such things and there are more and more people leaving our country.

While I don’t think that it’s a bad idea for Malaysians to work overseas for the exposure and experience gained, I do think that renouncing our Malaysian citizenship is an extreme stance to take.

In the end, I honestly think that such a myth should not be perpetuated further. Everyone is welcome in their own home. While the local Chinese may feel that we are unwanted in our own country, I think that we have ourselves to blame for the perpetuation of this myth.

Mocking Our Education

Certain parties have accused the “ultra-kiasu” of making a mockery of our education system. While I do agree that certain parties are making a mockery of our education system, I think that the responsibility for doing that lies squarely with our politicians such as our Education Minister II.

As someone who has spent more than a decade teaching in one capacity or another, I have had the pleasure to deal directly with the education system and its products. Let me just put it bluntly – it’s broken.

Now, I’m not interested to point fingers and accuse any party of actually breaking the system, simply because I know that the responsibility has to be shared between many parties. The education system is not a simple system that can be easily broken by any one person. It requires concerted effort (or lack of) from multiple parties in order to break it.

But broken, it is.

The mockery is when our politicians continue to live in denial of the broken system. For as long as such denials exist, any efforts that attempt to fix the problem will be half-hearted. As a nation, we need to recognise that the education system IS broken before we can begin the process of identifying fixes and implementing them.

I also know that the Ministry of Education recognises the problems, even if they will not label it as broken. They are also hard at work in finding solutions to the various problems. However, I do not think that they will succeed in implementing any real solutions because such solutions are going to be painful and will lack political will in execution.

Before any healing can be done, we need to embrace the fact that we’re hurt, which seems to be something that our politicians are unwilling to concede.

In the mean time, I would like to ask that our politicians stay away from education. They have messed it up over the years. More political interference will not save it. What we need is for politicians to just stay away and let the educators do their job of educating the people. Leave it to the professionals.

So, let’s stop making a mockery of our education system by making stupid claims about its superiority and recognise that it needs fixing. Let’s stop living in denial and move on.

Addressing the Data Scientist Glut

BIG data seems to be the buzzword of the year. Governments and corporations all over are rushing either to address this issue, or to capitalise on it.

Even ordinary folk know that big data is going to have a big impact on how we make decisions and choose to run our lives in the future.

My attention was recently brought to the Malaysian Government’s rollout of its big data framework. Among the things highlighted is the issue of talent. According to the article, our Government has taken certain steps to ensure that we will have the necessary talent to deal with big data.

First is the policy to “provide scholarships for government officers to take up postgraduate courses in data sciences at reputable universities so that they can be equipped as data scientists in the country.”

This old strategy has been used to develop talent for fields that are critical for our nation.

However, there are a couple of problems with it. On one hand, some of these people do not return as their skills are equally valuable elsewhere. But we should not stand in the way of personal progress, as long as they refund the tax dollars spent on their education.

But the other problem is that, those who do return to serve are not put in a place to do what they were trained to do. Government scholars have returned with PhDs from top universities, but they were not assigned to work in the areas where they could contribute most effectively.

While sending our people to the best institutions to study data science is a step in the right direction, ensuring that their skills are put to proper use after that is the challenge, particularly for a government that often pays mere lip service to the issue that has resulted in more than a million moving on to greener pastures.

We will need to institutionalise systems that encourage development so that these returning scholars continue to flourish in Malaysia. Otherwise, they will leave just as quickly as they have returned, due to frustration.

Unfortunately, our track record shows that we do not always give scholars the freedom to go where their scholarship takes them.

Big data is going to reveal a lot of things that we may or may not want revealed. That is the true power of big data – to draw inferences and relationships from data that was unrelated.

We have all read of what happened to one professor who merely worked with surveys and polls, not big-data.

Second, the Government is “ensuring universities in Malaysia start offering data science degrees, and not just as electives within their computer science courses.”

My concern is that while we may have good lecturers, they may not be in a position to teach these courses.

Looking at existing data science curriculum, it is a multi-disciplinary programme that spans mathematics, computer science and even engineering. These are separate faculties in a university. Internal structure and politics may be a problem.

But let’s put aside the internal politics.

Accreditation often requires that lecturers who teach in a faculty to have a degree in that field. For example, one needs to have an engineering degree to teach in an engineering faculty, and so on.

This has already resulted in some rather creative hiring practices at universities.

Some lecturers are caught in a limbo. While they teach in one faculty, they are being parked under another faculty. As a result, their work in one faculty risks not being recognised when it comes to promotions and reviews under the other faculty.

We might need to establish a new faculty for data sciences, or to amalgamate these different faculties together.

But the simpler solution would be to change accreditation requirements so that faculty members do not need to be members of any specific field.

Since jobs are becoming increasingly multi- and cross-disciplinary, taking in faculty members from various fields may encourage the cross-pollination of ideas and hybridisation of skills that may just produce inventive results.

Thirdly, the Government wants everyone to “adopt big-data as a first-mover advantage in their own respective industries.”

The Government should really lead by example. While one can make the argument that corporations produce and consume a lot of data, governments produce the most data and can benefit most from said data.

Therefore, our Government needs to make data readily available, and that’s where the biggest challenge lies. Currently, much government data is often classified as secret by default, or released post-analysis.

Ideally, the raw data should be made available, which would allow the private sector to innovate the data into useful products and services.

I hope that our new chief data scientist, whoever he or she turns out to be, will make it a priority to mobilise our Government, at all levels, to produce and release all available data in a machine-friendly format, and not as mere printed matter nor pretty PDF downloads.

Otherwise, my concern is that when all these government scholars return to serve, and the local graduates from these shiny new programmes hit the market, there may not actually be any available big data to crunch.

See more at: http://www.digitalnewsasia.com/insights/addressing-the-data-scientist-glut#sthash.169wHgym.dpuf