Test Driven Development Kata – Roman to Arabic in JavaScript

Coding Katas are a way of developing your skills as a programmer.  I thought it might be informative to tackle one of the classics as a blog post. Depending on how this works, I may or may not do another one quite so publicly.

The rules I’m going to try to adhere by.

  1. I will document what I am doing as I go.
  2. This is not a pre-coded blog post.  You’ll get to “see” me code as I go.
  3. I will write all tests first.
  4. I will only write enough code to make the current tests succeed.

 

Test Driven Kata - Roman to Arabic

Continue reading “Test Driven Development Kata – Roman to Arabic in JavaScript”

JavaScript bind() for cleaner code

Several weeks ago, I wrote about how closures impact calling asynchronous functions in a loop and several ways of dealing with that problem.

In my recent coding, I’ve discovered an even more simple way of dealing with this problem. In the process, it removes the anonymous function and eliminates the linting error, ‘Don’t make functions within a loop’

You see, I’ve been experimenting with JavaScript bind(). And as it turns out, we can use bind in multiple situations, including dealing with the closure issue I mentioned a couple of weeks ago.

JavaScript bind() for cleaner code
Photo credit: Connor Tarter via VisualHunt / CC BY-SA

Continue reading “JavaScript bind() for cleaner code”

Your Programming Resume is Garbage

Over the last several years, I’ve had a chance to read a few Programming Resumes.  Or, I should say, TRY to read a few resumes.  But frankly, if the Programming Resume I typically see is common, everyone who reads my blog needs this advice.  I haven’t seen a barely adequate resume in years.  And I’m sick of it.  Oh, it’s good for me of course.  I know my resume is going to stand out as such a unique work of art compared to the others, that I will get a call back right away.  After all, if the competition is so incredibly weak, I don’t even need to try.

On the other hand, as someone who has to read these resumes, I’d like to have something better.

And no, I’m not going to go over the standard “how to make your resume awesome” stuff because evidently most programmers can’t even get the basics down.  Seriously!

Your Programming Resume is GARBAGE!
Photo credit: ollesvensson via Visualhunt.com / CC BY

Continue reading “Your Programming Resume is Garbage”

Exposing Secret JavaScript privates to Unit Tests

The question comes up all the time, “How do I access JavaScript privates from my Unit Tests?”  And invariably, the purist chimes in with the answer, “you don’t”.

But, isn’t the point of unit testing to allow us to test UNITs?  Why artificially limit our ability to test units if we don’t need to?  If we had the ability to create protected members, wouldn’t we tests those separately?

So, what follows is how I surface my private JavaScript members so I can access them during tests without having to make them public during the run of my protection code.

Exposing Secret JavaScript privates to Unit Tests

Continue reading “Exposing Secret JavaScript privates to Unit Tests”