Writing Testable Code in Go

I’ve had a hard time to wrap around the stub, mock in golang, but this blog post helped me immensely.

Link here to view the post

After reading it, my biggest issue was lack of my own interfaces in my program. Without my own interface, it was a big challenge to mock library defined interfaces; thus, making it quite hard to come up with tests.

After writing test, execute it like this:

 

Samsung Galaxy Clip

The video clip appeared on my facebook feed. Thought it was a very cleaver idea, which was created by Moonjong Hun (I’m pretty sure that’s the guy ’cause the video clip was embedded to fb by that person). It appears to be a school project.

Some companies already send the university student a job offer already???

nipopo

Almost always nipopo comes to my room and sleeps right next to while I work.

🙂

Sleeping Nipopo

having much fun with backbone & requirejs

I’ve been working on a project that requires intensive javascript right now, so that I went with backbone and requirejs as fundamental framework for the project.

It’s multiple pages project so my structure would look something like this:

Obviously common.js defines paths and shim for require.config that are shared among all pages.

Each html page has require’s initialization code like this:

That way, common js containing require configuration can be shared among pages. Also I did not want to create main.js to reduce a number of javascript files.

apps directory contains page’s main javascript files. So in the example, I have 2 pages, which are home and profile, so I have home.js and profile.js. Those app javascript files are the key piece that has the core business logic to pulls necessary views, models, and necessary lib files for the page.

Everything has been very modularized and between modules, communication occurs via event aggregator, which is yet simple, but very very powerful. Without that, I don’t know how I would have separated logics and made them still modularized.

I really like how you can modularize your javascript code with requirejs. I think that is one of best things that were invented for javascript!