Catherine Gracey

Living Life, One Misadventure At A Time.

Testing a New Approach

Last month I had my first in-person interview for a programming job. I had almost a week to prepare for it, so I decided to spend the time looking into a few of the tools and JavaScript libraries that I’ve always meant to look into but have never made the time for. It was an intense few days where I picked up a lot of new skills and mentally kicked myself for not doing it earlier.

My favourite new skill is testing. I worked through a course on Mocha.js and Chai.js. Mocha is a test framework and Chai is an assertion library, and together they tie in very nicely with behavioural driven development. In English, that means that when I plan to write a section of my program, I can tell the tests what it should do and then the tests will tell me if my program succeeds or not. This might sound like doing double the coding work for no additional functionality, and in a way it is, but it means that every time I want to test my code I can just type a single command and the program will check itself. If I write my tests sensibly, it means that I can make changes without worrying about breaking something else that I don’t realise is connected to the part of the program I’m working on. If something does break, my tests will tell me what and where it is broken, so I don’t have to spend hours trying to hunt down the problem. It’s pretty neat.

Adding tests to my sandbox websites was simple. Writing the test and the code to go with it was straight forward when I wrote the tests first. My structure just worked naturally, and I was thrilled to see that test driven development was considerably faster for me than manually testing as I went, even with the additional coding required.

After a few weeks of practicing in the sandbox websites, it was time to try adding tests to languagelearning.ninja. This was a very daunting proposition, because I have spent months coding this particular project. It is the most complex thing I have ever attempted, and in the process of writing it I’ve come up with quite a few little work-arounds that I’m not particularly keen to revisit. I did not structure the site with testing in mind, which is painfully obvious in almost every file that I open.

I decided to begin small, with the library module. My first tests just checked if the test suite could access the library files and if the correct languages were present. I expanded the tests to check if each language had entries in each genre that I plan to include. Within the first day I had already written hundreds of tests and refactored my code considerably. As I wrote each new test, I was conscious that these tests would have to handle future developments to the site. This is where I am learning how to scale.

Nine days of intense coding later, and Mocha reports that I have written well over 1000 tests. To come that far has meant restructuring most of the website, and I have barely started drilling into specific modules. So much has been broken down, modularised, and reassembled in a way that is much more predictable. Theories and methods that I have encountered over the past year and never found a use for seem vital now. Business level decisions that I have struggled with for years suddenly became obvious in the test environment. I stopped asking “how can I keep track of this?” and started asking “how can the computer track this for me?” Most importantly, I can now see how other people could work on the project without disrupting my own work. I don’t have to keep everything in my head any more, and it’s giving me the space to finally think again.

I didn’t end up getting that programming job, but I’m not disappointed; there are still a few questions the interviewer asked that I didn’t have good answers for, and if they turn out to be as helpful as testing has been, I will be too busy learning to work for anyone else for quite some time.

Advertisements
Leave a comment »

Putting My Money Where My Mouth Is

I have spent a lot of time over the last few years working on my business idea. Progress has been sporadic as I have raced through development work for a few weeks and then slammed hard into technical challenges that I didn’t have the skills to overcome at the time. Starting a business feels like one exhausting episode of manic depression, and it tends to follow this pattern:

Monday morning: I am full of creative ideas, for I am a creative goddess! I will write code, and it will be beautiful. When my child has her afternoon nap I will harness these thoughts and I shall type like the wind.

Monday afternoon: I was going to do something about fixing a bug in my crossword. Oh god, what was the bug I was going to fix? I can’t bear to do another crossword right now to see how it is running; I need more words in my database. Maybe I’ll add a few more now, then I can test if they work while I do the crossword. That will be a bit more fun, and I can kill two birds with one stone. God I’m efficient.

Tuesday morning: Right, my child is at crèche, so I have a few hours to get everything done. Oh ugh, I’m only half way through translating those words from yesterday. Translating words into languages that I don’t know is so time consuming, even if it is a great way to learn. Maybe I should get a translator to do it for me, and then randomly check the accuracy of a few? Maybe I should get a second translator to do the checking?

Tuesday afternoon: My database is broken. How can I get other people to help with this when I can’t even stop myself from breaking it? Why is my database broken? Maybe it hates me. My child is refusing to have her nap. Does she hate me too? Probably. Everyone hates me. I hate me. I suck at coding and I need to get a real job.

Wednesday morning: I forgot to close a string. Ha ha. Funny. I am a debugging goddess! Look at all this great code I have written today.

Wednesday afternoon: The back end of my website is beautiful. I wish people could see some of this hidden functionality. What a pity the front end looks like arse. Maybe I should get a designer to make it a bit prettier?

A screenshot of languagelearning.ninja as of March 2016

This design may look like arse…

Thursday morning: I can’t believe how much time I wasted yesterday looking for a designer. That was prime coding time! What was I thinking? It might look like arse, but compared to my first version it’s pretty sexy. I’m getting better at design; I just need to spend a bit more time practicing. Designers are expensive. Translators are expensive. If I do it myself I can save a lot of money, and then I can spend the money I have on something a bit more important for the project.

Screenshot of languagelearning.ninja from March 2015.

…but this older version looks like fat, hairy ass.

Thursday afternoon: Why did I try to go out and do some photography for the website with a 2 year old? Thank god the camera isn’t broken. I hope the camera bag dries before her father gets home.

Friday morning: Oh, right, child isn’t going to crèche today. Bummer, I forgot about that. I wonder if I can look up designers and translators on my phone while I take her to the park. There just isn’t enough time to get everything finished, but I’m such a control freak that it’s difficult for me to let go.

Friday afternoon: I am exhausted. Damn it, that bug is still in my crossword. Next week. I’ll fix it next week.

Yesterday I decided that it was time to stop messing around and to get some help. I took my credit card out of storage, went over to 99 designs, and launched my first contest. It was terrifying. It was symbolic.

Working through the form (which I closed no less than 4 times before I just got on with it and finished) forced me to face a few truths that I didn’t particularly feel like facing:

  • Time is more important than money, and I need to quit wasting it.
  • I am not good enough to finish this project by myself, and I never will be. This is ok, because it would take me so much time to get good enough at everything that I would always be playing catch-up with new technologies and ideas and the project would never finish.
  • My sense of money is skewed, because in the past 6 months I have easily spent that much money on miscellaneous rubbish that I’ll never use (if not more). I can spend that much money in a single month on chiropractic and massage without thinking twice about it.
  • It’s ok to tell other people what I think of their work when they are working for me.

I eventually submitted the design contest, paid the money, and remarkably I didn’t die immediately. It was a great start to the process. Designs are already coming in, and if you’re interested you can check them out here. And now, if you’ll excuse me, I have a great idea for some code that I need to write before my child gets home from crèche; after all, I am a coding goddess.

Leave a comment »

How Much Is My Resume Worth?

The best part of learning to code is that I don’t need someone else to give me permission. It is not dependent on getting a certain grade at school, applying to attend a university, waiting until a time that is convenient for them to learn, and then paying course fees that cost more than a new car. I do not need to pay professional registration fees, sit final exams, or answer to anyone about my skill level. With the proliferation of online training I just need to do a Google search and whatever I want to learn is a mouse click away.

Training courses can provide structure for learning, and I have definitely progressed faster with online courses than I might have done alone, but now I am focusing on a new type of structure: job advertisements. For me, this is perfect gamification of the learning process.

Each week I do a search for IT jobs in my area. I filter the ads based on my primary language – JavaScript – and see which accompanying skills are listed. HTML5, CSS3 and jQuery are high on the list, and after that the skills tend to diversify significantly. I have begun tracking the frequency of the required skills, and I am starting to dabble with the most frequent languages and libraries.

Comparing my existing skills to what is in the ads lets me ask two important questions:

  1. If I needed to find a job tomorrow, what should I learn today to make that easier?
  2. If I needed to find a job today, what are my skills worth?

The first question is easy to answer because I am tracking skill frequency. I can look at these languages and spend a few hours experimenting with each of them. If I suddenly need to apply for work I can say that I have limited experience rather than no experience. It probably won’t be enough to get me the hypothetical job, but it might be the difference between getting a telephone interview and a standard rejection letter.

The second question is where the gamification comes into this. A salary is nothing more than a socially agreed points system. Whenever I can tick off all of the skills on a job advertisement, I check the salary on offer. I make a note in my tracking data, and mentally assign myself the corresponding points. Each time I find an ad with a higher salary that I match, I update the points I am giving myself.

There will obviously be a gap between how I perceive my skills and how the rest of the world perceives them, but for now this process is leaves me feeling empowered and in control of my market value. I am consciously playing the game, and my reward is learning things that I might otherwise have put off learning. And who knows? I might even be right.

Leave a comment »

Passive Aggressive Fossilisation

Last year, when I began learning JavaScript, I decided to dust off my language learning ideas and turn them into a computer program. This isn’t the first time I have tried to do this, but it is definitely the most successful so far. My various failed attempts over the last three years have taught me a lot, and that understanding is finally coming together.

This project consists of two main parts: a range of modules to learn the language through, and a database that supports the modules with language data. In the past I have been most excited about building the database, carefully reading grammar books, and making sure that the exercise to write a program teaches me more about the German language than the programming language of choice.

Since beginning the project last year, I have noticed a dramatic shift in my priorities. This time I took a database that I had already started, converted it into a form that would be useful for the current project, and have barely touched it since. I am enjoying the programming far more than the language, which seems odd since learning the language is the ultimate goal of the project.

I decided to take a few days off from the project last week, to explore my emotional state with German. I felt no hesitation playing games in German, talking to my partner and child in German, or browsing through German books. I simply resisted when it came to the point where casual interactions might have turned into focused study.

It has bothered me for months that my language skills have fossilised, but this week showed me why: it isn’t that I have reached my natural limit for German, that my study skills are ineffective, or anything else on a long list of possible failings. The problem is that I no longer want to improve.

Emotionally, I have the perfect level of German skill. I understand more of the language than my daughter does. I can make my way through Germany without too many issues as a tourist, and I am skilled enough that I can use German as a lingua franca in other countries. I already get as much social credit for trying to learn as I am going to. But, most importantly, I have stopped at a level where I am incapable of communicating about anything beyond pleasantries with certain people I know in Germany.

My last trip to Germany was difficult for me. I understood enough German that I knew when people were being rude or unkind, but not enough to respond. There were dozens of times when I found myself at the centre of a highly critical discussion about various failings that I was perceived to have, but I did not have the ability to answer those criticisms. If I learn more of the language then I will need to do something about these little attacks, because I won’t be able to hide behind the defence of hoping that I simply misunderstood what was said.

Defending myself verbally is going to require a very different vocabulary to the one that I have been trying to learn. Calling someone out on their behaviour requires very particular phrases if you don’t want to cause even more offence. Broken German won’t be sufficient; it has to be fluent or nothing at all. Learning to talk like that isn’t a philosophical problem for me, but focusing on it feels like waiting for the next run in that I don’t want to have.

If I am going to keep working on my program then I need to deal with my current reluctance to learn more. There is still a lot for me to improve with German, and I can always pick up additional languages. I have a wealth of available options, I just need to get past the fear and get back to enjoying the process.

Leave a comment »

Coding Adventures: The Mood Checker

I started to teach myself JavaScript on 20 October 2014. After much careful research and self study, I present to you the following to determine how well your coding session is going. Feel free to use it as you see fit.

function moodChecker(hoursSpentCoding, numberOfBugs, numberOfBugsSolved){
    if (numberOfBugs <= numberOfBugsSolved && hoursSpentCoding <= 8){
        alert("Quit while you're ahead!");
        return "150%";
    } else if (numberOfBugs <= numberOfBugsSolved && hoursSpentCoding > 8) {
        alert("Shouldn't you be curing cancer?");
        return "150%";
    } else if (numberOfBugs > (numberOfBugsSolved * 10)){
        alert("Just give up and log into Stack Overflow. You know you want to.");
        return "0%";
    } else if (numberOfBugs > (numberOfBugsSolved * 5)){
        alert("You deserve a lot of cookies. Soak them in rum.");
        return "5%";
    } else if (numberOfBugs > (numberOfBugsSolved * 2)){
        alert("You deserve a lot of cookies.");
        return "25%";
    } else {
        console.log("Sounds legit.");
        return "100%";
    }
}

Agree? Disagree? Concerned that I’m now blogging code snippets?

Leave a comment »

%d bloggers like this: