How do you organize your code?

Surprisingly this question has been asked multiple times during interviews. My first response is, “hmm, doesn’t everyone pretty much do the same thing? you use folders and files”

I would normally say, for Backbone, we have index.html, folders for js, css and images. Inside js, there are a main entry file, and then there are folders for models, views, collections, routes and templates. For express.js, even there is no convention, we tried to have folders for models, views, controllers, and routes.

There must be better answers. Should I mention require.js? Or the export and require in node.js? Or should I mention module pattern ?

Of course, there is a StackOverflow answer for it: http://stackoverflow.com/questions/1344605/how-do-you-organize-your-javascript-code

Standard

We can no longer play the children’s game

Sitting in a coffee shop next to Palo Alto Square and the radio starts playing “the show”.

A couple of thoughts:
– Palo Alto Square is an interesting place. Last time I was here was interviewing for McKinsey, at a time when I was trying to go from PhD to management consulting. A couple of years latter, I am here again. This time, I am trying to go from management consulting to building great products.
– My favorite version of “the show” comes from the movie “MoneyBall”. MoneyBall definitely shaped my way of thinking about career changes.

Quotes from MoneyBall:

“We’re all told at some point in time that we can no longer play the children’s game, we just dont’… don’t know when that’s gonna be. Some of us are told at eighteen, some of us are told at forty, but we’re all told.”

My interpretation is that: sooner or later in your life, you need to make up your mind of committing yourself to something. Sooner or later, you need to be true to yourself, and ask the hard question “where do I want to spend my time?”. The more chiczy way of saying it is , “you only have that many heartbeats, where do you want spend them?”

That is why I want to be true to myself that I will devote my life to build great products. Hence, the seemly dramatic career changes.

More MoneyBall quotes in the context of startups.

Standard

More closure

The third time in an interview to be asked about closure. All three questions are very similar. While I did well in the last couple of times, I was over-confident and shoot myself in the foot this time. Oh well…

Oh, more and more people are getting offers now. The inflow rate of offers is surreal….

Standard

CDN works

More interviews.

One of the questions are related to how to scale a website to handle 5x of its load in a month. The answer is, you guessed it, CDN. The basic idea is similar to what DealsVista has done in the past: converting dynamic content to html/css/js, serving from local harddrive first, then local ram, then serving from CDN when larger traffic is expected.

Standard

Day 91, Hack Reactor reflection

This would be an ongoing reflection of my Hack Reactor experience.

Overall score: 4/5

High level summary: first half is structured learning, and the second half is project-based learning. There are 18 sprints in the first half, each lasting 2 days. There are 2 projects in the second half, each lasting 3 weeks. Sprints are focused learning on one technical area, i.e. data structure, database, networking. Projects are simulated working, in which you worked with a team, under a deadline, and release regularly.

Marcus is definitely one of the best JavaScript instructors. The mere fact that he teaches for the first five weeks delivers enough value to cover the high tuition.

Classmates are smart and highly-motivated. That is the beauty of setting the tuition at a very high pricing point. The high pricing selects the best, and the most motivated people.

to be continued…

Standard

Day 90, this is the end

Everything has a beginning and an end. For Hack Reactor, this is the end…

Some last emails from Hack Reactor staffs reminding us to fill up one last survey, Tony making sure everyone is getting a t-shirt, emails reminding removing all your personal belongs from the cubby…

We had a bar this time. I guess our hiring went so well that the school decided to spend a little bit more money on the party. We had battle deck again. But it was not as exciting as last time. Marcus did a fantastic job mimicking Felix. What can’t he do?….

A indicator of how awesome the party is how many people will go to the after party. From that standing point, the party was definitely above average. Tons of people showed up for the after party in a nearby bar. That is when things got really interesting…The party was so good that I missed my bart and went to Barry’s place for couch surfing.

Oh, well, tomorrow will be another day.

Standard

Day 89, the second to last day

Interviews. Can’t say anything due to NDA.

It is strange that this is already the second to last day of the Hack Reactor class.

Quick math: $18000 / 90 days = $200 per day. Or in the preferred currency between me and my girlfriend, it would be buying one xbox per day. Wow, that is a lot of xboxes that we could have bought.

We were kidding that for every offer the student got, he should buy a six-pack of beer and bring it to the school. Then, by the end of the two week job hunting period, we will have enough beer for the graduation party. Too late for us, maybe next cohort.

Standard

Day 88, Python 101s

More interviews.

Some basic Python

# list comprehension
[x for x in range(9) if x%3 == 0]

# sum an array of numbers
# lazy version
arr = range(9)
sum(arr)

# naive version
sum = 0
for x in arr:
  sum += x

# reduce version
reduce( (lambda x,y : x+y ), range(9) )

Standard

Day 87, closure in Python

Brush up Python for an interview.

Closure in Python. Yeah!

def outF(outArg):
  def innerF(innerArg):
    return outArg + innerArg
  return innerF

plusOne = outF(1)
plusTwo = outF(2)
print plusOne(10)
print plusTwo(10)

More things:
– more interviews
– get a parking ticket. Ouch!

Standard