Silicon Valley Code Camp 2011

Last weekend myself and Omid Mozayani (another Aussie; recent addition to the valley) spent the weekend of Saturday and Sunday, October 8th and 9th, 2011 at Silicon Valley Code Camp 2011. Held at the Foothill College in Los Altos/CA with an attendance of well over 2,000 (registered 3,417) people and 209 sessions organized in a University style setup over these 2 days. Impossible to attend each one but plenty to cherry pick from. It felt like I was back at Uni(versity) running between lectures. I loved it! Here’s what happened.

CodeCamp at FootHill College.

What is Code Camp

Code Camp is a new type of free community event by and for the developer community where developers learn from fellow developers. It is 2 full days of talking about code with fellow developers. Sessions range from informal “chalk talks” to presentations. Basically there is lots of education, networking and good food.

Pictures from Code Camp @ Foothill College

Lecture - Crockford on ECMAScript5
Lecture - Crockford on ECMAScript5

Lunch - feeding time for thousands of nerds
Lunch - feeding time for thousands of nerds

Ernest Semerda - nerd out and about
Ernest Semerda - nerd out and about

Lecture - multi threaded design
Lecture - multi threaded design

More pictures here on my Flickr.

Code Sessions

Choosing what sessions to attend was key since it was impossible to attend everything when you consider that each session took around 45 min. Here is a wrap of the 3 areas I focused on; ECMAScript (JavaScript) with code encapsulation, Writing Clean Code and Web Analytics.

ECMAScript 5 (JavaScript)

Douglas Crockford ran 2 sessions on ECMAScript 5: The New Parts and ECMAScript: What Next?. Crockford is involved in the development of the JavaScript language and popularizing the data format JSON (JavaScript Object Notation), and for developing JSLint. You may recall me talking about JSLint in a previous blog post on JavaScript Patterns.

More on Crockford is here (his personal site) and here: Crockford on JavaScript. Also read about how JavaScript is the world’s most misunderstood language. Recommended reading! You will want to learn more about this great language.

ECMAScript’s Fifth Edition is now available in all of the best browsers. This is what you are getting:

  • Use “Strict mode” in all your JavaScript code.
    • As per my previous post on JavaScript Patterns here.
    • Old JS compiler ignores it so it’s safe to use today in all your JavaScript.
    • A bug in JS used to advantage today for backward compatibility.
    • “Strict mode” will break old bad programs. If you are writing good programs they will just work.
  • No more implied global variables within functions.
    • Yipee! Major fail in JavaScript where undefined variables would chain to the prototype making it very difficult to isolate your code, and to reuse it in new contexts.
    • If you forget to “var” a variable it now becomes undefined so you can address it vs. letting it slide by. Bad coders beware!
    • To append something to the global object add “window.function/var”.
  • “apply” and “call” do not default to the global object.
  • No “with” statement. Read why it was considered harmful to use.
  • Restrictions on “evil” eval. Here’s why it’s evil. *Cough* code injection!
  • No more octal literals. Not needed since punch card days.
  • Forgetting to use the new prefix will now throw an exception, not silently clobber the global object.

Use something like this today to check if your browser is running in Strict mode:

function in_strict_mode() {
    return (function () {
        return !this;
    }
}
  • Make it a habit to do static analysis using JSLint. If you are using it already your code is probably good and ready for strict mode.
  • Use “Safe JavaScript Subsets” like Caja & ADsafe projects which allow you to safely run 3rd party software on your website.

JavaScript Code Organization and Encapsulation

Shawn Van Ittersum presented ideas for organizing, encapsulating, and simplifying JavaScript code, including: creating JavaScript objects and classes with truly private members, using Douglas Crockford’s module pattern and classical inheritance constructs provided by Dean Edward’s Base.js, Prototype, and MooTools; abstracting JavaScript code from HTML templates, CSS styling, and the DOM; designing with polymorphism (duck typing) for code reuse and simplicity; and using JSLint to identify problems in your code before runtime.

The idea behind the power of Encapsulation is simple:

  • Encapsulation limits widespread interconnection,
  • Gives you Freedom to change internal implementations without affecting external code and
  • is referred to as Loose Coupling – an approach viewed as positive in the field of computer science to remove dependency between systems and allow horizontal scaling.

Ittersum’s lides with code samples are located here.

Writing Clean Code

Theo Jungeblut ran this session and basically the crust of the presentation was that writing clean code makes us more efficient.

This presentation was based on C# and Visual Studio 2010. However the following patterns and practices can be applied to every other programming language too.

Over the lifetime of a product, maintaining the product is actually one – if not the most – expensive area(s) of the overall product costs. Writing clean code can significantly lower these costs. However, writing clean code also makes you more efficient during the initial development time and results in more stable code.

  • Readability
    • Follow coding guidelines.
  • Simplification and Specialization
    • KISS (Keep it simple, Stupid!) – most systems work best if they are kept simple rather than made complex.
    • SoC (Separation of concern) – focus on 1 thing.
    • SRP (Single responsibility principle) – every object should have a single responsibility, and that responsibility should be entirely encapsulated by the class.
    • OCP (Open/closed principle) – software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification aka inheritance & encapsulation.
  • Decoupling
    • LSP (Liskov substitution principle) – guarantee semantic interoperability of types in a hierarchy, object types in particular.
    • DIP (Dependency inversion principle) – high-level modules should not depend on low-level modules. Both should depend on abstractions. And abstractions should not depend upon details. Details should depend upon abstractions.
    • IHP (Information hiding principle) – prevent certain aspects of a class or software component from being accessible to its clients aka encapsulation.
    • Contracts – 2 categories: preconditions and postconditions where a precondition states that certain things must be true before a method can execute, and a postcondition states that certain things must be true after a method has executed.
    • LoD (Law of Demeter or Principle of Least Knowledge) – specific case of loose coupling where units (code) only talk to immediate friends (not strangers) assuming as little as possible about the structure or properties of anything else.
    • IoC (Inversion of control) – reusable generic code controls the execution of problem-specific code. It carries the strong connotation that the reusable code and the problem-specific code are developed independently, which often results in a single integrated application.
    • SOA (Service-oriented architecture) – develop code in business functionalities (discrete pieces of code and/or data structures) that can be reused for different purposes.
  • Avoiding Code Blow
    • DRY (Don’t repeat yourself) – reduce repetition of information.
    • YAGNI (You ain’t gonna need it) – do not add functionality until it is necessary.
    • Quality through testability (all of them!)

There is also a good bunch of tips from The Pragmatic Programmer located here.

And don't forget, Scout rule = leave a better place!

Recommended book

SOLID (Single responsibility, Open-closed, Liskov substitution, Interface segregation and Dependency inversion) is a mnemonic acronym introduced by Robert C. Martin

Web Analytics

Massimo Paolini presented on Google Analytics. The most profound thing he said which delivered a strong message is:

"Web analytics is about Revenue NOT traffic."

Bang! Right there. Too many site owners are mislead into trying to decipher visitor totals vs. focusing on the true picture; and that is how to understand and optimize their site visitors across online marketing efforts. The process is then rinse & repeat.

Finally, Web Analytics is NOT a precise science. You are looking for trends. Differences. To help you make decisions moving forward. This is because some people clean their systems ie.delete cookies etc..

Presentations from Silicon Valley Code Camp

For more presentations from these 2 days follow the link below to presenter uploaded presentations to SlideShare. Includes 2011 and previous years. Enjoy!

http://www.slideshare.net/search/slideshow?type=presentations&q=silicon+valley+code+camp+2011&searchfrom=basic

More links to Silicon Valley Code Camp

Code Camp main site: http://www.siliconvalley-codecamp.com/
On Facebook: http://www.facebook.com/groups/6125701762/
On PB Wiki: https://codecamp.pbworks.com/w/page/16049741/FrontPage
On Twitter: http://twitter.com/#!/sv_code_camp

So, in conclusion, this was an awesome & insightful 2 days packed with plenty of great applicable content.

Enjoy!
~ Ernest

WebAnt Analytics – climb inside your customers mind

WebAnt was a holistic web analytics and automation service servicing corporate clients on the Australian market. WebAnt proved to be a competitor (at the time) to Red Sheriff (now Nielsen NetRatings) when the Australian market was not overcrowded with analytic tools. Overthrowing Red Sheriff as the web analytics provider of choice for MBF – Australia’s largest health benefit fund.

Our service offerings

  1. Web Analytics tools and reports ranging from the standard client analytic type to website overlays, dynamic component tracking, email blast tracking, trend reports to footprints (heatmaps) et al.
  2. Automation tools and reports to allow WebAnt subscribers to generate “phantom customers”. Then sending them interacting through subscriber http / https site and report back on findings. This proved to be the hottest and most value adding service add-on since it identified problems before they escalated / affected the larger online user community.

Automation in more detail

Automation plugin called InSite
Automation plugin called InSite

Quick facts

Life span: 3 years.
Founder: 1 (me) + multiple outsourced contractors on a need basis.
Profitable: From the start – 20% in expenses and rest profits.
Why terminated: Google Analytics entered the market – hard to compete with free.

Some product screen shots

Trivial background history: WebAnt began its life as BlueArrow (logo below) which was built as a complementary offering to a web design business I and a former AMP colleague ran. The web design business was my 1st true business out of University. Former AMP executive management invested in BlueArrow and WebAnt was born with branding capabilities to allow anyone to resell the product.

Precursor to WebAnt
Precursor to WebAnt

Top 5 things I learnt from this venture

  • You need to spend money in order to make money. Sometimes more than you are used to / comfortable with. This was my biggest fear (initially) since the hardware cost us around USD 1,000 per month, yet it was only a fraction of what we were earning once we got it rolling.
  • Linux sh*ts all over Windows. We had both stacks (initially) and Linux always impressed me with its stability, up time, ease of maintenance without taking the site down and super performance. Need I say more lol.
  • Don’t get tied up in a “which language” debate. At the end of the day you are solving a business problem and whatever tools work at the time stick to them. BlueArrow was built-in classic ASP (remember this), then it was ported to PHP as WebAnt and later we introduced parts in C# & Java. It worked, we were profitable, it was fun to learn new languages and our clients were happy. Just make sure you monitor performance and stay on-top of the game (trends) and adjust as needed.
  • Results are everything and talk is just bullshit. Don’t get excited about a potential partnership / expansion unless you start seeing some results like customers signing up and/or your bank account dollars increasing. Everyone around you wants to make money off your idea and will talk it up like you will be a millionaire tomorrow. Just focus on your business and give them the tools to go away and bring those millions. Never lose focus of you goal.
  • Build a profitable business from the start. It’s alot more fun knowing that every sweat and late night you pull in is rewarded financially. The harder you work the more money you make (not always but you get the gist). Don’t hope that one day you will find a way to make money, do the hard-work now (at the start) and you will have more rewards. Take a read of 37signals/DHH style companies on being profitable and proud: http://news.ycombinator.com/item?id=169197

When I walked away from this venture I knew the ins and out of web analytics. I considered myself very well-informed. And to this day I still hold a very keen interest in data mining, analysis & analytics. Yes today I use Google Analytics for most projects which require tracking since it’s a lot simpler and easier than building your own home-grown solution + it’s a very powerful tool when used correctly.

Ernest