It’s not just JavaScript you’re learning at that Bootcamp

Programming bootcamps are everywhere now. Some are up to the mark while others make up for it with good marketing. Whichever the choice you end up making, it’d be a mistake to think that you’re going into one, say a web development bootcamp, to learn HTML, CSS and JavaScript.

No, you’re not. You are going to learn programming. JavaScript is but one of many languages you’ll need to use as a software engineer.

While it’s probably scary enough to try to pick up a single programming language, and it’s not my intention to scare anyone away from trying to gain this tremendously empowering skill, it’s the truth. Being able to write JavaScript code is not going to make you good enough to be an employable developer. We need to be more versatile than that.

Here’s the good news: if you know JavaScript well enough, you probably already know how to use Python and Ruby and PHP. You just don’t know the specific syntax yet. Forced to use them, you will find a way to write in that language.

That said, I think it’s useful to go into a bootcamp with the mentality that you’re going in to learn how to write software, not to learn how to write web applications or mobile or desktop applications only. Neither are you going to be so clearly labelled as a front-end or back-end developer. No good sculpture comes out of a craftsman who knows only to work the paper or the chisel.

Let’s face it. You’re looking at joining a bootcamp because you’re interested in technology and want to be able to use it to create things. When you’re done with the bootcamp, you’re going to come out as “the software guy/girl” – so it’s best to play the part before you’re made to.

Why you should blog as a programmer

Sal's 4 tips for writing blog posts as a developer
Sal’s 4 tips for writing blog posts as a developer

It’s Christmas Eve and I find myself itching to read and learn more about programming, so naturally, I went to Medium.com. Three posts in from scrolling I came across a post from John Saddington, an “indie” developer who has built and released multiple WordPress and writing-related apps all by himself. He’s someone I respect, both as a person with humility and as a skilled developer, so I clicked.

His post was short. Like 2 paragraphs short, and an embedded video. This video:

It’s a talk given by another developer Sal Farrarello, who declared “blogging” as the best habit he has as a developer. With that kind of a pitch, I watched the video (even though we were supposed to leave for a Christmas eve party five minutes ago).

I really have to go now, but I need to mention one thing from his talk that really stuck with me: recall.

Sal sees his blog as a repository of his knowledge. One of the examples he gave was about the time he faced a problem developing something on WordPress. Solving problems is what we’re always doing as developers, from the macro “this app will solve this problem in your life” to the micro “why is this helper function not working?”, we’re always working on solutions. So Sal worked on his problem and wrote a blog post after that, and he says that he’s returned to it a few times since because he’d forgotten how to solve the exact (but esoteric) problem.

Other than my brain with limited storage, I keep a log of what I learn as well, mostly in the format of notes and quickly formed paragraphs. But the big difference is that I’ve always been doing that privately, in my Evernote account. A quick examination was enough to make me realise that that is wasted resources; very little of what I keep as notes actually need to be private, so why not share them? Besides, a webpage is much more accessible than an Evernote note.

So starting today, every time I face a programming problem, be it implementing CSRF tokens the “right” way or how to happily work with a team of developers, I will publish a post instead of publishing a note in Evernote. Not much more effort for potentially more gain. After all, it’s true what Sal said about progress: there’s always going to be some people who are at the level you were at yesterday.

Street side chats-10264066

Merry Christmas! 

It’s really just Christmas eve as I’m writing this. I’m at a coffee shop, the traditional Singaporean kind from the 1970s, and I’ve just had the most wonderfully spontaneous encounter with a 66 year old Malay gentleman. 

We each sipped our rendition of  teh as we traded thoughts about the past and present, how difficult it is to be Prime Minister, and how expensive the tea was. He had teh o kosong (because he has diabetes and only one kidney, and is generally more health conscious nowadays) and I had a teh tarik. I wonder if he drank teh tarik when he was 26…
The year end as it may be, I’m feeling stressed by the responsibilities I’m starting to get from work. Meeting this uncle didn’t help reduce that, but it lightened my mood a bit. We all get to the end of the line some day, and whichever obstacles, opportunities, setbacks and miracles we encounter along the way, they enter and leave our lives eventually. So stressful as work has been over the past two weeks, I’m open hearted and looking around and looking forward. It’s all part of the ride. 

Just when I thought our conversation had ended, a little boy, probably 10 years old at most, showed up and started talking to us. And he was most eloquent! 

Little boy articulated his thoughts about the state of the coffee shop we were in, a small Indian shop called Teh Tarik Time, compared to the much more successful (it had a long line) one next door called Killiney, full of energy as he waved and explained. He even dished out business proposals about how these two shops could collaborate and improve their both their businesses. It was a precious moment, unscripted as my conversation with uncle, and only interrupted when his dad came along and walked him away from us. “I have to go, bye!” were his final words to both of us, awestruck. 

I’m not sure the dad knew what happened there. A 26 year old and 66 year old chatting, happily joined by a 10 year old boy, all having a jolly good talk. Little boy’s dad must have been about 40. I wonder how interesting the conversation would have become if he had joined. 10264066. 

I remember reading someone’s remarks about the importance of pedestrian streets to the functioning of society. The claim was that without these spaces for serendipitous encounters, cities would have no life. I think I agree more than I did before. 

Lesson learned? Always embrace an opportunity to talk with someone when you have the time. Put the phone (and headphones) aside if you can afford to, and get a glimpse into someone else’s life. It’s always fun and almost always heartwarming to know how similar you are to others inside. 

Go wherever you lack a mental model of

Humans have mental models of everything. How is that birthday party going to be like? How does it feel to be entering a new stage in life? What are some challenges I’ll likely face when I’m in it?

Mental models are useful. They are stored deep in our memory and get called whenever we need an inkling of something to come. Neil’s birthday next week is probably going to involve a cake, some songs and a lot of talking with friends, just like Joanna’s and Nick’s and Billy’s.

Once an event has passed, be it trivial as drinking a cup of coffee at a particular kind of cafe or something more eventful like celebrating a spouse’s promotion, our brain makes a note of how it went and commits it to the library. The next time we need a reference to get an inkling of what something similar in the future is likely going to be like, we pull these out like vials of memory, and speed off into the future our minds, in its intoxicated state, produces.

While we can go at lengths to argue how incomplete our imagination of the future can be as Daniel Gilbert does with skill in Stumbling on Happiness, I think we can agree on one thing: spotty as it may be, this unique ability of ours has helped us navigate the challenges in our life.

Getting on stage and giving a speech in front of 40 people was daunting for the first time, but much easier when we do it again because we can rely on our mental model from earlier to sort of know what to expect. The same thing applies to saying something on camera, having 4 cups of coffee in a day, and interviewing for a new job.

Whenever we are for some weird reason able to conjure a mental image of what something looks like and might feel like, it’s likely that the librarian-chemist living in our brain has unleashed a vial or two from the past.

In a world with infinite possible experiences, I think it’s a worthy goal to pursue the ones whose essence we haven’t captured in little test tubes for our minds. Favour new jobs, drinks, skills, topics of interest, places to travel. Favour the new, seek them out and do them. Build a spectacular mental apothecary of experiences!

The late physicist, lock picker, bongo player and prankster Richard Feynman perhaps embodied this philosophy the best. You can work on the cutting edge of computing and physics to co-invent an atomic bomb while picking safes and cracking jokes. Now that’s a hard earned mental model!

Go wherever you don’t have a mental model of. That’s when you’re guaranteed to be the most frightened, delighted and alive. Because there aren’t crutches to fall back on, it’s also most likely going to be your best work/drink/discovery/trip/etc yet. Go there.

The flash of unstyled text

When I entered the web development industry-complex (is it okay to refer to it as such?) in August this year, the first thing I noticed was how fast it moved. This year EJS and HAML is hot, next year it’s testing frameworks Mocha and Chai, and then Angular2 and React. In our industry, there has been a hot new thing every year.

Recently in a bid to give a well thought out response to a student in class, the instructional team did some googling to see if some esoteric library existed to allow developers to recreate poster-esque typography on webpages. And of course we found one, called Lettering.js. It uses jQuery to transform every single letter in a sentence into a <span> tag, and style it accordingly. Kerning (horizontal spacing in between letters) is easy with margins and relative positioning, and alternating colours is also possible with the :nth-child selector. I thought it is really smart but a bit of an overkill.

But what caught my attention most was a paragraph that espoused the values of the creators of Lettering.js:

“Web performance patterns advise that you put Javascripts at the bottom of your page before your </body> tag. There is an unfortunate side effect where you may experience a FOUT (Flash of Unstyled Text) when you’re manipulating your text after the DOM has loaded. Unfortunately, we found the best solution to avoid/minimize the FOUT caused by this plugin is to put your scripts (jQuery, Lettering.js) in the document . On the one hand, your page will load slower. On the other hand, a flash/restyling makes your site feel slow. Users might ultimately feel the site is faster if they don’t see the FOUT.”

FOUT. What an acronym. To FOUT or not to FOUT is one of many design decisions that developers have to make every day. While the implementation is very simple in this case–moving the <script> tag between the top (at the HTML head) position or the bottom (as the last few lines within the HTML body)–what/how we decide ultimately depends on the project.

The most interesting part about having read this is that I never scrutinised the difference between placing the <script> tags on top or below. I just placed it in the head all the team and used a DOMContentLoaded/jQuery.ready inside my scripts to make sure that the HTML page is fully rendered before JavaScript tries to manipulate them on the DOM.

How fascinating…

How to add event listeners without repeating yourself

One of the key principles of good programming is DRY – Don’t Repeat Yourself!

Here’s one way to reduce repetition with event listeners by using an array .forEach iterator that I’ve used a number of times now. If you haven’t done this before, here you go! If you have an even cleaner and easy to understand solution, please share.

The code below uses jQuery selectors and methods to add ‘mousedown’ event listeners to 4 elements #up, #down, #left and #right.

Code used in an in-class lab to move a ball around the page.

Warm spots

Every time when Mei and I come home from a trip to the bank or a nice movie date, we’d come home searching for that warm spot on our marble floors.

Brownie is the most loyal friend we have, perhaps even more loyal than we are to each other. He’s just… out of this world. Out of our chaotic world.

The first time I discovered the warm spot was by accident. Mei walks around the house in one of those cushy home slippers but I’m more of a barefoot. One day we came home and as the door slammed shut I stepped on a spot on the floor that felt warm, a stark contrast to the chilly marble that I’m used to walking on at home. There couldn’t have been another explanation – Brownie must have laid there, waiting for us to come home.

My foot was hardly the only thing that felt warm that day. Knowing that you are the center of another being’s universe is utterly heartwarming. It makes me want to be a better person for others.

I often think to myself whether I have been the warm spot in anyone else’s life. Being human, I think it’s impossible to be as unwavering in loyalty as a dog to another human, but I’d like to think that it’s possible some times, and that that would be enough.

In any relationship, try and be the source of that warm spot for the person on the other end. When he/she discovers your warmth is when you’ve established a relationship for life.

/strokes Brownie…

A thing every day

Show up.

That’s the most important thing. Or so says a bunch of successful people^.

Why is it important to show up every day to create something using the skills and knowledge you have? Why can’t we just be write and publish when we are inspired, create and launch a game when we get an epiphany, or shoot and edit and publish a vlog only when it’s a day packed full of interesting activities?

I’m not sure, so I’ll venture a guess. It has to do with the law of big numbers.

I may be butchering the law, but what I think it means is,

“With a large enough number of experiments, the results will converge on the real value.”

The example I found from Googling is the coin flip. If someone pointed a gun to your head and forced you to flip a coin 1,000 times and to record every outcome, the number of heads and tails should be roughly 50:50. If instead the number of flips is 10 or even 100, that ratio might appear skewed towards heads or tails, even though logic tells us that each flip is independent from the previous flip.

Likewise, if someone held a gun to your head to make you work on your craft–be it designing video games, writing an article or computer programme or shooting a video–every day, and you recorded the number of games/articles/videos/drawings/etc that are well received, the real value of your work will begin to reveal itself.

Publish 10 articles and people might catch on to none, and you might feel like you’re not helping anyone with your writing and falsely conclude that you’re a terrible writer and should stop wasting your time.

Publish 100 articles and 5 might have at least some form of recognition among a small group of people. Do 365 and you might just find 30 of them to be generally well received.

The point is, you won’t know what the real value of your work is until you’ve showed up to create and share something with people every day for a while.

And while you’re busy showing up, your skills are busy levelling up.

If you don’t know me and don’t trust me, or if you do and still don’t, take it from Ira Glass. He’s some famous radio guy who sounds convincing talking about creative work.

“Do a lot work. Do a huge amount of work. Put yourself on a deadline. Every week or every month. It’s only by going through a volume of work that you’re actually going to catch up and close that gap, and the work you’re making is going to be as good as your ambitions. It takes a while. You just have to fight your way through that, ok?” (Ira Glass)

Here’s a nice video made by someone who showed up with Ira Glass narrating those elegant words.

^ Casey Neistat, Ira Glass, Gary Vaynerchuk, DHH, Maria Popova, Jiro… the list keeps growing.