Wearing dice on my head since 2008 Programmer, engineer, scientist, critic, gamer, dreamer, and kid-at-heart. Randomly amazed.

roytang.net

last update:

So after so many months of development you deployed your webapp to production and it’s up and running and everything is fine and you celebrate and your work is done right? Not really. Two days later you get an urgent support call in the middle of the night. (Your clients are halfway across the world.) They’re asking why the website is inaccessible. You check via your browser and sure enough there’s an error 500.

Signs you think about leaving your current job: The company culture has changed in ways you don’t like or recognize You are no longer proud of the work you do You are always feeling tired, even when you just got to work You more easily notice your coworkers’ screwups and are more easily annoyed at them You feel unappreciated for the work you do You feel like the company doesn’t listen to your inputs Many of your close friends in the company are unhappy and want to leave or are already leaving or have already left You no longer trust your boss to make good decisions about the company’s future You are always looking for more free time to pursue other pursuits It’s Monday and you’re already looking forward to Friday You hate your commute You start reading articles about signs you should think about leaving your job A lot of people feel trapped in their current job.

Hopefully by now most developers and project managers are well aware of the mythical man-month and Brooks’ Law: Adding manpower to a late software project makes it later The idea is that communications overhead scales up quickly as you add more people to a project. Oftentimes it is counter-intuitively not worthwhile to keep adding more people to try to catch up. Some implications of larger team/project size may not be immediately obvious.

Notes on Decision Making

| Categories: Opinions | Tags:

  At my old job I used to have this group of coworkers I had Friday lunch outs with. Inevitably, every Friday around noon someone would message the others asking “where are we eating?”. Now, there are a lot of good places to eat around the area and we’ve all been working there a while so most of the time we don’t care where we eat and we’d say we’ll decide when we get to the elevators.

Just a list I’ve been maintaining for a while: (Disclaimer: This list in no way implies that developers who don’t exhibit all of these attributes are terrible human beings who don’t deserve to live. But working with developers who exhibit many of these traits will probably result in a better experience over the course of your developer career.) Laziness, Impatience and Hubris – from the well-known (notorious?) Larry Wall quote Communicates well; is able to explain and communicate his ideas clearly, especially to nontechnical people; able to write good documentation Understands the concerns with scheduling and project management and communicates clearly with the team to avoid problems.

“If you know the enemy and know yourself, you need not fear the result of a hundred battles. If you know yourself but not the enemy, for every victory gained you will also suffer a defeat. If you know neither the enemy nor yourself, you will succumb in every battle.” ― Sun Tzu, The Art of War I was reading a forum thread recently about learning competitive Street Fighter.

So the other day I was reworking a Python script that I had been using for years on my home PC to manage and categorize some downloaded files for me. This time I wanted to add some smarter behavior to make it more able to figure out when to group files into folders without constantly needing manual intervention from me. To do this, I needed to persist some data between runs – so that the script remembers how it categorized previous files and is able to group similar files together.

Thoughts on Authoritarianism vs Democracy

| Categories: Opinions | Tags:

“Democracy is the worst form of government, except for all the others.” ― Winston S. Churchill In the current world political climate, it seems that in many instances democracy and the related values (equality, human rights, and so on) are increasingly taking a back seat to populism and increasingly authoritarian leaderships. One sometimes has to consider whether authoritarian states would in fact be more effective in this day and age.

Because of the nature of the web and the fact that you should never trust user input, all the validation in a web application should be done on the server side. You can additionally provide validation on the client side (via JavaScript), but this is only a concession towards a better user experience and should not be used as a substitute for server-side validation. One would think that anyone with a basic understanding of how HTTP works would understand the above easily and any failure to practice it should be considered amateur hour.

My 2016 in numbers

| Categories: Just Another Day | Tags:

Random statistics from 2016: 74 blog posts (total of 769 currently on this site, some imported from as early as 2002. The record for a single year was 148 back in 2008, but that was back when I didn’t do social media much so even short posts made it to the blog, delicious bookmarks were auto-posted here, etc.) 50,135 words written for Nanowrimo 321 sketches submitted to r/sketchdaily Duolingo streak: 225 days Answers written on Quora: 427 Programming languages/frameworks learned: 4 Instagram posts: 390 Facebook activity: 218 statuses, 178 links, 164 photos, 31 videos.

New Year's Checklist

| Categories: Opinions Self-Improvement | Tags:

In no particular order: Greet your loved ones and friends and anyone else you hold dear. Maybe even those you disagree with Ponder why people give so much significance to the transition between an arbitrarily-chosen pair of 24 hour periods Take stock and reflect on the past year Think about what you’d like to learn this year or how you want to improve Count your blessings for the past year and be grateful Change your passwords Buy a new toothbrush Make a New Year’s joke (“My New Year’s Resolution is 1440×900!

Review: Xenoblade Chronicles X

| Categories: Gaming | Tags: Review

Just in time for the end of the year, I finally finished Xenoblade Chronicles X, which I started playing around the first week of August (5 months!), with 120+ hours of game time. The game doesn’t have the best graphics (WiiU, etc), but I really like how it looks and how the world is built and all the different environments and the weird and sometimes absurdly large beasts. There’s a whole lot of stuff to do in-game.

Cleaning up your Code

| Categories: Software Development | Tags:

In one of my most recent projects, a large system that had gone through a relatively long and unstable period of many, many changes due to sales demonstrations, different clients and whatnot, one of the “fun buffer tasks” I always kept around for devs was code cleanup. Because of the unstable nature of the project, there was always a lot of duplication, unused/unnecessary/obsolete classes/functions/files and so on. Unnecessarily large CSS files where most of the selectors were no longer really needed or JS libraries that weren’t actually used.

Decluttering

| Categories: Just Another Day Opinions | Tags:

I traditionally try to save some time on the week between Christmas and New Year’s Day to do some cleaning up and decluttering of my stuff. One would assume that having more time meant I would be better able to organize my stuff and all that, but one would be wrong. My room still has stacks of books, toys, Magic cards and other stuff in random places. Or maybe I just have too much OCD that I want everything to be neat and organized, but I’m not industrious enough to make it happen.

Related: Learning new skills While many people working as programmers/software developers are happy enough specializing in a single programming language or platform, I generally consider it a better idea to have a wider toolset and the ability to easily pick up new programming languages as needed. The benefits should be obvious: when you have a wide variety of tools under your belt and are able to quickly learn to use a new tool, the number of work options you have increases greatly.

Learning New Skills

| Categories: Self-Improvement | Tags:

When Hanamichi Sakuragi from the manga Slam Dunk tries to get into the basketball club, he insists he’s a genius who doesn’t need to practice the basics and instead wants to go immediately to doing spectacular things like Slam Dunks. Sadly, the vast majority of us cannot claim to be geniuses at anything, and we are forced to undergo a bit of hard work if we want to learn a new skill.

In any reasonably large software project, the system will be so large that no one developer will have a good grasp of the details of every function in the codebase. The tendency is for developers to specialize – that is, developers tend to focus only on certain parts of the codebase and become more familiar with that part, while not having much knowledge about the other parts. This tendency is self-reinforcing – once it becomes known that the developer is an “expert” in the given module, there is a tendency that he will be assigned the most difficult and urgent tasks or fixes related to that module, further cementing his expertise.

Nine Ways to Work Around Mental Blocks

| Categories: Writing | Tags:

Often I have these days where I’m supposed to be writing something or drawing something or coding something and I just can’t get to it. Some kind of mental block makes it difficult. And you try to focus your mind and clear your thoughts, but it just doesn’t help. Here are some ideas for how to get past mental blocks. Toss out ideas that weren’t working and start over.

I was in a meeting once with my boss (literally the CEO, a Malaysian) and some representatives of another company (Americans) where we were discussing the technical details of a possible future partnership. At one point, one of the Americans said to my boss that he was pleasantly surprised that I was openly speaking up independently of my boss and willing to correct him on some points when he didn’t quite get the technical details right.

Nanowrimo 2016 Post-Mortem

| Categories: Writing | Tags:

As I recall, today was at least my fifth Nanowrimo attempt; the first one was sometime before 2003 (I would guess it was in 2000 or 2001 before I graduated from college), the second one was in 2003, then 2006, then 2011, then finally the fifth one this year. My best prior attempt was back in 2011, when I made it up to 22,000+ words. At just around 1am on the early morning of November 30th this year, I beat that record and have won Nanowrimo for the first time.

In JavaScript, referencing variables that are declared outside of a function’s scope can be tricky. If you have code like this: var btn = document.getElementById("BTN"); var test = 1; btn.onclick = function() { alert(test); } test = 2; The click handler above retains a reference to the test variable even though it falls out of scope as soon as the script block finishes execution. When you actually click the button, the alert will show the last value of the variable when the block finished execution (2) instead of the value at the time the function was initialized (1).

If a friend found out your work was horrible, would you want to know? Or would your feelings be hurt? If your coworkers think you’re doing something wrong, would you prefer that they keep quiet or that they call you out? As a leader, do you prefer to have sycophants who sing your praises or people who are willing to tell you that you have no clothes? Is your ego more important than doing a good job or self-improvement?

This is a story of something I consider to be one of my worst mistakes in software product development. Some years ago I was asked whether it was feasible to write software that would be integrated with Software X that allowed us to export that software’s output into a format that was compatible with Standard Y. I took a look and after a while came back with “Well sure. We could use Programming Language M that has an API that lets us integrate into Software X so we can export the output data.

Wizard's First Rule and Demagoguery

| Categories: Opinions | Tags:

The series was a bit formulaic, and towards the end really preachy toward’s the authors personal philosophies, but Terry Goodkind’s Sword of Truth series always comes back to me because it codified one of life’s most important truths: Wizard’s First Rule: ”People are stupid. They will believe a lie because they want to believe it’s true, or because they are afraid it might be true.” That doesn’t mean you’re stupid or I’m stupid, just that collectively, we’re kind of dumb.

Unclear error messages

| Categories: Software Development | Tags:

“Button for non-service floor does not light up.” For more than a decade I regularly went to an office building where the elevators verbally spouted this nonsense message whenever you tried to go to a floor that the current elevator car did not service. For context, the elevators in the building were zoned programmatically – this means that they only service a particular subset of the floors that are provided on the elevator panel itself.

Bad news

| Categories: Opinions | Tags:

Recent events both in my country and abroad, both of wide importance and personal importance, have made the past week or so difficult. Bad news and bad events have no master or timing, they do not consider giving us a break, they come and go as they please no matter how bad the situation already is. I fully understand why many people choose to withdraw from daily news or shut it out altogether or even just avoid social media completely.

  There was this project we had where there was a strange bug. The developer working on it found that the problem only appears when the record ID was 12. When it was 11 or less, everything was fine. When it was 13 or more, everything was also fine. After some investigation, it was found that there was some code that executed with a condition of “if record id == 12”, which was already a WTF.

There’s a very rare, privileged group of people for whom everything in life goes well and they experience great success all the time. You and I are not part of that group (most likely). Like the vast majority of other people, sometimes our lives are good and sometimes our lives are bad. Sometimes life can feel cruel or unfair or exhausting. In those times it’s easy to forget the times when life was good and to wallow in your misery.

The software development process is already difficult mainly because a lot of it so imprecise. Requirements are often only vague wishes that the client has, with no regard to the sheer number of instructions needed to implement those requirements. Throughout the entire process it’s important to use feedback loops to determine whether development is on the right path. And like all feedback loops, their effectiveness often hinges on how quickly we are able to turn around and give and incorporate feedback into future iterations

Feedback Loops

| Categories: Self-Improvement | Tags:

A feedback loop happens in a system when you are able to use an output of that system to influence the inputs, which in turn influences the outputs and repeats the cycle In engineering, feedback loops are useful to generate steady-state outputs. We had an entire subject dedicated to feedback loop controllers back in college. I enjoyed the topic so much I took the subject twice! An example of the use of feedback loops would be a thermostat that has a sensor to detect the current temperature.

It Should Be Easy, Right?

| Categories: Software Development | Tags:

In Tagalog: “Madali lang naman diba?” Probably one of the most annoying things a programmer can hear, especially from a client or a manager who has no appreciation of how complex software development is. It’s presumptuous at best and actively damaging to schedule and morale at worst. We already know estimation is hard, there is no need to make it more complicated by automatically assuming the best-case scenario (or in many cases, an impossible scenario)

Daily Habits

| Categories: Self-Improvement | Tags:

I’ve picked up quite a few daily habits since the start of the year. To name a few: I’ve been doing daily sketches, I’ve been going on a daily walking routine, learning Spanish on Duolingo, I have a quick stretching/exercise routine I do in the mornings, etc. (I’m also supposed to be writing daily, but this has proven more difficult to keep doing consistently… ) I like those daily habits that can be easily tracked with technology.

Favor Composition Over Inheritance

| Categories: Software Development | Tags:

“Composition over inheritance” is an object-oriented programming principle that I’m sad to say many devs I’ve encountered aren’t too familiar with. Composition provides greater flexibility, modularity, and extensibility in large software systems as compared to inheritance, especially for statically typed languages like Java that don’t support multiple inheritance The most common examples of the problems caused by too much inheritance involved generic object such as the game objects example in the wikipedia page linked above.

Introspection and Self-Awareness

| Categories: Opinions | Tags:

Sometimes I write something and at the end I find that it upsets me. Or I think about something I haven’t thought about in a long time just before I sleep, then I have a nightmare about it and it saddens me to think that my subconscious still hasn’t let go of it after all this time That’s a good thing though, right? One of the purpose of writing and introspection is to become more attuned to your inner thoughts and emotions, to better understand and work with your own self.

Coding Frameworks

| Categories: Software Development | Tags:

For the better part of my software development career so far, I’ve had the doubtful pleasure of being one of the devs using and maintaining our in-house web development framework. Framework coding is a bit different from the actual application development. At the core it’s a simple idea: you have a whole bunch of code that helps do programming tasks that you expect will often be necessary in a certain set of projects, so you write that code with the intent of reusing it across multiple projects.

Large Projects and Losing Focus

| Categories: Just Another Day Opinions | Tags:

I’m kind of a serial project starter. I’m sure it’s a very common thing. I’ll often have random ideas for projects I could do, big or small. I’d have a dozen of them percolating in my head at any one time. And somewhere between four to five dozen scattered down in various documents, notepads and what not, waiting to be explored. (I literally have two such small post-it notes with 5 such items in front of me right now)

A Programmer's Hubris

| Categories: Software Development | Tags:

“We will encourage you to develop the three great virtues of a programmer: laziness, impatience, and hubris.” — Larry Wall, Programming Perl (1st edition) Hubris is a fancier word for an excessive sense of pride. Why is this to be considered a great virtue for a programmer? Programming is at least partly an act of creation, which means there is an element of craftsmanship involved. A craftsman imbued with hubris is able to take pride in his work – he is driven to create work that is the best quality he can provide.

Appearances and Diplomacy

| Categories: Opinions Philippines | Tags:

(A bit of Philippine politics in this post, if that sort of thing bothers you) Recently as the whole world watched one of our political leaders display his expected lack of diplomatic finesse on the global stage, I couldn’t help but think about how in my younger days there’s a good chance I might have approved of his frank, straight-talking, shoot-from-the-hip brand of diplomacy. I have a bit of a reputation myself for preferring to speak frankly and directly instead of dancing around the issues, although these days I understand the wisdom of adapting to the situation as needed

Type Interfaces Matter

| Categories: Software Development | Tags:

… especially for strongly-typed languages. In one of the bigger Java projects that I took over, I was often annoyed to find some devs had written method signatures like public void doTheThing(HashMapparams) Which is silly – not because of the naming, that’s obviously not a real-world function name. The silly part is requiring a particular implementation (HashMap) instead of the generic interface (Map). It unnecessarily restricts your API and makes it less flexible.

Lying and Salesmanship

| Categories: Opinions | Tags:

A recent post on Wait But Why had me thinking about lying. Some people will scoff if I say I don’t lie. They’re not wrong. I once spun a tall tale about a childhood rival I had visited in the province who challenged me to a swimming contest to explain why I had lost my glasses to the sea. The lie was so good, I got a follow-up question about it a year later and was so surprised I just blurted out that my rival died in accident before finally admitting to the fib

Investigating the Drug Killings

| Categories: Philippines | Tags:

It’s no secret that many are unhappy with the way the congressional investigations into the so-called “drug war” and related killings here in the Philippines. If I were in charge of these investigations, these are the some of the questions I’d want answered: (Disclaimers: I’m not a lawyer or any kind of expert. Understandably, the resource persons may be reluctant to answer some of these in open session, in which case an executive session could be done.

Overhead scale up rapidly as project team size increases. Every time you add a new person to the team, he comes with a lot of overhead such as the need to learn the project details, responsibilities of other team members, who to consult when there’s trouble, custom project procedures, and so on It’s a reinforcing cycle too. As overhead increases, the team imposes more processes and restrictions to make sure everyone is doing the right thing and there are no screw-ups.

Speak Up

| Categories: Opinions | Tags:

Asians, and maybe Filipinos more specifically, have this cultural bias towards trying to avoid conflict. So often there will be people who don’t like to speak up when they think something is wrong, either just tolerating it or hoping someone else will take it up. A software dev in another company once told me that he felt like he was complaining so much that he was looking like a bad guy

Overtime

| Categories: Software Development | Tags:

Overtime in software development projects seems to be a given. Sure, there are projects and companies that don’t need it, but those feel like the exception rather than the norm Overtime in software development is a natural consequence of schedule pressure and the fact that estimation is hard, which is why it’s understandably common, but that doesn’t mean we shouldn’t try to avoid it More than once I’ve been in a situation where the team stays overnight to try to get a build or release ready for the next day only to run out of time and have to delay the deployment anyway.

Pain

| Categories: Just Another Day | Tags: Nostalgia

Almost six years ago, I had to undergo minor surgery and had to endure the pain of being administered spinal anesthesia. I was reminded of this recently because a loved one with an even lower pain tolerance than I did recently had to undergo a similar procedure I have a pretty low tolerance for pain myself. I tried to spin it a bit positively in the blog post linked above, but there’s no question many times during the procedure I felt miserable and in lots of pain.

Will AI replace all our jobs?

| Categories: Software Development | Tags:

A while back, news came out that an AI was able to perform a diagnosis after the human doctors were stumped. Having just finished binge-watching the entire run of Star Trek Voyager, I immediately thought that was the sort of AI advancement that could lead to such things as Voyager’s Emergency Medical Hologram, an AI which could replace a human doctor. Of course, it is still very unlikely for this to happen anytime soon, medicine is a very complex field and new things are still being discovered all the time.

Random Thoughts on Time

| Categories: Opinions | Tags:

I remember having a discussion with a friend a few years back where I made the following list to emphasize a point: 8-9 hours at work (possibly more) 7-8 hours of sleep 3-4 hours commuting in Metro Manila 2 hours for meals That leaves you between 1-4 hours for all forms of recreation including exercise, sports, TV, derping around on the internet, hanging out with friends, and so on.

Without a doubt, the number one problem in software development projects is schedule pressure, that is, the pressure to meet unreasonable deadlines and targets Almost all other problems can be overcome if there were no schedule pressure: weaker developers could be mentored to become better, more productive, and commit less faults less faults overall will be committed anyway if there were no schedule pressure poor requirements could be threshed out in more detail difficult clients can be argued, worn-down, and eventually reasoned with problematic team members can be counseled, or replaced with new blood and so on But of course, the reality is that we live in a world with deadlines and targets, many of them set by people who have no idea about the complexities of software development.

Some days you are tired

| Categories: Just Another Day | Tags:

Some days you are tired Maybe you are tired of all the work You can’t keep up with, it all piles up Of all the meetings and reports That come relentlessly without end Some days you are tired Maybe you are tired of all the time That you never have enough of Of all the deadlines and targets That you never meet but should’ve Some days you are tired Maybe you are tired of the world

The Secrets to Perfect Estimates

| Categories: Software Development | Tags:

Estimation is hard. Estimation has long been the bane of many software developers and software development projects. But there are two secret ways to be able to produce perfect estimates for software development work all the time! One is dependent on talent, and the other is dependent on technology Psychic precognition, i.e. be able to predict the future Have a time machine, so you can go back in time and tell yourself how long the work would have taken Such precognition is necessary to have perfect estimates because of all the unknowns present at the start of a software project.