Code Clan Week 10 - JavaScript... use a semicolon if you want!

So I'm now in double figures of being a full time coder.  We have done Ruby, done Java and now we are being thrown into the deepend with JavaScript.


Its actually not that bad, lots of the concepts we have learnt to date apply to JavaScript and getting up and running making programs is quite quick.  And yes as I have mentioned before Java and JavaScript are not the same language.  Java is a compiled language, JavaScript is not.


Monday morning standup had us discussing the previous week and a like for the computer science  teaching, but not so much of a like for the CV and cover letter teaching.  I think the latter adds some reality that we will need to get a job at the end of the course and will be competing against each other for vacancies…


Anyway Monday starts with JavaScript and we are quickly learning the basics of Operators, Loops, Arrays and Functions.  All very familiar and its amazing how quick it is to get basic programs running compared to day one Ruby.


Tuesday standup starts with a number of cohorts commenting that so far they like JavaScript, but some commenting that they don't like that its not as strict as Java… Java you must use a semicolon at the end of a line, JavaScript its up to you if you want to use a semicolon. Convention says to use one but hey if you forget it will carry on regardless. Nice!


In class we start to build a bear and a robot and start to bring in modules.  Modules get us back to TDD (Test driven Development) and set up our programs so that they are tested as they are built.  When making an object the first thing to construct is the associated Spec (or test file) that will define the tests for the object before you program the object.


The afternoon lab is a task to create a JavaScript water bottle and an athlete. The bottle begins empty and you have to fill it, and the athlete can drink from the water bottle and the bottle gets depleted.  As the athlete runs their hydration goes down and they need to drink to replenish their hydration.  Split into pairs we had about 90 minutes to create the program and have it passing tests.  It was a great exercise to get two objects passing data between them.


For the homework out came the shopping basket from the previous week which was an employer coding test.  Apparently one of the best ways to learn a new language is to have a familiar task that you can program in each new language.  So for us as homework we had to recreate the shopping basket, add items to the basket,  remove items from the basket, find the total cost of the basket, apply discount of 10% for total over £20, include a buy one get one free offer, and if the customer had a loyalty card give them and additional 5% off their total.  So yesterday We’d never touched JavaScript before.  This homework was hard and took quite a while.  But on the train the next morning I had my bog-of working and all my tests passing!


Wednesday and Thursday we expanded on javascript functionality and learned how to new up objects and pass functions into functions.  Seems a bit odd passing a function into a function but after a few examples it can be very powerful.  We practiced the new functionality in a couple of afternoon pair programming labs.


First we were set the challenge to new up a superhero object, feed them their favourite food which would boost their energy. Then new up an evil rat object that when they touched the food it would make it poisonous  and the superhero would be come sick.  


The second was to create a bank account and add account objects  which had an owner amount and type.  We practiced passing functions buy using predefined methods to search for a named account in the bank array, look for the highest valued account etc.

Thursday night was quiz night hosted by Cohort 8.  An excellent evening where 3 cohorts (7,8 and 9) came together with instructors and mixed into teams.  My team was joint third. we did well guys the questions were tuff.


So its Friday and I'm back on the train from Stirling to Edinburgh for 10:00 am morning standup and issue of the weekend homework.  Looking forward to it as Im enjoying JavaScript. 


Next week we take it into the browser and add some visualisation to our programs.


Its end of week 10 and its been another brilliant week at Code Clan, Im learning so much and loving writing code.  Thanks again to the instructors and huge thanks to my fellow cohorts for being such a Awesome bunch! 


<-- here is my ladybird book on computers when I was a Kid.  Was I always destined to do something with computers?

Oh and the word House looks odd when you read it a number of times in a row House House House House to the point it becomes unrecognisable.  It was spotted by a fellow cohort during a code along.  Possibly an affect of JavaScript which was apparently written while under the influence of drink and magic mushrooms...

Write a comment

Comments: 0