Thursday, January 24, 2013

Enterpise development in TypeScript


I have started writing a book” Enterprise development in TypeScript”

I am an agile developer, so this book will be published Early and Published Often. This way I can get feedback from readers and make the book as good as possibly.
The focus of this book is to use TypeScript in your enterprise applications. The book will go through the basics of TypeScript, different tools and frameworks, how to create unit tests and, then automate your tests, builds and deployment. The book is far from done, and if you think the book is missing something please don’t hesitate to contact me.

Please, tweet and show your support by saying what you'd like to pay for it at https://leanpub.com/enterprise-development-in-typescript

Book contents would be something like this
1.       TypeScript Fundementals
·         What is TypeScript
·         Static vs Dynamic type language
·         Interfaces
·         Classes & functions
·         Inheritance
·         Modules
·         Arrow functions
·         Generics (not supported yet)
·         TypeDefinitionFiles

2.       TypeScript Tools and frameworks
·         Visual Studio
·         Web Essentials
·         Sublime text

3.       Introduction to enterprise development
·         What is enterprise development?
·         The enterprise code

4.       The road to enterprise
·         Decouple of code
·         Test driven development
·         Continous Integration
·         Continous Delivery
5.       Design patterns
·         Inversion of Control / Dependency Injection
·         Facade pattern
·         Factory pattern
·         MVVM
·         MVC

Sunday, January 20, 2013

Retrospective of day 2 - Warm Crocodile Conf


#WarmCrocConf Day 2


Continuous Delivery in Action - Jimmy Bogard
Thanks to Jimmy I got a flashback when worked at 123hjemmeside/simplesite regarding SQL change management, I haven't done that since I moved on. But the Tarantino Project looked really impressive - this is a must in my future projects.
Contact Jimmy on Twitter @jbogard or read his blog

xUnit.net and AutoFixture - Mark Seeman
Mark did yet another awesome presentation, he's really good to involve the audience. He mad a good point why using Xunit. MSTes is not extensible, but xUnit.net is. In xUnit.net, you can extend the Fact or Theory attributes and support parametrized tests. mark has write a good blog post. He showed how cool AutoFixture is by given an example by using the FizzBuzz kata and using the InlineData attribute.

Follow Mark on Twitter @ploeh or read his blog


Getting Started with Azure Mobile Services - Henrik Frystyk Nielsen
Didn't get mutch out of this session, it seemed more like a sales speach than showing of some cool things, and wasn't very impressed, most of the session I just thought "yet another service repository". And didn't agree on all that he said, but maybe the API has changed since last time I made an windows phone app.

Follow Henrik on Twitter

Layers Considered Harmful - Chrisitan Horsdal
Christian did a cool presentation and showed how quickly we mess up our code with layers. Go basic remember YAGNI "You Ant Gonna Need It", don't code for reuseabillity, does I really need this in other places?

Follow Christian on Twitter or read his blog

RavenDB & the magic beans - Ayende Rahien
Maybe this Session was great, can't say, was late, so didn't get a seat in the front, and the lack of my hearing of deep voices I couldn't here what he said, but I love the product anyway :-)
Read his blog 

C# behind the scenes - Bart De Smet
Bart Is just an amazing speaker, really geeky but in a cool way. He talk about Expression Trees, and Iterator State machines. very interesting.

Read his blog

Retrospective of day 1 - Warm Crocodile Conf

Its already 3 days ago I left the #WarmCrocConf and think its time to write my experience when the conference is still fresh in my mind.

The conference was all in all great, cozy and intense. I think that we were about 200 people, and that did the conference intimate, i think that was really great because it was easy to get a chance to talk to the speakers, and connect with other geeks after dinner. The only really thing that I can complain about was the amount of changes to schedules.

I talked with the cool guys working on AutoFixture, especial nikos aka  , and showed nikos an enriko aka  my AutoFixtureTS project (a typescript version of AutoFixture.) I think they thought it was interesting?.

Alot of stuff was going on at the conference and Eventifier  has collected tweets, slides and images.

Session retrospektiv:

Day 1

BREAKFAST  KEYNOTE - Growing effective agile teams by Roy Osherove
Roy Osherove (@RoyOsherove on twitter) is the Chief Scientist at Bouvet.no
He did er great job and inspired me and got me thinking - have I ben in the comfort zone to long?...  maybe, so now I'm actually making a list of what kind of avalanche I wan't to dig into.

Get the keynote slide

Grokking Git by seeing it - Enrico Campidoglio
I didn't really know what I would expect to learn in this session. I thought I knew the basic of GIT, I was terribly wrong, yes I knew the basic commands, but that was it :-)

He was really good to explain how GIT actually worked by showing it step by step.
Things I need to remember and dig into here is:

SeeGit => Realtime repository visualizer
Posh-GIT => A better GIT with powershell
GIT tutorial => Need to try this :-)

Enrico works at tretton37 and can be contacted through his blog or on Twitter @ecampidoglio

Tour de API - Anne-Sofie Nielsen
Anne-Sofie did a great talk about oAuth and how to use it with different API's. The presentation was in 3D, pretty cool, and a good outbreak from normal .PPT slides.
She also mention to be aware of API changes and how API keys works. This was something a colleague and I hasn't been aware of :-(
Anne-Sofie has 3rd degree black belt in karate and can be contacted on her blog or on Twitter @femalenerd get the slide

NuGet (Anti-)Patterns: Tales from the trenches - Xavier Decoster
Xavier talked about Package Version, Package Repositories and general Anti patterns.
Things I remembered her was:

Package Version
Use semantic version with NuGet and how NuGet version's defers from SemVer.

Package Repositories
Split package repositories by audience, by using different feeds, I will dig into MyGet.org to see if I can use it.

Xavier can be found at http://www.xavierdecoster.com and you can follow him on Twitter @xavierdecoster

Get the Slide

Unit Testing best practices and horrible mistakes -  Roy Osherove
Roy Talks allot and love to sing, he should definitely publish the songs on YouTube.
Top 5 best practices  I think he covered in his session

  1. Test only public's
    1. Testing a private makes your test more brittle
    2. Test-First leads to private members after refactoring, but they are all tested
  2. Test Only One Thing
    1. avoid multiple Asserts
    2. one mock per test
  3. Enforce test isolation
    1. No dependency between tests!
    2. Don't run a test from another test
  4. Separate unit from integration tests
  5. Naming a unit test
    1. use _ to describe the test

Get the slide


Taking the hippie bus to the enterprise - Mogens Heller Grabe
Great Session, really showed how simple you could use a service bus with Rebus, I have to integrate in several of my projects. A fun thing was I got an error in one project while attending the Rebus session that Rebus could have prevent from happened.
Find him on Twitter @mookid8000 Read his blog Get the slide Get the demos

Organize your chickens: NuGet for the enterprise - Xavier Decoster
We had a good discussion about Package Management, dependency hell and the NuGet eco system. Then we discussed MyGet vs. TeamCity as a pacakage server, and though we have TeamCity and TeamCity has some of the same features, it maybe make sense for me to use MyGet. I need to dig into this...

Get the slide

Sunday, January 13, 2013

Extension methods in TypeScript

/* 18/1 2013Update Remember Extension methods are code smell, so use it only where it really make sense.
Good blog post about Extension methods why its code smell http://www.daedtech.com/why-i-dont-like-c-extension-methods   
*/

When working with strings it’s likely that you’ve had to check if the string is null or empty, and
Thats no different in TypeScript.

I thougt of making an extension method for StringIsNullOrEmpty, but could not fine any documentation on this.

I know that TypeScript interfaces are open ended, so I extended the String interface like this

    interface String {
        StringIsNullOrEmpty: () => bool;
    }


Then I just need to found out how to inplement it, and used prototype for this.

    String.prototype.StringIsNullOrEmpty = () : bool{
        return this == null || this.length == 0;
    }


This works fine, but I'm not sure this is the correct way of doing this, so if you know a better way please leave a comment.

I have encapsulated the inteface and all my prototypes into a module called StringExtensions

module StringExtensions {
    interface String {
        StringIsNullOrEmpty: () => bool;
    }

    String.prototype.StringIsNullOrEmpty = () : bool{
        return this == null || this.length == 0;
    }
}


Here is a litle jasmine test.

describe("StringExtensions methods tests", () => {

    it("Given an empty string should return true", () => {

        // Fixture setup       

        var sut = "";

        // Exercise system               

        var expected = true;

        // Verify outcome

        expect(sut.StringIsNullOrEmpty()).toEqual(expected);

        // Teardown

    });   
});

Friday, January 11, 2013

TDD StringCalculator kata in TypeScript

Inspired by Roy Osherove StringCalculator http://osherove.com/tdd-kata-1/ and playing around with TypeScript, I tried to make my own version in TypeScript.

I have made this Kata 2 times in TypeScript, first time just to get the feeling, second time as a screencast, and thats the one I share with you.

I have written my tests Visual Studio 2012 with webessentials and used the jasmine test framework, and used Chutzpah as test runner.
Chutzpah supports both Qunit and jasmine testing framework.
Chutzpah uses the phantomJS headless browser to run your tests. Chutzpah also support for TeamCity (CI server) to automatically run your tests.



TypeScript StringCalculator Kata from Ronnie on Vimeo.