A path for quickly becoming productive with Node.js

If you’re an experienced web developer, and you want to learn Node.js and be somewhat productive with your time, here’s an easy path to begin with.

I’ll assume you know raw JavaScript and a little raw Node. Enough JavaScript to be familiar with the DOM, anonymous functions, and callbacks. You dont have to know React or anything of the sort.

First up, Learn enough to recognise the new syntaxes in ES2016, along with promises, arrow functions, generators and async await. You don’t have to be good at them; just be able to know how to read them.

Now learn enough Node and NPM to start a vanilla Express server and realise how much work it would be to write a whole fully featured web application in it.

Now quit jQuery, cold turkey.

If you come from using a Rails-like framework such as Rails, Django or Laravel, the though of scouring NPM for all the packages you’ll need, you’ll be wanting someone to make opinionated decisions about the right packages for the job for you. May I suggest Adonis.js. It comes with all the MVC, Authentication and ActiveRecord stuff you’re used to, along with loads of other good stuff too. You’ll have a good reason to learn about Generators, Promises and async await here.

Resist the urge to jQuery.

If you want to write your front end as a single page application (SPA), to run in front of your API, you could use what you’re familiar with, or you can start afresh with Vue.js because it has the gentlest learning curve of any of the mainline frameworks, all the best stuff from the other frameworks, and you don’t even have to learn a bundled/compiler if you don’t need it.

Vue is easy to learn, easy to adopt, and you’re never forced into complicating things too early. Go at your own pace, and eventually you’ll learn about components, which will change everything. Get started with Vue’s single file components and never look back.

With Vue, you don’t need a router out of the box, until you know you do. You also don’t need state storage until you know you do.

You want to write a universal app, or use Material design you can do that when you want. Heck, you can even bring in JSX if you’re feeling that. And you dont have to add any of these packages to your project, until you need it, and in any order.

tl;dr: Learn enough JS and Node to spot new JS language constructs, starting with Adonis will give you a reason to learn the new stuff while giving you an easier path to success.

Disagree? Got a easier, faster path to productivity and learning all this crazy JS? Chime in below, or hit me up: @Glutnix on Twitter.

New inner.geek.nz design!

Yup, I got a new design! I did this all in 1 day.

Sure, I did spend some time ‘upskilling’ at work doing the design and html template, but I got the whole WordPress skin done in about 4 hours.

I based it off of the Classic theme (y’know, the ugly default theme) and tweaked the living daylights out of it, adding extra template files.

I’m quite happy with how it came out. What say you?

Programming for Health: A Reflection

I’m on ‘staycation’ –annual leave from my normal day job at Natcoll. Staycation because I’m not actually vacating where I am: I’m still at home in Wellington.

I’ve been volunteering at Catalyst IT working with Brenda Wallace to work on projects of her choice. She assigned me to work on Laconica (an open-source version of Twitter that works in a distributed fashion). In order to do so I’ve had to learn a little about many different technologies, like PostgreSQL, the weirdness of Apache+PHP on MacOS X 10.5, and overall, how to checkout and contribute code to an open source software project with Git.

I’ve now had three code merges into Laconica, albeit very minor ones, mostly fixing bugs.

I don’t even use Laconica. (Twitter is working just fine for me, thanks.)

But I feel great.

Computer programming is something some have described as the most complex thing humans have invented — it’s all abstract, there are few corollaries to it in nature. Probably the only thing more complicated is quantum mechanics (but that is, in fact, nature).

My job is to explain, demonstrate, and encourage people who have never programmed a computer in their life (let alone their VCR) to create rather complicated things we call websites.

Why have I enjoyed contributing patches so much to an project I don’t use or much care about? A couple of reasons:

The Zone

The elusive Zone has many names; Wikipedia refers to it as “flow“. It’s that state of being you get when they’re so intensely focussed in the task at hand that time and reality become irrelevant because you’re so energised and focussed and involved at what you’re working on, and having good success at doing it. You come away feeling elated and energised that you’ve completed something of value.

I haven’t been in The Zone for nearly four years. I’ve been teaching people how to program for nearly four years now, and nary the mind to knuckle down and flex my coding muscles. I’m too worked up with office politics, helping my workmates with the technology, and thinking that I wasn’t good enough to be in the industry.

Learning

It’s good to know that I can do it, though to do it professionally, I’d just need to learn more about the processes involved.

I’ve had to learn how to use Git, how to create PostgreSQL users and databases, and submit my finished code to the project administrators for merging with the mainline version of the program’s code.

I don’t normally get to be a learner. I’m a full-time teacher, and what I have to learn is usually because I need to teach it.

It’s nice to learn things for me and me alone. I may never get to teach what I’m learning here, but what I’ve learned is helping fulfill me (more on that later)

That old adage “Those who can, do. Those who can’t, teach”. It’s lies.

Actually I’m a tutor, but that’s just a particular kind of teacher. Not meaning to blow my own horn, but according to my student evaluations I am actually a really good tutor. Sure, I have my weaknesses, but overall, apparently I rock at it.

And I really enjoy teaching. It’s rewarding when the metaphorical light-bulbs turn on above the student’s heads. Some of them slowly brighten, some just pop on, and some of them shine more powerfully than others, but the lights do turn on. To know that a learner now understands one of the most complicated things there is to know,

I was at Wordcamp New Zealand here in Wellington over the weekend, and Nicki Gemmell was talking about using blogs at primary schools around New Zealand. She related how uploading an image to a blog was something a principal got excited about: “I uploaded a photo to our school blog today; how cool is that?!”.

As a programmer who has written photo upload functionality, I forget how far I have come and how valuable the skills I have really are. The challenge of teaching people to do things is fun and rewarding. Teaching students to do this even more complicated stuff is the same but even more challenging.

Teaching programming, from my own experience, is the ability to communicate the concepts and foster the understanding and use of them. I was told by a trainer there were four levels of competency:

1. Unconscious Incompetence – you are unaware that you don’t know how to do X.
… awareness brings:
2. Conscious Incompetence – you are aware that you don’t know how to X.
… learning brings:
3. Conscious Competence – you can do X, and you are thinking about it when doing it.
… practice brings:
4. Unconscious Competence – you can do X, but you do not have to think about it when doing it.

I say that there’s a fifth level: where you have become once again conscious of what it is you are competent at. And that’s the level where you’re ready to teach it.

To be able to teach, you must be able to learn, and then go further so you can show others the way.

Those who can teach, do teach.

People

Okay, I’ll be honest: being around Brenda and the other like-minded geeks at Catalyst IT has been a really energising experience. Being able to vent frustration at code and technology, bounce ideas off each other and have fun while doing it has been great.

But working on Laconica and spending some time reading other peoples code and improving it, and learning the technical, and social aspects of doing so has been fun and very enlightening.

My motivation for staying a teacher has been pretty simple: Hell is other people’s work. Most of the employment in the industry has been creating websites for companies; wish fulfilment for others. I could change the world one organisational website at a time, or I could change the world 20 web students at a time.

But working on an open source project has let me use my programming skills to directly improve, ever-so-slightly at this stage, the lives of people around the globe. By making the software they use better.

Having that sense of purpose in what I are doing is really important to me. I don’t want to just be working to collect a pay check: working to live. And I don’t want to be living to work either. I just want to do what is worthwhile while I’m alive: live life to the fullest. Use the abilities I have to do things worth doing.

I am a teacher. I am a programmer. I’ve been neglecting the programmer side of me.

“Computer programming is tremendous fun. Like music, it is a skill that derives from an unknown blend of innate talent and constant practice. Like drawing, it can be shaped to a variety of ends – commercial, artistic, and pure entertainment. Programmers have a well-deserved reputation for working long hours but are rarely credited with being driven by creative fevers. Programmers talk about software development on weekends, vacations, and over meals not because they lack imagination, but because their imagination reveals worlds that others cannot see. Larry O’Brien and Bruce Eckel

Jakob Nielson rides again

Just had this one come through the wire:

Jakob Nielsen’s Alertbox, June 23, 2009: Stop Password Masking

Usability suffers when users type in passwords and the only feedback they get is a row of bullets. Typically, masking passwords doesn’t even increase security, but it does cost you business due to login failures.

This sounds like Nielson kicking up publicity. This is shorter than his normal articles and he hasn’t backed this one up by mentioning his latest rounds of usability tests. He’s often got really good points, but this is one that I have issue with.

Nielson has forgotten that the reason password masking exists is if you type it out but don’t submit the form right away, then it won’t be on the screen for a long length of time for passers-by to ‘shoulder-surf’. The form could be really really long and/or you might be a really slow typist.

Padlocks and deadbolts keep honest people honest. The same goes for password masking.

Not to mention that password masking is visual shorthand reminder for the personal habits of “you should remember what you right in this box, cos even you won’t see it” and “no-one else should see this but you”. If we removed this ‘tell’, what would become of the culture of ‘protect your password’?

Think of where, other than web sites, that password masks get used. ATMs, EFTPOS machines, computer software, the Operating System uses it. Western culture is conditioned to this design pattern, and I speculate that the only people who have trouble remembering passwords are the ones who were born before 1980.

I guess a compromise would be to have the field in plain text when it has focus, switching to a password mask on blur…? Not a difficult solution.