ndc magazine 1 issue

72
FOR SOFTWARE DEVELOPERS AND LEADERS MAGAZINE THE DEVELOPER REBRANDED AS NDC MAGAZINE N O 1/2014 TEACHING DEVELOPERS NEW TRICKS KAROLINE KLEVER FUNCTIONAL REACTIVE PROGRAMMING MIKAEL BREVIK AND STIAN MØLLERSEN SPECIAL FUNCTIONAL PROGRAMMING ISSUE THE POWER OF PARTIAL APPLICATION SCOTT WLASCHIN CREATING RESPONSIVE UIS WITH F# RACHEL REESE Workshops Page 70 COURSES See descriptions Page 56

Upload: ndc-the-developer

Post on 03-Mar-2016

241 views

Category:

Documents


0 download

DESCRIPTION

The Developer is now rebranded to NDC Magazine.

TRANSCRIPT

Page 1: Ndc magazine 1 issue

F O R S O F T WA R E D E V E L O P E R S A N D L E A D E R S

M A G A Z I N E

THE DEVELOPER REBRANDED AS NDC MAGAZINENO 1/2014

TEACHING DEVELOPERS NEW TRICKS

KAROLINE KLEVER

FUNCTIONAL REACTIVE

PROGRAMMINGMIKAEL BREVIK AND

STIAN MØLLERSEN

SPECIAL FUNCTIONAL

PROGRAMMING ISSUE

THE POWER OF PARTIAL

APPLICATIONSCOTT

WLASCHIN

CREATING RESPONSIVE UIS WITH F#RACHEL REESE

WorkshopsPage 70

COURSESSee descriptions

Page 56

Page 2: Ndc magazine 1 issue

There comes a responsibil-ity with the job of being a developer, and that is to keep updated. Our worlds are constantly changing. The tools you used last year are not necessarily sup-ported this year. That framework you loved is now overpowered by another, more extensive framework. And the methodology your

project managers swore to didn’t work as well as promised, so from now on we’re trying a new one. The world you knew as a developer five years ago is a totally different world from the one you live in today. I’ve always found the term “self-taught” to be a bit mis-placed when used in connection to development. We are all self-taught to some extent. When I think about the greatest developers I know and what they have in common, it’s that they constantly evolve. They self-teach every day, every week, every month. I’m sure that 90% of the knowl-edge they possess is self-taught, and that is what makes them extraordinarily good. When you have the privilege of being able to work on what you love, the fascination of what you do and how you do it will make you thrive for more. It makes you want to learn more.

Our preferences to learning are different. Some devel-opers learn by engaging in discussions over a beer, others read a book on the bus. There are blogs, Meetups, classes,

videos, MOOCs, conferences etc., the list of ways to gain knowledge is endless. As our technological worlds are changing, there has been a shift in how we learn. We learn by teaching others what we know. Why else did you put that module you created on GitHub? And what about that blog posts you wrote last week? By publishing that blog post you not only had to put your newly gained knowledge into writing, but most likely you also contributed to some-one out there learning a thing or two. It’s cheesy to say, but sharing is caring.

There is a couple of important question all developers should ask themselves at least twice a year. That is “What are my goals for the next twelve months? What do I want to learn? How can I become better?” Being aware of where you want to go will enable you to learn the things needed to get there. Knowing that you’re constantly evolving and not making the same mistakes twice will also make it easier for you to find inspiration and motivation. And eve-ryone who are lucky enough to have experienced it, knows that there is nothing better than to work in a team filled with motivated, knowledge-loving and knowledge-sharing developers.

So what are your goals for the next twelve months?

Karoline Klever

NDC MAGAZINE 1-2014

and meet your target group!For more information about advertisement, please contact Charlotte Lyng at +47 93 41 03 57 or [email protected]

Advertise in the NDC MagazineF O R S O F T WA R E D E V E L O P E R S A N D L E A D E R S

M A G A Z I N E

THE DEVELOPER REBRANDED AS NDC MAGAZINENO 1/2014

TEACHING DEVELOPERS NEW TRICKS

KAROLINE KLEVER

FUNCTIONAL REACTIVE

PROGRAMMINGMIKAEL BREVIK AND

STIAN MØLLERSEN

SPECIAL FUNCTIONAL

PROGRAMMING ISSUE

THE POWER OF PARTIAL

APPLICATIONSCOTT

WLASCHIN

CREATING RESPONSIVE UIS WITH F#RACHEL REESE

WorkshopsPage 70

COURSESSee descriptions

Page 56

F O R S O F T WA R E D E V E L O P E R S A N D L E A D E R S

M A G A Z I N E

CREATING

Teaching developers new tricks

Publisher: Norwegian Developers Conference AS. By Programutvikling AS. Organisation no.: 996 162 060Address: Martin Linges vei 17-25, 1367 Snarøya, Norway. Phone: +47 67 10 65 65. E-mail: [email protected]

Page 3: Ndc magazine 1 issue

3

ARTICLES

The power of partial application ...................................... p. 4

The ideal programming language .................................... p. 8

Seven Questions about Seven Languages .... p. 12

0-layered architecture ............................................................... p. 18

Creating responsive UIs with F# .............................. p. 22

Understanding programming paradigms ..... p. 28

The RELEASE Project ................................................................ p. 32

Functional reactive programming ........................... p. 38

Teaching kids python with the Code Club .... p. 44

Large-scale JavaScript applications

and the DOM .............................................................................................. p. 46

Architecting for change ........................................................... p. 50

NDC London returning in 2014 ..................................... p. 54

COURSES

Descriptions ................................................................................................. p. 56

Course overview .................................................................................... p. 68

NO

RDIC ECOLABEL

241 Printing company

672

Member of Den Norske Fagpresses Forening

Photo cover: Krostoffer SunnsetDesign: Ole H. StørksenUncredited photos are from Shutterstock, except portraits.

Print run: 13,000 Print: Merkur Trykk AS

Editor: Kjersti Sandberg

Marketing Manager: Charlotte Lyng

Contents

Page 4: Ndc magazine 1 issue

4

© Ig

or P

etro

vic/

Shut

ters

tock

The Power of PARTIAL

APPLICATION

Page 5: Ndc magazine 1 issue

When a newcomer looks at a functional programming lan-guage, one of the first things that leaps out at them is that whitespace is used between the arguments in function calls rather than parentheses. For example, here is a simple “add” function:

// define a functionlet add x y = x + y

// use the functionlet result = add 1 2

Why don’t functional languages use parentheses, like “nor-mal” languages? Why isn’t a function call written the stand-ard way?

let result = add(1,2) // why not this way?

The reason is that, with functional languages, the parenthe-ses can be put in a completely unexpected place; around the function name and first argument, like this:

let result = (add 1) 2

Furthermore, the code in parentheses can actually be extracted into a separate function altogether and then called later:

let partialFn = (add 1)let result = partialFn 2

The act of passing fewer parameters than needed is called “partial application”.

Behind the scenes, you could think of “add” as being imple-mented as a one parameter function that returns a lambda (another one parameter function). The “x” parameter is “baked into” the lambda, so that it in turn only needs to take a single “y” parameter.

// alternate definitionlet add x = (fun y -> x + y)

Any multi-parameter function can be treated this way. So for example, a three parameter “add” function can be treated as a two parameter function that returns a new one parameter function, like this:

// normal version: add three parameterslet add3 x y z = x + y + z

// alternate definitionlet add3 x y = (fun z -> x + y + z)

This concept is very different from what you might be used to non-functional languages, and you might be thinking: What good is it? What possible use can it have?

Let me answer that by showing you three important exam-ples of the power of partial application.

PARTIAL APPLICATION WITH MAPS AND FILTERSIn a functional programming language, when working with lists and other collections, you avoid “foreach” loops and tend to work on the entire collection at once, passing in a function that is applied to every element in the collection. The List.map function, for example, is defined like this:

List.map (function to apply to each element) (a list)

So to add 1 to each element of a list we might write some-thing like this:

List.map (fun elem -> elem + 1) [1..10]

But that lambda is exactly the same as the output of the partially applied “add” function that we implemented earlier. In other words, we can reuse the “add” function by partially applying it with only one parameter, and passing the result to the map function, like this:

List.map (add 1) [1..10]

Similarly, we could create a general “isDivisibleBy” function

let isDivisibleBy divisor input = (input % divisor = 0)

And then we can use it in a partially applied form too, with a filter function, like this:

List.filter (isDivisibleBy 2) [1..10]

Some functional programming principles can seem bizarre and hard to understand when you first encounter them, but are immensely powerful when you master them. In this article we’ll look at the technique called “partial application” and see how it can be used in practice.

5

By Scott Wlaschin

Page 6: Ndc magazine 1 issue

6

This approach becomes even more useful when you need to chain a series of functions together, like this:

[1..10] |> List.filter (isDivisibleBy 2)|> List.map (add 20)

So, when you see functions used in this way, you are seeing partial application in action.

PARTIAL APPLICATION FOR DEPENDENCY INJECTIONIn object-oriented design, the concept of “dependency injec-tion” is used to parameterize one object with another, typi-cally by passing in an interface or service in the constructor.In functional programming, there are no classes or objects, but partial application can act as the equivalent technique.

For example, let’s say that you need a function that looks up a customer in a database.

The function will take a customer id as input and return a Customer value, so its signature will look like this:

type GetCustomer = CustomerId -> Customer

But where’s the database? How can this function work with-out a database to talk to?

The answer is that we can define an implementation with an extra parameter for the database connection. And in the implementation, we can use the passed-in connection to do the work, like this:

let getCustomerFromDatabase connection customerId = // from connection // select customer // where customerId = customerId

But we can now do a trick! We can pass in only the first parameter (the connection), and get back a new function which now just takes the customerId, exactly as we want.

let getCustomer = getCustomerFromDatabase myConnection

What’s more, we can easily mock a different version of the same function for testing. For example, we could use an in-memory map/dictionary as a lookup. The implementation of that function would look like this:

let getCustomerFromMemory map customerId = map |> Map.find customerId

But again, if we pass only the map, we can get back a new function that looks just like any other “getCustomer” func-tion.

let getCustomer = getCustomerFromMemory myMap

So now we have two versions of a “getCustomer” func-tion. One was created by partially applying the database

connection, and one was created by partially applying the map. They both have the same signature and are completely interchangeable, and they have both been “injected” with a different dependency.

I hope you can see that this approach gives you exactly the same benefits that dependency injection and mocking do in the object-oriented world.

PARTIAL APPLICATION IN CONJUNCTION WITH VALIDATIONFinally, let’s look at one more use of partial application, which is to gradually build up a constructor function that can handle bad input. Say that you have a “Person” type that is built from other types: Name, Age and Email.

type Name = Name of stringtype Age = Age of inttype Email = Email of stringtype Person = { name: Name age: Age email: Email }

Now let’s also say that the Name, Age and Email types have to be valid before they can be created. For example, the name must not be blank, the age must be a positive number, and the email must contain an “@” sign.

We can enforce this by having constructors that do valida-tion, and which return an optional value: “Some” if the input is valid, but “None” if the input is not valid. Here’s some code that demonstrates this:

open System.Text.RegularExpressionsopen System// constructor that might return a Name// val name : s:string -> Name optionlet name s = if String.IsNullOrWhiteSpace(s) then None else Some (Name s)// constructor that might return an Age// val age : i:int -> Age optionlet age i = if i <= 0 then None else Some (Age i)// constructor that might return an Email// val email : s:string -> Email optionlet email s = if Regex.IsMatch(s,@"^\S+@\S+\.\S+$") then Some (Email s) else None

Here’s the problem: we want to create a valid Person, but the various inputs might be valid or not. Only if all the inputs are valid should we create the Person. How can we do this?

The imperative approach might be to do all the validations, and then if they all valid, then create a new Person with the valid values. Here’s an example of how this might look:

Page 7: Ndc magazine 1 issue

7

Scott Wlaschin is a functional programming consultant and trainer, who can be contacted at fpbridge.co.uk. He blogs about F# at fsharpforfu-nandprofit.

7

// create a new Personlet person unsafeName unsafeAge unsafeEmail = // validate each input let name = name unsafeName let age = age unsafeAge let email = email unsafeEmail if name.IsSome && age.IsSome && email.IsSome // if they are all valid then Some {name=name.Value; age=age.Value; email=email.Value} // else return None else None

Unfortunately, this code is ugly and error prone and it will only get smellier as more parameters are added.

It would be nice if we could build the Person incrementally, processing one input at a time, and abandoning it immedi-ately if we find a bad input. But the Person type is immuta-ble and must be built all-or-nothing, so we seem to be stuck.

However, there is a way to work incrementally, and the secret is to use partial application.

First, we create a function that creates the Person type in the normal way. It will assume all the inputs are valid, so it is very simple.

let person name age email = {name=name; age=age; email=email}

Because it is a function, we can build it up incrementally, processing one parameter at a time.

First we pass in the first parameter, creating a partially applied function. If the first parameter is successful, then the partially applied function will be too (e.g. Something). But if the first parameter is not successful, then the par-tially applied function will also be unsuccessful (e.g. None)

let partial1 = person (process) (name "Alice")

Next, we take the partially applied function (“partial1”) and pass in the next parameter. This time the result will be suc-cessful only if both the “partial1” and the parameter are successful, otherwise the result (“partial2”) will be unsuc-cessful.

let partial2 = partial1 (process) (age 30)

Finally, we process the last parameter. Again the result will be successful only if both the function (“partial2”) and the parameter are successful, otherwise the result will be unsuccessful.

let result = partial2 (process) (email "[email protected]")

So finally we have our result, which will be either success or failure.

Here’s the real code, with some helper functions “<^>” and “<*>” defined.

let (<^>) = Option.map let (<*>) f x = match (f,x) with | (Some f'),(Some x') -> Some (f' x') | _ -> Nonelet partial1 = person <^> name "Alice" let partial2 = partial1 <*> age 30let result = partial2 <*> email "[email protected]"

This is a bit ugly, but we can remove all the intermediate steps (partials) and put all the code together, like this:

let result = person <^> name "Alice" <*> age 30 <*> email "[email protected]"

In this case, all the inputs are valid, and the result is just as we would expect:

// Person option = // Some {name=Name "Alice";age=Age 30;// email=Email "[email protected]";}

We can also check that the error path works, by passing in invalid parameters:

// bad namelet result = person <^> name "" <*> age 30 <*> email "[email protected]" // => Person option = None// bad agelet result = person <^> name "Alice" <*> age -30 <*> email "[email protected]" // => Person option = None

In both these cases, we get the result “None”, as we would expect.

So we now have an elegant way of building an immutable type, with validation included for all parameters. Thank you, partial application!

SUMMARYIn this article we’ve looked at partial application and some of its common uses. I hope that this technique has been demystified for you somewhat, and that you can see that, far from being a trivial trick, it is the foundation for many powerful functional programming techniques.

Page 8: Ndc magazine 1 issue

8

The IDEAL programming

language

Page 9: Ndc magazine 1 issue

In this article, we will be designing and writing code to represent hands in a game of cards. However, we'll do so with a twist. Instead of relying on one of those trusty old workhorses, C# and Java, we'll use the language of our dreams: we’ll make it up as we go along, adding the features and capabilities we want. Why would we do such a thing? Well, I think that every once in a while, it's a useful exercise to fire all your tools and abstractions and start with a blank slate - have them re-apply for the job, if you like. In this article, we'll fire the programming language itself. After all, according to Wittgenstein, the limits of our language mean the limits of our world.

9

By Einar W. Høst

Let's not dwell too long with lofty philosophical issues, though - we have work to do! First, we need some way of representing a playing card. In C# or Java, we'd create a class for that. However, I prefer abstractions that carry less weight. A playing card basically just consists of two types of information: the rank and the suit. So perhaps we could write something like this:

We just made up the first concept in our ideal language: a datatype. A datatype may contain choices between things. The vertical bar is supposed to mean “or”, so a suit for instance is either Clubs or Diamonds or Hearts or Spades; similarly for rank. Numeric of int is the most succinct way I could think of to associate a card with a numeric value. A Card is associated with a tuple of suit and rank (the asterisk means “and”). An example should make things clearer. To do so, we need a way of introducing values. We'll use val. Now we can define two playing cards like this:

val c1 = Card (Diamonds, Ace)val c2 = Card (Spades, Numeric 2)

I made it really, really easy to create tuples! One of my biggest complaints about C# and Java is that it is way too cumbersome to work with simple data types like tuples and lists. It should be trivial to put them together and pull them apart, since that's sort of the bread and butter of working with data. For instance, to create a list of cards (represent-ing a hand, say), we shouldn't need to write anything more complicated than:

datatype suit = Clubs | Diamonds | Hearts | Spadesdatatype rank = Ace | King | Queen | Jack | NumericCard of intdatatype card = Card of suit * rank

val hand = [Card (Diamonds, Ace), Card (Spades, Numeric 2), Card (Hearts, Queen)]

Page 10: Ndc magazine 1 issue

10

That's it for data, at least for now. Let's add a bit of behavior - after all, data that just sits there isn't terribly interesting. For instance, say we wanted to define a function to trans-late the rank of a card into a numeric value. We could use the most fun keyword I can think of:

fun value_of card = case rank_of card of Ace => 14 | King => 13 | Queen => 12 | Jack => 11 | NumericCard x => x

Remember that I said that it should be really easy to pull tuples and lists apart as well as put them together? In an ideal language, we should be able to pull things apart based on structure and content. Here we’re looking at the struc-ture and content of the rank of the card and treating the different cases appropriately. The syntax I made up uses | to separate between cases (just as in the datatype defini-tion) and => to say what we should do in each case. It’s like a switch statement, only useful. In case the rank is Ace, the value is 14. In case it is Queen, the value is 12. For Numeric, it gets more interesting. We’re able to magically capture the number associated with the Numeric in a variable, and return that variable as the value of the card. So for Numeric 8, the value is 8, for instance. Isn’t that cool?

At this point, you might wonder about typing. Is this make-believe language statically or dynamically typed? I vote for static. There's a lot of merit to static typing, I think, but it shouldn't require all that typing if you know what I mean. So the ideal language should allow me to write the succinct code I have above, yet arrest me if I get suit and rank mixed up! I'm imagining that there is some powerful type infer-ence voodoo going on, much more potent than the meek and meager things that the C# and Java compilers do. The compiler should just look at the code and figure out what the types must be. If we try to pass in something that doesn’t match the compiler’s expectations, we should get an error - at compile time. The code shouldn’t even run.

If we really want to, though, we should be allowed to provide type annotations. In some cases it helps readability. As an example, we’ll write a function to count the number of cards with a particular rank:

fun count (r: rank) (hand: card list) = case hand of [] => 0 | (_, r')::cs' => if r = r' then 1 + count r cs' else count r cs'

Here, we’re explicitly stating that the type of r should be rank and the type of hand should be card list.

In the body of the function, we’re once again decomposing basic data structures - this time both a list and a tuple. I'm imagining there's a list operator :: that will push an element onto the front of a list. The neat thing is that it also works in reverse when used in a case expression, so that we can decompose a list into the first element and the rest of the list. The meaning of _ is “whatever” - we won’t use the value for anything. Also note that it’s fine to use variable names like r’ and cs’.

Now it should be straightforward to understand what the function does. The hand is a list of cards. The list might be empty (written []), in which case the number of cards with rank r is zero. If, however, the hand is a list consisting of at least one card, there are two possibilities: either that card has rank r or it does not. If it has rank r we count it, otherwise we ignore it. Then we proceed recursively to count the cards with the right rank in the remainder of the hand.

Next, suppose we discovered that it would be really useful to have a specific function to count the number of Queens. We could of course define a new function count_queens that would accept a list of cards, and then call the count function with Queen and the cards in the body. That would work, but I have a better idea. Let’s make our language so that functions only ever take a single parameter! Whenever someone writes two parameters in a function definition, we’ll interpret it as two functions chained together, each taking a single parame-ter. The first function takes the first parameter and produces the second function, which takes the second parameter and produces the expected output. Sounds weird? It turns out to be really neat. Now we have a general and flexible solution to the count_queens problem. Whenever we want a function explicitly for counting cards of a particular rank, we’ll just pass in the rank (and nothing more) to the count function, and our language will magically do what we want: return a func-tion that will count cards of that rank! So this is sufficient to create a function to count queens:

val count_queens = count Queen

Makes sense? Imagine trying to do that in C# or Java!

At this point, perhaps it’s time to stop dreaming and wake up to reality. Where do we stand now? We invented some pretty powerful concepts that allowed us to write very light-weight and expressive code that closely represented the domain. If you ask me, the only sad thing at this point is that it's just a dream - right? Well, you might have seen this coming: it's actually not. The dream is very much real, and actually way older than both C# and Java. It’s called ML and was invented in 1973 (which probably means it’s older than you). You could (and should!) download Standard ML, start the REPL and enter the code snippets in this article and have the code run. You’ll find that Standard ML supports all the things we made up: light-weight data types, flexible composition and decomposition of tuples and lists, pattern matching on struc-ture and content, powerful type inference, and lots of other things that we didn’t have time for. It’s an amazing language.

10

Page 11: Ndc magazine 1 issue

1111

Of course, you might argue that I’m still in dreamland. I realize you’ll have a hard time convincing your project manager or customer to use ML over C# or Java, despite of all its merits. Surely programming in ML is for mad bearded professors and functional hipsters that don’t actually have to build anything real? Yes and no. While ML might be for evenings, F# is not, and F# is the granddaughter of ML (OCaml is the language in between). This means that you can write code that uses the same concepts that I pretended to dream up in this article, and still have access to all the other tools you rely on, at least if you’re on the .NET platform. If you’re on the Java platform, you can write code in a similar style in Scala, although the lineage from ML is not as clear in that case. Nevertheless, the ideas and concepts are very much the same. So I really think you’re out of excuses - the ideal language is available on your platform, and you should use it. Why wouldn’t you?

Einar W. Høst is a developer and technical architect at Computas. In the evenings, he indulges in impractical coding projects aimed at having fun with the djinns of the computer. He holds a PhD in Computer Science from the University of Oslo and thinks ivory towers are beautiful.

© A

rtCh

i/Sh

utte

rsto

ck

Page 12: Ndc magazine 1 issue

12

Seven Questions about Seven Languages

Page 13: Ndc magazine 1 issue

13

BH: Many computer books follow the formula of "{some skill recruiters know by

name} in {programming language every recruiter knows by name}". Many computer books have a shal-low, fast-food-coder, ticket-to-dol-lars feel to them. In the first "Seven Languages" book you covered Ruby, Io, Prolog, Scala, Erlang, Clojure, and Haskell. Recruiters know about Ruby and maybe about Scala, but this is an unusual book. It has a different phi-losophy. How would you describe its philosophy?

BT: Great question!I strongly believe that the publishing industry is dying. Part of the pressure is due to the Internet. There's just so much that's instantly available and free. But part of the problem is that we have collectively lost our soul as an industry. When I start a writing pro-ject, I don't immediately ask myself what the market is likely to be. I write about what should be interesting to read.

There's another problem, though. We are used to looking for market leaders, and abandoning everything outside of the mainstream. It's a dangerous way for an industry to think. We are just now understanding that Java may not be the ideal language to solve every problem, nearly twenty years after it was invented. Seven Languages, as all of the seven-in-seven books, tells a story. We need a better set of tools for solving problems like distribution and concurrency, and some of those tools will come in the form of pro-gramming languages.

The language choices show a logical progression toward more functional thinking, and that's not an accident. You can see the overall story in the way the book is organized. One object oriented language, one prototype language, a declarative language, and

four functional languages. I think a similar story is playing out on a land-scape of problems and languages to solve them.

BH: You mentioned "dis-tribution", "concurrency", "declarative", and "func-

tional" all pretty close together. That combination of terms points me (and Google) to Erlang. Am I reading too much into that, or do you see the role of Erlang (or the Erlang VM) in our industry changing?

BT: Another great question. It's like you are reading the notes I took when forming the language list. From its role in phone switches since the late 80s, Erlang has had to solve these problems for a long time now, but it's not the only way. I think Clojure has an excellent take on distribution and con-currency. I also think pure languages like Haskell have pretty elegant takes. When there's no mutable state, both concurrency and distribution become much easier.

I do think we are going to circle back for a second look at several important problems. When all is said and done, OTP, Erlang's library for distribution of their telephony platform, is going to be recognized as one of the platforms that got the monitoring and propaga-tion of exceptions right.

In Seven More Languages, I write about Elixir, which builds on top of the Erlang virtual machine but also adds the elegant Lisp-like macros. Elixir is going to be a very important lan-guage because José Valim (creator of Elixir) gets so much right: the syntax tree, the macro system, the streaming APIs. He knows how to say "no", and that's very important for a new lan-guage. The rich syntax is going to feel right to a lot of developers looking for metaprogramming with macros.

In this interview Bruce Tate (author of Seven Languages in Seven Weeks) fields questions from Bryan Hunter (CTO of Firefly Logic).

©lo

lloj/

Shut

ters

tock

Page 14: Ndc magazine 1 issue

14

BH: In the first book the big surprise for me was the inclusion of the logic

programming language Prolog. The family of declarative languages includes the logic languages and the functional languages. When this clicked, I realized you were playing a much longer game than “beat up on Java”. The declarative versus imper-ative question goes back to genesis of computer science with Church and Turing in the 1930s, through the AI battles between Stanford and MIT in the late 60s, and continues today with OO versus FP. With the inclusion of core.logic in the second book you reemphasize logic programming. FP prepares us for the future regard-ing concurrency and distribution, but what looming problem does logic pro-gramming address?

BT: Prolog, for me, accomplished three goals. First, we were trying to tell a story with a progression of languages. Prolog helped me step into functional programming because it was so close to Erlang and because it was declara-tive, like the functional languages in the book. Second, Prolog let me intro-duce a new programming model, and one that was not represented in the book. Finally, in the Seven Languages series, we try to get a typical devel-oper out of her comfort zone. Prolog was an outstanding candidate for doing so. You can't solve problems in the traditional way. You have to adapt to the language, or fail.

Core.logic is similar, I think. It's a new programming model, because when you mix logic programming with FP, magical things happen. Even func-tional programmers and logic pro-grammers will have to stretch a little bit, and that's a great thing.

As to the problem it will solve, I don't know! Maybe tying logic languages to more general-purpose languages will open up the possibilities. But with Mini Kanren, the foundation of core.logic, there's some new strange and wonderful stuff going on. I can't wait to see where it takes us.

BH: Another group of declarative languages that have good distribution and

concurrency stories are the dataflow

languages. I've worked with one of them called Pure Data, and it's pretty amazing. I'm curious if you considered Pure Data for the second book? Actu-ally what languages are in the second book? Most of your readers will have a pet language that wasn't included, would you walk us through your (cruel) process?

BT: The languages in Seven More Lan-guages are Factor, core.logic, Elm, Agda, Elixir, Julia, and Lua. Our pro-cess is a little complicated. We try to tell a story with the series. First, we decide on a narrative. Then, we decide what languages tell the story we want to tell. Usually, that process means we leave out some great choices.

Pure data is completely new to me! We touch on reactive and data flow concepts with Elm. It's a Haskell-like implementation that represents the stuff that you'd typically handle with callbacks or mutable state with functions and signals. It's a beautiful abstraction, and one that blew my mind. Each chapter attacks a nontriv-ial problem. I chose to attack a game. It came in at under 200 lines of code, which was wildly productive.

But I'll have to check out Pure Data. Seven languages three, anyone? :)

BH: Yes, please!So Elm is a Haskell-inspired functional programming

language for GUIs that compiles to JavaScript and runs in the browser. There is also ClojureScript, Coffee-Script, FunScript, and over 350 other languages that compile to JavaScript. So much effort is being spent hiding JavaScript. In 2009 Scott Hanselman described JavaScript as the Assembly language of the web. Douglas Crock-ford said JavaScript "has become a tragically important language, and we’re going to be stuck with it for a time”. Given all that, why would some-one choose to write JavaScript on the server? How do you explain the popu-larity of Node.js?

BT: I think JavaScript is getting a resurgence for two big reasons. First, it is the one native language on the browser. That's a tremendous advan-tage for a language. Second, it's not Java. It has some elements of many

different languages and even pro-gramming models. Node is popular because JavaScript is popular and it's much better than some of the alterna-tives.

In Seven Web Frameworks, we talk about the increasing proliferation of real components on the browser, and also the movement toward functional languages on the server. We attack one traditional framework, two JavaS-cript frameworks, and four functional ones. It turns out that functional pro-gramming is just a better abstraction for server-side web programming. I mean, we're just dealing with a set of functional transformations. Elm on the client side, or something like it, is inevitable for the same reasons. JavaScript is OK, but there are just better alternatives out there. JavaS-cript is a lot like Java in that regard. It's everywhere, and has been good for its time, but eventually the complexity will catch up.

BH: Ryan Dahl the creator of Node.js said, "We should not be supporting more

programming languages. We should be killing them.” While your fans would disagree with that sentiment, many businesses seem to agree with it. Standardization and consolidation have been business obsessions since Frederick Taylor. How do we make a business case for diversity of lan-guages? How do we best address their fear?

BT: I am not trying to make a political statement with the Seven in Seven line at all. I am making a learning statement. We are better program-mers when we know more. Learning languages makes you smarter. Learn-ing databases, web frameworks, con-currency models, and the like makes you smarter too. We need more pro-grammers with a broader perspective.

But a funny thing has happened. As people actually use those languages, more and more of them are actually finding that they like them, and are implementing systems that are saving their companies time and money. And their bosses are learning that they actually like money and success. I've come to understand that the time and money you save when you’re solving

V

Page 15: Ndc magazine 1 issue

15

a problem with the right tool trumps just about every other concern, within reason, of course.

BH: In these books you are doing for program-ming languages what Alan

Lomax did for American folk music. In this research you’ve undoubtedly learned a ton that you couldn't fit into the formal constraints of the books themselves. What unpublished gem would you most like to pass along? What would you most like us to go out and learn?

BT: That's a great analogy! I'm not sure I deserve the praise. I guess I'll wrap up with a story. A few months ago, I met José Valim at a conference. I told him that I admired his work and hoped to make as big an impact on our indus-try as he has. He laughed and told me that the three influences on his lan-guage were Ruby (which he already knew) for the rich syntax, Erlang for its concurrency and distribution

models, and Clojure for its macros. I laughed back and told him that I cov-ered both of those languages in Seven Languages. He looked at me pointedly and said, "I know. Seven Languages was where I learned Erlang and Clo-jure." So my book was the inspiration for Elixir. I was stunned. I barely knew either language when I wrote those chapters.

You see, I think Elixir is going to be a great language and a tremendously important one. I admire José tremen-dously. It's not quite what you were asking for, but my hidden gem is this. Be bold enough to explore, and bolder still when you share your experience with the world. When you do, great things can happen.

Bryan Hunter is a geek, a Microsoft MVP in C#, a partner at Firefl y Logic, and the founder of Nashville Functional Programmers.

Bruce Tate is Author of Seven Languages in Seven Weeks, Deploying Rails Applications, From Java to Ruby, Rails: Up and Running, Beyond Java, 6 others.

© c

ompl

ot/S

hutt

erst

ock

V 5

Page 16: Ndc magazine 1 issue

ndcoslo.com@NDC_conferences #ndcoslo

We are proud to present the seventh NDC Thanks to our inspiring partners who make it happen!

For information about partnership deals, please contact:

[email protected]

tel.: +47 93 41 03 57 Become a partner today!

Inspiring Developers

SINCE 2008

Your logo here

Page 17: Ndc magazine 1 issue

ndcoslo.com@NDC_conferences #ndcoslo

We are proud to present the seventh NDC Thanks to our inspiring partners who make it happen!

For information about partnership deals, please contact:

[email protected]

tel.: +47 93 41 03 57 Become a partner today!

Inspiring Developers

SINCE 2008

Your logo here

Page 18: Ndc magazine 1 issue

18

N-layered architectures bring value through decoupling, but they come at a price. Computers are binary and our abstractions can slow things down. We will look at a typical n-layered ASP.NET Web API application for the special case of n = 0, where data is just a binary stream all the way from the database to the browser.

By Bjørn Einar Bjartnes

0-layered architecture

Page 19: Ndc magazine 1 issue

19

© C

arlo

s C

asti

lla/S

hutt

erst

ock

WHY?To respond fast when clients are asking for large amounts of data you can't wait for entire objects to finish loading before you respond, just as you don't wait for the entire movie to download when watching it online. As battle-hardened Enterprise developers we are used to working with humongous datasets, and as our users have been spoiled with the performance of modern web applications, we are challenged to deliver more data faster.

In this article we will look at techniques on how to stream data from SQL Server to clients using .NET Web API. We will see that in freeing us from the shackles of traditional layered architectures we can drastically reduce latency and memory footprint.

Page 20: Ndc magazine 1 issue

20

STREAMS IN C#Streams are sequences of data made available over time. Streams can be visu-alized as a conveyor belt that makes data available in ordered chunks. Rather than waiting until the entire batch is produced, streams will emit a chunk of the sequence as soon as it is ready. This can be useful for many reasons. Streams require less resources for storage, as they do not store the whole batch before moving on to the next processing step. In computer terms this means less memory usage, for example by chunking up a file and sending it in pieces as opposed to reading the entire file into memory. Latency is also reduced as data can be sent before as soon as the first chunk is available. For example, the database can start sending data before it has read the entire dataset - through a webserver and to a browser - before it has finished reading all data.

NON-STREAMING SOLUTIONSTo begin, let us compare a typical streaming approach with a non-streaming one. We will write a .NET Web API controller that returns the content of a file. The program will read the entire file into memory and then return it to the client.

[Route("")]public HttpResponseMessage GetResult(){ var result = File.ReadAllText(@"C:\data\SwissProt.xml"); var response = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(result) }; response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/xml"); return response;}

Figure 1 - Returning a file as a string. https://gist.github.com/bjartwolf/8536940

We have to hold the entire file loaded in memory until the request is disposed. Now, if the file is small, reading the entire file shouldn’t really be of much concern. However, if the file is large, we have to hold the entire object in memory until the client has finished downloading. In a typical .NET Web API solution where we seri-alize an object to the format desired by the client, we have to hold the C# objects in memory until the request is disposed. We will also typically wait for the entire object to be read from the database until we start serializing, paying a latency cost.

STREAMING SOLUTIONSInstead of reading the entire file, let us just open a FileStream from the file and directly insert that as streaming content instead of string content. In C# we find the magic streams in the Stream Class in the System.IO namespace. This solution will send chunks of the file to the client, buffering only what it needs in memory.

[Route("")]public HttpResponseMessage GetResult(){ var fs = new FileStream(@"C:\data\medline13n0701.xml"), FileMode.Open); var response = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StreamContent(fs) }; response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/xml"); return response;}

https://gist.github.com/bjartwolf/8580339

Page 21: Ndc magazine 1 issue

21

A ZIP-HACKModern web clients all understand gzip. Gzip can zip and unzip data in a streaming fashion. All the data is still just a binary stream, all we have to do to make this work is gzip the file before we store it on disk and tell the web client that the response is gzipped through the Content-Encoding header. XML and JSON benefits greatly from compressions, in my examples data is compressed by almost a factor of ten when gzipped.

[Route("")]public HttpResponseMessage GetResult(){ var fs = new FileStream(@"C:\data\medline13n0701.xml.gz"), FileMode.Open); var response = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StreamContent(fs) }; response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/xml"); response.Content.Headers.ContentEncoding.Add("gzip"); return response;}

https://gist.github.com/bjartwolf/8537113

CACHINGThis is just cache, you might say? Yes, it really is just a cache. But it is optimized for when you need detailed control of your data and you have to cache large files. You can still do everything else, such as authentication and authorization and logging using the same techniques, as in the rest of your ASP.NET Web API solution.

WHAT ABOUT THE REAL WORLD?The toy-examples above are certainly not ready for the enterprise. However, there are techniques for streaming content from SQL Server and also for having SQL Server storing content as files on disk through SQL Server FILESTREAM. I hope to be able to present these techniques to you at NDC Oslo 2014, but if you are impatient the code can be found at https://github.com/bjartwolf/SqlFileStreamWebApiDemo

MORE INFO:http://blog.bjartwolf.com/?p=2002http://vimeo.com/68236538https://github.com/bjartwolf/FileStreamWebApiDemohttp://download.red-gate.com/ebooks/SQL/Art_of _SS_Filestream_Sebastian_and_Aelterman.pdf

Bjørn Einar is a developer with Computas AS where he works with SharePoint solutions for the petro-leum industry. You'll also find him coding for fun in the Computas Lambda Club and tinkering with R/C cars and drones.

Page 22: Ndc magazine 1 issue

22

Reactive programming has become quite a buzzword lately. There has been much talk around the Microsoft Rx extensions for .NET, as well as the var-ious JavaScript Reactive frameworks (Knockout.js, RxJs, etc.) and there are even a few new languages which focus specifically on the functional reactive programming style – Elm and REScala, amongst others.

By Rachel Reese

Page 23: Ndc magazine 1 issue

Before we jump into any code, let’s define and contrast a couple terms.

Reactive: This simply refers to a UI that is capable of auto-matically responding to information that has changed, either externally, or from another part of the app. For exam-ple, consider a form that only enables the submit button after the required information has been filled in. The code monitors each required field for an event such as OnKeyUp or LostFocus. The event handler then contains the logic to perform the necessary checks for all information and, if these checks pass, the submit button is enabled. A few simple lines of code can prevent the frustration of hitting

submit, just to receive errors on the user’s end. The entire experience becomes more fluid for the user.

Responsive: Capital-R responsive often refers to “Respon-sive Web Design,” which is an entirely separate paradigm, generally focusing on a web site UI design that is able to handle many different devices and viewing sizes. Dur-ing the course of this article, I will instead be referring to lowercase-r “responsive,” meaning more literally, “responds quickly.” For example, a properly responsive application should be careful about running computations on the main UI thread. When this thread is occupied, the application will appear to freeze, resulting in a poor user experience.

23

© Ig

or P

etro

vic/

Shut

ters

tock

Creating Responsive UIs

with F#

Page 24: Ndc magazine 1 issue

24

A REACTIVE UI IN WPF USING EVENTSLet’s start by looking at the most common way of creating responsive applications: through a combination of binding to properties and subscribing to events. This works well for simple cases, but will not give us a good way to offload heavy processing work to a background thread. Later, in the second part of this article, we’ll refactor this solution to use F# async workflows, but for now, we’ll start with an application that just uses binding and events. When it is run, the user is able to enter text into the top textbox and, automatically, it is color-coded into vowels and consonants. There’s an additional option to set ‘w’ and ‘y’ as vowels. Checking either checkbox automatically re-colors the text in the Formatted textbox.

SETTING UP THE UI BINDINGSThe behavior of the two checkboxes was very straightforward logic to set up. Both contain a simple two-way binding in the XAML.

<CheckBox Grid.Column="1" Grid.Row="0" VerticalAlignment="Center"HorizontalAlignment="Center" IsChecked="{Binding Path=IsWVowel, Mode=TwoWay}"/>

This is connected to a fully-backed property in the ViewModel, so that more details may be added. In this case, a call to OnPropertyChanged for the property is added, which handles the INotifyPropertyChanged setup. Just like the checkboxes, the UnformattedText textbox also uses a very similar fully-backed property with the OnPropertyChanged event, but is not bound in the XAML.

type FormatTextViewModel() =

// lots of things omitted let propChanged = Event<PropertyChangedEventHandler,PropertyChangedEventArgs>() member this.IsWVowel with get() = isWvowel and set value = isWvowel <- value this.OnPropertyChanged("IsWVowel")

// lots more things omitted

member this.OnPropertyChanged(name) = propChanged.Trigger(this, new PropertyChangedEventArgs(name))

[<CLIEvent>] member this.PropertyChanged = propChanged.Publish

interface INotifyPropertyChanged with [<CLIEvent>] member this.PropertyChanged = this.PropertyChanged

Page 25: Ndc magazine 1 issue

2525

SETTING UP THE EVENT HANDLERSIn addition to publishing the PropertyChanged event, the UnformattedText textbox obtains knowledge of each new character by checking for the KeyUp event in the textbox, and then setting the property in the ViewModel to the current value of the textbox text. This happens in the app.fs module, as part of the loadWindow method.

Also contained in the loadWindow method is the event handler for the Proper-tyChanged events, which updates the text for the FormattedTextBox. Because that textbox is read-only, there is no backing property, just a call to the GetFormatted-Text method. This is called when any of the properties change, because all three affect the final output of the FormattedTextBox.

let loadWindow() = _viewModel.PropertyChanged |> Event.add (fun _ -> window.FormattedTextBox.Document <- _viewModel.GetFormattedText)

window.UnformattedTextBox.KeyUp.Add(fun _ -> _viewModel.Text <- window.UnformattedTextBox.Text)

IMPLEMENTING THE TEXT FORMATTINGThis GetFormattedText method is the heart of the application. First, it checks the incoming string of text for vowels via the CheckForVowels method in the applica-tion’s Model. let private isVowel isWvowel isYvowel character = let isV = match character with | 'a' | 'e' | 'i' | 'o' | 'u' | 'A' | 'E' | 'I' | 'O' | 'U'-> true | 'w' | 'W' when isWvowel -> true | 'y' | 'Y' when isYvowel -> true | _ -> false (character, isV) let CheckForVowels isWvowel isYvowel text = Array.map (isVowel isWvowel isYvowel) text

Then, that information is sent to the BuildDocument and associated ConvertText methods, which create a new instance of the Run class for each character, color the text appropriately, and then add all of them to a new FlowDocument. The Format-tedTextBox then takes the new FlowDocument as its text property.

If you are new to the RichTextBox in WPF, the Run class works very much like an html <span> tag to format small sections of inline text (in our case, a single character) without adding additional spacing. These Runs must be added to a paragraph, which creates a full block of text (i.e., not inline). The paragraph may then be added to the FlowDocument is one of the top-level elements that gather text into a document for displaying. Specifically, it allows dynamic reformatting for different content sizes – in other words, for a Responsive (capital-R) design, use a FlowDocument.

Page 26: Ndc magazine 1 issue

let ConvertCharacter unformattedText = let character, isv = unformattedText let fg = if isv then Brushes.OrangeRed else Brushes.DarkSlateGray let run = new Run(character.ToString(), Foreground = fg) run

let BuildDocument (unformattedText:(char*bool)[]) = let fd = new FlowDocument() let par = new Paragraph() unformattedText |> Array.map ConvertCharacter |> par.Inlines.AddRange fd.Blocks.Add(par) fd

member this.GetFormattedText = BuildDocument <| FormatTextModel.CheckForVowels this.IsWVowel this.IsYVowel (this.Text.ToString().ToCharArray())

The main issue surrounding this example is that all the computation is happening on the main UI thread. With very short computations this is easily tolerated, but if these were longer, more complicated computations, the UI would be blocked and frozen until the computation completed its work. For example, adding in a Thread.Sleep(500) into the CheckForVowels method in the Model causes the UI to hang quite frustratingly. This makes this UI still reactive, but most definitely not responsive.

REFACTORING FOR A RESPONSIVE, NON-BLOCKING UI IN WPF USING ASYNC WORKFLOWSTo solve the problem of long computations blocking the UI, we look to async work-flows. We simply need to asynchronously off-load the heavy processing to another thread. When the processing is complete, the updates return, and the UI is reactively updated. To do this, we only need modify a few methods. Starting in the Model, we must transform the CheckForVowels method to an asynchronous method. We specifically want to block the thread in this instance (to simulate heavy work), so we leave Thread.Sleep here. If we had just wanted to delay the computation without blocking, we would have waited asynchronously, using Async.Sleep.

let CheckForVowels isWvowel isYvowel text = async { Thread.Sleep(500) return Array.map (isVowel isWvowel isYvowel) text }

Next, since we call the CheckForVowels method from the GetFormattedText method, we must also update it to an asynchronous method. We also asynchronously call the Async.StartChild method, assigning the started token to textArray_async. Then, to insure we explicitly wait for the completed computation, we assign textArray_async to textArray before returning the value. The two-step protocol would allow us, in a larger application, to start several async computations in the background at once, before checking whether any were complete.

member this.GetFormattedText = async { let! textArray_async = Async.StartChild(FormatTextModel.CheckForVowels this.IsWVowel this.IsYVowel (this.UnformattedText.ToString().ToCharArray())) let! textArray = textArray_async return BuildDocument textArray}

26

Page 27: Ndc magazine 1 issue

Finally, there are major changes to the App.fs module. Both events are refactored out of the loadWindow method into their own async methods, which loop and use the Async.AwaitObservable method to watch for the events published from the view model. Both otherwise update the same respective information as before.

let loadWindow() = window.Root.DataContext <- _viewModel window.Root

let OriginalTextLoop() = async { while true do let! keyup = Async.AwaitObservable(window.UnformattedTextBox.KeyUp) _viewModel.UnformattedText <- window.UnformattedTextBox.Text }

let FormattedTextLoop() = async { while true do let! formattedTextChanged = Async.AwaitObservable(_viewModel.PropertyChanged) let! fd = _viewModel.GetFormattedText window.FormattedTextBox.Document <- fd }

We also must start the loops before we show the window. We do this with a call to Async.StartImediate.

Async.StartImmediate(OriginalTextLoop()) Async.StartImmediate(FormattedTextLoop())

Once we’ve refactored our original project to add these few changes, we’re able to type freely in the UnformattedTextBox without the potentially heavy processing in the Model interfering with the UI.

CONCLUSIONIt’s straightforward and simple to create responsive, reactive UIs with F#, as events are first-class values, and we are able to easily pass them around without creating IObservable<T> by hand. Consider the use above of Event.Add. It is just a normal function that takes an event as a parameter. When we also use Async workflows, the solution becomes particularly elegant. Async.StartImmediate will ensure that all non-background work is run on the UI thread, meaning you are able to access UI elements in your async block, which will free you from worrying about dispatchers.

You can view the full source code here:https://github.com/rachelreese/Articles/tree/master/The%20Developer%20-%20NDC%20-%20Feb%202014

Rachel Reese is a long-time software engineer and math geek who has recently relocated to Nashville, TN to work with the fabulous folks at Firefly Logic, as well as to be a part of the Nashville functional programming scene. She currently helps run the Nashville Xamarin user group, @NashXam. She previously ran the Burlington, VT functional programming user group, @VTFun, which was a constant source of inspiration to her, and at which she often spoke on F#. She's also an ASPInsider, an F# MVP, a community enthusiast, one of the founding @lambdaladies, and a Rachii. You can find her on twitter, @rachelreese, or on her blog: rachelree.se

2727

Page 28: Ndc magazine 1 issue

28

Having spent my whole career on imperative programming, what fascinates me most about functional programming is how much the declarative mind-set differs from that of the imperative. Being a sub paradigm of declarative programming, the mind-boggling lambda expressions and recursive func-tions of functional programming may seem quite intimidating.

By Karoline Klever

Understanding programming paradigms

Page 29: Ndc magazine 1 issue

In this article, I will compare impera-tive and declarative programming, see how functional programming connects to these two paradigms, and give you a short overview of a study done on combining several programming para-digms in a project.

A COMPARISON OF IMPERATIVE AND DECLARATIVE PROGRAMMING In imperative programming, you describe to the computer exactly how you want it to do whatever it is that you want done. In declarative programming, however, you describe what you want done, without specify-

ing how the computer should do it. For example, imagine you want your friend to make you Spaghetti Bolognese. The imperative way would be to give him a recipe, telling him exactly how you want him to make it. The declarative way, however, would be to just say “make me some Spaghetti Bolognese”,

29

© a

gsan

drew

/ Shu

tter

stoc

k

Page 30: Ndc magazine 1 issue

30

and then let him decide for himself how to cook it. In either case, the end result should be you eating Spaghetti Bolognese.

So in imperative programming, you write the “recipe” for your program and you also decide the flow of your pro-gram by using control structures such as if-then-else, continue, return, loops etc. This means that you’re in charge of the execution order of your program. You tell the computer that you want A to run before B; you want the onions to fry before adding the meat.

The declarative paradigm doesn’t allow this, since the order of execution is out of your hands. The computer may decide to rearrange your program or run your tasks in parallel if that’s deemed to be the most efficient way of running your code. If you’re used to the imperative mindset, not knowing the execution order of your program can be quite confusing, it can feel like you’re not entirely in control. Keep in mind that that’s the point though: The computer eliminates risk by excluding you from the program flow decision making. Instead, you only need to focus on the main logic of your program.

COMBINING MULTIPLE PROGRAMMING PARADIGMSAs mentioned earlier, functional programming is a sub paradigm of declarative programming. Some func-tional languages are purely declara-tive (such as Haskell, Lisp and Erlang), but this is not the case for all func-tional languages. Take Scala and F# for example - both of these integrate functional programming with impera-tive, object oriented programming, enabling the developer to choose to which extent their programming technique should be functional or imperative.

A study titled “On the Benefits of Combining Functional and Impera-tive Programming for Multicore Soft-ware” [1] investigates how developers can combine several programming paradigms in a project and how this affects the end result. The study was conducted on thirteen subjects who all went through the same training in Scala and Java, after which they were split into two groups. Each group was given an individual four-week project

building a complex parallel application – subjects in one group programming in Java, and the others using Scala. After finishing the initial assignment, subjects were asked to do the same project over again - but this time in the other language. Reuse of code and sharing among the project groups was, of course, forbidden. Throughout the study, the subjects were inter-viewed, their code was reviewed and their progress was tracked daily.

As Scala is a multi-paradigm program-ming language, it is quite interesting to see how the subjects combined functional and imperative program-ming in practice. The study concluded:

“8 subjects use more than 50% imperative style […] and 5 use more than 50% functional style. At the extremes, one subject uses 98% imperative style and one subject 78% functional style. […] No subject entirely rejects either style […]”

These results demonstrate that many of the test subjects balanced the use of imperative and functional styles quite well. As expected, the use of functional style was slightly higher in parallel programs than in sequen-tial programs. Comparing the choice of programming style to the perfor-mance of the programs reveals that the top three performing programs all combined functional and imperative programming to a significant degree.This study is one of the few done on combining programming paradigms, as research into this field has been limited. But as the list of multi-para-digm languages continues to grow, the need for developers to understand the impact of combining programming paradigms grows with it.

UNDERSTANDING YOUR OWN PROGRAMMING LANGUAGEThe difference between imperative and declarative programming is quite clear; in imperative programming you tell the computer how you want things done, while in declarative program-ming you tell the computer what you want to achieve. Not all developers know which paradigm their program-ming language belongs to though, and the answer is not always straight forward.

Take C#, for instance - you might think it’s strictly imperative, but it actually contains declarative features, such as LINQ. Taking a closer look at your cho-sen programming language and under-standing the paradigms it’s based on will make you better equipped to take advantage of its strong points and avoiding its pitfalls.

[1] Pankratius, Victor, Felix Schmidt, and Gilda Garretòn. On the Benefits of Combining Functional and Imper-ative Programming for Multicore Software. Karlsruher Institut Für Technologie, 2011.

Karoline Klever is a developer and consultant working at Epinova, where she mainly focuses on EPiServer and Microsoft Dynamics CRM integrations. She is a Microsoft Certified Solution Developer and has a passion for web development.

Page 31: Ndc magazine 1 issue

Mik

e C

ohn

Geo

ff W

atts

ScrumMaster - Geoff Watts2 days: 22. April

Certified ScrumMaster - CSM - Mike Cohn2 days: 02. June

Certified Scrum Product Owner - CSPO - Mike Cohn2 days: 04. June

BECOME A CERTIFIED SCRUMMASTER OR A PRODUCT OWNER

For complete course descriptions, time and place, visit www.programutvikling.no

Programming in Functional StyleWith Venkat Subramaniam

This three day course, offered by award winning author and trainer Venkat Subramaniam, will get you programming in functional programming. This course is not a theory of why this is a good idea, but a practical deep dive into the key aspects of functional programming. It will help you learn why, what, and exactly how to make use of this. Venkat is known for being a polyglot programmer and will demonstrate the functional style of programming in languages that the attendees use at their work each day.

Java 8With Venkat Subramaniam

With the introduction of lambda expressions and method references in Java 8, we can now make use of functional style of programming. This course is designed, by author of the first book on Java 8 to hit the market, to help you make a quick and effective transition to Java 8 and its functional capabilities.

Scalable design and implementation using C++With Andrei Alexandrescu

This course teaches advanced topics in designing and implementing large, scalable systems using C++11. Performance and system-wide robustness are primary concerns. New features of C++11 (and idioms they enable) that help reduce boilerplate and make complex system implementations are introduced.

Page 32: Ndc magazine 1 issue

32

Every eighteen months during the last thirty years has seen the power of the computer that can be built on a silicon chip double – this has now come to a halt. Instead, chip manufacturers build multiple computers – or cores – on each chip: nearly all PCs are now ‘dual’ or ‘quad’ core, and the number of cores it is possible to put on each chip is growing exponentially.

By Natalia Chechina and Phil Trinder

The RELEASE Project

Page 33: Ndc magazine 1 issue

KEY INNOVATION Building software for these multicore systems requires radically new soft-ware development technologies that can exploit the platform. Instead of programming a single core, the cores have to be programmed to work together in a coordinated way, and in a way that scales with the numbers of cores. Many expect 100,000-core platforms to become commonplace, and the best predictions are that core failures on such an architecture will be common, perhaps one an hour. Hence we require a programming model that is not only highly scalable but also reliable.

The RELEASE project develops the first a scalable concurrency-oriented programming infrastructure and its associated tool set, and hence aims to reduce development times of multicore solutions while delivering increased reliability.

TECHNICAL APPROACHOur platform builds on the Erlang language and Open Telecom Platform (OTP) libraries. Erlang[1] is a functional programming language. Its concur-rency-oriented programming para-digm is novel in being very high level, predominantly stateless, and having both parallelism and reliability built-in rather than added-on. Some of the principles of the Erlang philosophy are as follows. Share nothing implies that isolated processes do not share memory and variables are not reus-able, i.e. once a value is assigned it cannot be changed. Let it crush is a non-defensive approach that lets fail-ing processes to crash, and then other processes detect and fix the problem. Erlang/OTP has inherently scalable computation and reliability models, but in practice at the beginning of the RELASE project scalability was con-strained by aspects of the language, Virtual Machine (VM) and toolset.

The RELEASE consortium attacks these problems at three levels:

• We evolve the Erlang VM – which implements Erlang on each core – so that it can work effectively in large-scale multicore systems.

33

© k

IRr/

Shut

ters

tock

Page 34: Ndc magazine 1 issue

34

• We also evolve the language to Scalable Distributed (SD) Erlang, and adapt the OTP framework to provide constructs to control how computations are spread across multicore platforms, and coordi-nation patterns to allow SD Erlang to effectively describe computa-tions on large platforms, while pre-serving performance portability.

• On top of the language and the VM we develop a scalable Erlang infra-structure to integrate multiple, het-erogeneous clusters.

To exploit such large platforms, programmers need to be able to understand how their programs are behaving in practice. We build online SD Erlang monitoring and visualiza-tion tools to enable programmers to profile and visualize their SD Erlang applications; to refactor Erlang pro-grams to run scalably and efficiently under SD Erlang; and to debug SD Erlang systems.

DEMONSTRATION AND USEWe demonstrate the effectiveness of the RELEASE approach in two case studies. EDF will port the Sim-Diasca simulation framework[2] to SD Erlang on the Blue Gene parallel computing platform. Sim-Diasca (SIMulation of DIscrete systems of All SCAles) is a distributed engine for large scale discrete simulations implemented in Erlang. The engine is able to handle more than one million relatively com-plex model instances using a hundred of cores.

In an example of commercial use, Erlang Solutions has developed a deployment and management infrastructure Wom-bat[3] to exploit multiple heterogeneous cluster and cloud resources. SCIENTIFIC, ECONOMIC AND SOCIETAL IMPACTThe presence of major European industrial players such as Ericsson and EDF in the consortium enables rapid commercialisation of the pro-

ject outputs, enhancing European competitiveness in the software development market and ultimately leading to new high technology jobs in Europe. The Erlang Solutions SME will gain additional revenues from mar-keting deployment and management infrastructure Wombat developed in the project. Ericsson exploits the new technology in new products and to move existing products to emerging hardware platforms to maintain their competitive position. EDF is working on simulation of smart energy grids using the Sim-Diasca simulation engine to model times more accu-rately than the previous version, lead-ing to more efficient electricity supply and potentially to lower energy costs.

KEY ACHIEVEMENTS TO DATE• To improve the scalability of the

Erlang VM we have made five important changes and architec-tural improvements that have been included in the Erlang/OTP release R16B03[4]. A prototype ver-sion of a sharing-preserving vari-ant of the Erlang VM has also been developed and is currently being tested for inclusion into March 2013 Erlang/OTP release R17.

• To improve language-level scalabil-ity we have implemented a reliable s_group library. The implementa-tion is validated by giving an oper-ational semantics and validating the semantics against the library using QuickCheck[5]. SD Erlang is open source and available from[6].

• We have produced a deployment and management infrastructure Wombat for exploiting multiple heterogene-ous clusters/cloud resources.

• We have developed, improved, and made open source releases at http://www.release-project.eu/ of five concurrency tools: two online/offline profiling tools, i.e. Persept2[7] and DTrace/System-Tap, a prototype visualisation tool[8], the extended refactoring tool Wrangler[9], and the concurrency error detection tool Concuerror[10].

• As a case study we have adapted Sim-Diasca, a substantial distrib-uted Erlang Simulation engine, to be reliable and more scalable.

Future plans include further concur-rency improvements to the Erlang VM; deployment and evaluation of the tools at scale; for SD Erlang to become a part of standard Erlang OTP library, and performance evaluation of the scalable infrastructure on an IBM Blue Gene/Q.

ACKNOWLEDGEMENTSWe would like to thank all our RELEASE colleagues. This work is supported by the European Union grant RII3-CT-2005-026133 'SCI-Ence: Symbolic Computing Infrastruc-ture in Europe', IST-2011-287510 'RELEASE: A High-Level Paradigm for Reliable Large-scale Server Soft-ware', and by the UK's Engineering and Physical Sciences Research Council grant EP/G055181/1 'HPC-GAP: High Performance Computational Algebra and Discrete Mathematics'.

PROJECT PARTNERS COUNTRY

University of Glasgow UK

Heriot-Watt University UK

University of Kent UK

Erlang Solutions Ltd UK

Ericsson AB Sweden

Institute of Communication and Computer Systems

Greece

Electricité de France SA (EDF) France

Uppsala Universitet Sweden

Page 35: Ndc magazine 1 issue

35

GENERAL PROJECT INFORMATIONProject coordinator: Glasgow UniversityContact person: Phil TrinderSchool of Computing Science, University of GlasgowG12 8QQ Glasgow, United KingdomTel: +44 141 3303627 Fax: +44 141 [email protected] Project website: www.release-project.eu Community contribution to the project: 2,400,000 EuroProject start date: 01.10.2011Duration: 36 months

BIBLIOGRAPHY[1] F. Cesarini and S. Thompson, Erlang Programming: A Concurrent Approach to Software Development, O'Reilly Media Inc., 2009, 1st edition.

[2] “Sim-Diasca,” EDF, [Online]. Avail-able: http://researchers.edf.com/software/sim-diasca-80704.html. [Accessed 2014].

[3] “D6.3 Distributed Erlang Com-ponent Ontology,” Erlang Solutions Ltd, http://www.release-project.eu/, 2013.

[4] “OTP R16B03-1,” Ericsson Com-puter Science Laboratory, [Online]. Available: http://www.erlang.org/download.html. [Accessed 2014].

[5] “QuickCheck,” QuviQ, [Online]. Available: http://www.quviq.com/index.html. [Accessed 2014].

[6] “release-project/otp,” RELEASE project, [Online]. Available: https://github.com/release-project/otp/tree/dev. [Accessed 2014].

[7] H. Li and S. Thompson, “Multicore Profiling for Erlang Programs Using Percept2,” in Twelfth ACM SIGPLAN Erlang Workshop, pp. 33-42. ACM Press, Boston, USA, 2013.

[8] S. Thompson, R. Baker, P. Rodgers and H. Li, “Multi-level Visualization of Concurrent and Distributed Computa-tion in Erlang,” in 19th International Conference on Distributed Multime-dia Systems (DMS 2013), Brighton, UK, 2013.

[9] Wrangler Refactoring Tool" H. Li, S. Thompson [Online]. Available: http://www.cs.kent.ac.uk/projects/wran-gler/Wrangler/Home.html [Accessed 2014]

[10] M. Christakis, A. Gotovos and K. Sagonas, “Systematic Testing for Detecting Concurrency Errors in Erlang Programs,” in Sixth IEEE Inter-national Conference on Software Testing, Verification and Validation, pp. 154—163. IEEE Computer Soci-ety, Luxemburg, 2013.

Phil Trinder is a Professor at Glasgow University, and is a principle investigator of the RELEASE project. He is mainly interested in how to better exploit multi- and many-core machines, Clouds, High Performance Computers (HPC), and other platforms.

Natalia Chechina is a postdoctoral research associate at Glasgow University in the RELEASE project.

© k

IRr/

Shut

ters

tock

Page 36: Ndc magazine 1 issue

Ticket types Price

All Access Pass (Workshops + Conference) NOK 18500 3 Day Conference Pass NOK 11500 2 Day Conference Pass NOK 10000 1 Day Conference Pass NOK 8500 2 Day Pre-Conference Workshop Pass NOK 9800 1 Day Pre-Conference Workshop Pass NOK 6800 25% VAT will be added to all ticket types.

mix and match

be inspiredsign up now!

Get all access to a whole week of inspirationor mix and match as you like

Inspiring Developers

SINCE 2008

Keynote: Luke Wroblewski (US)

2 DAYS OF WORKSHOPS3 DAYS OF CONFERENCE TALKS

Oslo Spektrum

ndcoslo.com@NDC_conferences #ndcoslo

Page 37: Ndc magazine 1 issue

Ticket types Price

All Access Pass (Workshops + Conference) NOK 18500 3 Day Conference Pass NOK 11500 2 Day Conference Pass NOK 10000 1 Day Conference Pass NOK 8500 2 Day Pre-Conference Workshop Pass NOK 9800 1 Day Pre-Conference Workshop Pass NOK 6800 25% VAT will be added to all ticket types.

mix and match

be inspiredsign up now!

Get all access to a whole week of inspirationor mix and match as you like

Inspiring Developers

SINCE 2008

Keynote: Luke Wroblewski (US)

2 DAYS OF WORKSHOPS3 DAYS OF CONFERENCE TALKS

Oslo Spektrum

ndcoslo.com@NDC_conferences #ndcoslo

Page 38: Ndc magazine 1 issue

38© V

ikpi

t/Sh

utte

rsto

ck

FUNCTIONAL REACTIVE PROGRAMMING

Page 39: Ndc magazine 1 issue

BACKGROUND AND HISTORYFunctional Reactive Programming is not a new concept in computer science. It can be traced to 1997, when Conal Elliot, from the Microsoft Research Group, and Paul Hudak, from Yale Uni-versity released, the research paper "Functional Reactive Animation" in the proceedings of International Con-ference on Functional Programming1.

The academic paper introduces a col-lection of data types and functions in a system called FRAN (Functional Reactive ANimations). FRAN in turn is preceeded by work done by Conal Elliot and the ActiveVRML modelling language. ActiveVRML was a declara-tive modelling language for defining simple, sophisticated and interactive animations2.

The implementation of FRAN was based on the programming language Haskell, which is an easy extendable functional programming language. As Haskell may have some problems with space leaks, FRAN did as well. To try to fix this, Paul Hudak (et. al.) introduced Real Time FRP (RT-FRP) in a paper from 20013. RT-FRP made some simplifications to the model, but in turn lost some of the expressiveness of the FRAN system. A short year after introducing RT-FRP, the Yale team also released Event-Driven FRP, focusing

on value changes triggered by events and propagating values only on these events4.

Some years later, Conal Elliot pub-lished the paper "Push-Pull Functional Reactive Programming" (2009)5. In this paper he described a way to implement FRP with a more modernized interface, and where the reactive values had a more simplified semantic. All reactive values were described with push- and pull-based evaluation.

In later years, several different imple-mentations and libraries have arisen. Some examples are the compile-to-javascript languages Elm6 and Flap-jax7, or Bacon.js8 – which is written completely in Javascript. There are also implementations in languages like C#, Java, Scala, Objective-C, Ruby, and more.

THEORETICAL FOUNDATIONThe primary goal of functional reac-tive programming is to enable func-tional programming of user inter-faces. Why does one want to program functionally? Functional programming gives the programmer tools to reason about code, both informal and rigor-ous, through the use of immutability and pure functions.

Functional reactive programming (FRP) is a merge of two different programming paradigms; functional and reactive. In this article we explore the history and theoretical foundation of FRP before diving into FRP in practice with an exam-ple in JavaScript using Bacon.js.

After reading this article, you will have a basic understanding of what functional reactive pro-gramming is, which benefits it gives and how to apply it to your daily work.

39

By Mikael Brevik and Stian Møllersen

FUNCTIONAL REACTIVE PROGRAMMING

Page 40: Ndc magazine 1 issue

40

Immutability means that once a value has been instantiated, it does not change. Pure functions means that a function will always produce the same output given the same input.

To create more advanced behaviour one can combine func-tions through other functions, which are known as higher order functions. These take functions as inputs and produce functions as output. This class of functions are also known as combinators. The most well-known combinators are map, reduce and filter. When composing functions in this man-ner, we program declaratively. A declarative programming style is more concerned with the what happens instead of the how something happens.

If these traits are so great, why are they not found more often in modern programming? It has to do with the fact that many of the important attributes of programs are naturally mutable. This is especially true for user interfaces, where the user may mutate the state of the interface through actions.

In addition to being mutable, environments like user inter-faces are often asynchronous in their behaviour. This leaves us with an environment where the state may change at any point in time and outside the control of the program. In addition the order in which actions are performed is also important, so the temporal aspect of actions needs to be accounted for. This does seem largely at odds with the traits we want to obtain from functional programming. This is where reactive programming comes in.

Reactive programming is a programming paradigm that deals primarily with the flow of data and semantics for expressing how changes in state propagates through a dependency graph. Using reactive programming, a program-mer is able to define datatypes that express data flows

while leaving the task of actually propagating state to the execution model of the language or library used.

The best example of data flow is the interaction between cells in a spreadsheet. If you change one cell, another cell which has a dependency on that cell would automatically be updated. For instance with one cell being the sum of two other cells.

Combining the reactive datatypes with functional composi-tion we arrive at functional reactive programming. Because the semantics of reactive programming allows us to define datatypes that represent a value that handles its own mutation we can use that to introduce "safe" abstractions. Functions operate only on these abstracted datatypes and from the view of the function the state is immutable. All the mutation is left to the underlying implementation of the datatype. We can now use the composition vocabulary from functional programming without compromising the traits we wanted in the first place.

Classical functional reactive programming deals with two different representations for values that vary with time. Behaviours, which are continuous values, can be repre-sented as a function of time which yields a value f(t) -> v. Events, which are sequences of discrete events modelled as a list of value and time pairs [(t, v)], to account for discrete phenomena. This way FRP successfully deals with mutable and asynchronous environments while accounting for the temporal aspect.

FRP IN PRACTICEAs mentioned a few times already, FRP really shines when used to program user interfaces. But there is nothing that limits us from applying the same theories to other environ-ments that share the same characteristics as user interfaces.

Page 41: Ndc magazine 1 issue

41

By using the FRP style of programming we are able to instan-tiate data type, which can represent a value that can change at varying times, and compose these datatypes using func-tional composition. Because all our combinators are pure and the datatypes are immutable we only need to instanti-ate each representation once, the same goes for composed datatypes. This lends itself extremely well to code-reuse.

With FRP being at a high abstraction level and in a declara-tive style, we are able to achieve a great deal of functionality with rather few lines of code. With all state being managed internally by the reactive datatypes the programmer is freed from much of the cumbersome responsibility of working with mutable and asynchronous environments. And with the tem-poral aspect of actions being accounted for, FRP gives us a model which fits very well with these kind of domains.

PRACTICAL EXAMPLEFor this practical example, we will take a closer look at Bacon.js which is a classical FRP implementation in Javascript. Bacon.js is created by Finish developer Juha Paananen. In this section we will see how Bacon.js can be used to achieve FRP in the browser.

We will use Bacon.js to implement a simple SVG dot-drawer: tracking the mouse movement and when the mouse button is pressed draw dots every N milliseconds.

BACON.JS INTRODUCTIONAs with classical FRP, we have events and behaviours. But in Bacon.js, we call them event streams and properties. A property always has a value, but an event stream is dis-crete.

In Bacon.js we can wrap event sources to reactive data types using different functions. E.g. Bacon.fromEventTarget()

wraps events from DOM or jQuery events, objects from Node.js' EventEmitter, or Bacon.fromPromise() creates reactive data from promises. There are also several other methods, like creating data types from callbacks, from arrays, constant intervals and polling.

In the most simplest form we can react to an event like so:

bacon.fromEventTarget($('button'), 'click') .onValue(function() { console.log('FRP!'); })

We see that we can print string when a button is clicked. In most cases, Bacon.js returns a new event stream or prop-erty, but .onValue returns a function to unsubscribe to the events. Bacon.js uses lazy evaluation internally, only pushing values if there are subscribers. For example, without adding .onValue (or other methods adding subscribers, like assign) no value will get pushed.

bacon.fromEventTarget($('button'), 'click') .doAction(function() { console.log('FRP!'); })

Prints nothing, even if the button is clicked.

But Bacon.js can do much, much more than just printing val-ues on clicks. We can start getting creative by using regular functional operations like map, filter, reduce and more. We will see more of this in the next section, where we imple-ment our example.

BACON.JS EXAMPLE IMPLEMENTATIONThe kind of state management and input/output handling this example demands could easily become a very cumber-some task using traditional imperative code. Using FRP, how ever, this should be a breeze.

Page 42: Ndc magazine 1 issue

42

We begin by initiating some event streams we shall use to compose a property of mouse movements.

In this code we start of by fetching our SVG element. With that element, we create three different event streams: mouseMove - a property (behaviour in classical FRP lingo), that holds information about the position of the mouse. mouseDown - a discrete reactive data type that is triggered each time a mouse is clicked. Note the transformation on the end. By default, using .fromEventTarget gives the jQuery event as value, but by doing .map(true) we know we have a event stream with the value true each time the event stream is triggered. The mouseUp value is similar to mouseDown, except we transform the data value to be false for each trigger.

Using both the mouseDown and mouseUp we can compose a new behaviour indicating whether or not the mouse button is held down.

We see that if we have a stream of false values and merge it with a stream of true values, the resulting stream will be a stream of both false and true. We use .toProperty(false) to generate a property with false as the initial default value. The result, as stored in isClickDown, is a property that has the value true if the mouse is clicked, and false otherwise. It's important to notice, mouseDown and mouseUp is not altered in any way, and the returned isClickDown is an new immu-table property.

We can use these reactive data types to compose the infor-mation we need. We will now define mouseNewXY; a property with values of the mouses x and y position when the mouse is clicked.

var mouseNewXY = mouseMove .filter(isClickDown) .throttle(50) .map(function (e) { return { x: e.clientX, y: e.clientY, color: randomColor }; });

We see that we take base in mouseMove which we have defined earlier. Taking that event stream, we use filter and the property isClickedDown to generate a property that has value only when the property isClickDown is true – that is, only when the mouse button is pressed.

With that generated property, we throttle it per 50 milli-seconds. The result is converted to a discrete event stream that has a value only every 50 milliseconds.

Remember, per default .fromEventTarget gives the jQuery event-object as value, so we need to transform the value to a more readable format. In this example randomColor is just a random generated hex color.

We now have a event stream of a object with the mouse position and a color, only when the mouse button is pressed, and throttled over 50 ms. We can use this event stream to draw out circles.

mouseNewXY .map(toCircle) .assign($svg[0], 'appendChild');

In this code we have toCircle, a simple helper function used to convert from the data object to a SVG circle DOM

var $svg = $('svg'), mouseMove = bacon.fromEventTarget($svg, 'mousemove'), mouseDown = bacon.fromEventTarget($svg, 'mousedown').map(true), mouseUp = bacon.fromEventTarget($svg, 'mouseup').map(false);

var isClickDown = mouseDown.merge(mouseUp).toProperty(false);

Page 43: Ndc magazine 1 issue

43

element. We use Bacon's assign to terminate the reactive data type. Each circle element we get we append it to the SVG DOM element. Now we have a working example, in just 20 lines of code (plus helpers).

By using this example, we see some pretty interesting aspects. We see how easily we can compose reactive data types and manipulate them using functional programming. We have no unwanted side-effects or manual handling of states.

The very cool thing is, we can easily extend this example and add multiple input sources or even outputs. As all reac-tive data types are immutable, we can use them again in different ways. For example, if we want to show if the mouse is pressed we can use the following code:

isClickDown .map(function (down) { return down ? 'Yes' : 'No'; }) .assign($('.mouse-down'), 'text');

We can use isClickDown again, without having to think about it's previous involvements. Similarly, if we want to make this distributed through web sockets by adding a new input source. Replacing the code from before:

mouseNewXY .merge(bacon.fromEventTarget(socket, 'data')) .map(toCircle) .assign($svg[0], 'appendChild');

In this example we say that the socket is a socket instance of socket.io, and that it emits our mouse data on the chan-nel data.

In addition we would have to emit data using our mouse-NewXY data type.

The complete example with helpers is available in this gist: http://bit.ly/frp-example

WRAP-UPFunctional reactive progamming started as academic research between Microsoft Research Group and Yale Uni-versity in 1997. Over the comming years, they improved their work and honed in on an working implementation of FRP.

Functional reactive programming is a combination of functional and reactive programming. Its primary goal is to reconcile the mutable and asyncronous nature of envi-ronments like user interfaces with the semantic determin-ism and rigorous reasoning enabled by pure functional programming.

To achieve this goal, FRP makes use of reactive program-ming. Using dataflow semantics to create abstractions that represents time-varying values. Using these abstrac-

tions enables the programmer to use pure functional pro-gramming while working with inheritly mutable data.

FRP is a good fit with interface programming, or domains with the same characterisitics. FRP gives the programmer a declarative language and high level abstractions to work with. These abstractions fit the way we reason about the world and capture the temporal aspect of actions in a very good way.

In recent years, FRP has become popular and we see many different implementations in various languages. Many implementations are based on Haskell, but Javascript is seeing a rise in popularity of FRP liberaries as well.

Bacon.js is a Javascript library that gives the programmer the classical FRP datatypes of Behaviours and Events and a large API of functional combinators to work with. Being based purely on Javascript, Bacon.js works great in both the browser and on the server using Node.js. This makes it easy to start using FRP today, and it integrates very nicely with existing libraries and frameworks like jQuery and Backbone.js.

RESOURCES:1) FRAN/Classic FRP: http://conal.net/papers/icfp97/2) ActiveVRML: http://conal.net/papers/ActiveVRML/3) RT-FRP: http://dl.acm.org/citation.cfm?id=5076544) ED-RFP: http://link.springer.com/chapter/10.1007/ 3-540-45587-6_115) Push/Pull FRP: http://conal.net/papers/push-pull-frp/ push-pull-frp.pdf6) Elm: http://elm-lang.org7) Flapjax: http://www.flapjax-lang.org/8) Bacon.js: https://github.com/baconjs/bacon.js

Mikael Brevik is an occasionally open source developer and avid internet surfer. Consultant at BEKK in Trondheim, Norway.Intrests include programming languages, paradigms and ways to improve programming or way of thinking.

Stian Møllersen is a Frontend developer from Trondheim. Does his daily work at BEKK, creating web experiences for clients. Passionate about bringing programming theory, mathematics and visual expressions together to make the amazing web come alive.

Page 44: Ndc magazine 1 issue

TEACHING KIDS PYTHON with the Code Club

Teaching kids to code Python at Oslo Maker Faire 2014

The author and tef from Code Club UK

Monika Køller teaching pupils at Hundsund Lower Secondary School how to pilot drones by JavaScript

Page 45: Ndc magazine 1 issue

As developers we have a responsi-bility to share our knowledge to the community that once taught us. Not only should we share knowledge to fellow developers through blogs, open source and conferences such as NDC, but we should share with schools, children and parents as well. It can be quite hard to bring new knowledge and new perspectives to the professional world of software developers. How-ever, with an audience who has never done any coding before, the simplest code can create enthusiasm. It is incredible to see an assignment that might look a bit basic and dull serve as a basis for creativity far beyond what one could imagine.

from turtle import * shape("turtle") for count in range(4): forward(100) right(90)

Starting a code club does not have to be a lot of work. The Code Club has prepared material for teaching Scratch (a graphical coding envi-ronment), HTML/CSS and Python. The material is written so that the students can find their way through it without much theory in advance. Python and the IDE used in the assign-ments are free and runs on Windows, Mac and Linux. What is required from you is to be enthusiastic, positive and to answer basic questions about code. And you might get some really hard questions bordering to philosophy - welcome to working with kids.

I have found that the simplest way to get started is to organize the CodeClub event through a school as the teachers will be happy to facili-tate, provide infrastructure and will deal with organizing the class. Also, teaching the children of employees in your organization is an easy way to get started. Ask around and I am sure that you will find a parent or a teacher who would be happy to let you teach!

All the material is on GitHub and if you cannot find a translation to your lan-guage, feel free to send a pull request with a translation.

LINKS:https://github.com/CodeClub/python-curriculumhttp://codeclubworld.org/advice/creating-a-club.htmlhttp://www.kidsakoder.no/slik-oppretter-du-lokal-gruppe/

Code Clubs for kids are spreading fast these days. The Code Club UK’s website counter shows 2074 clubs in the UK alone. In Norway we are gain-ing momentum, but there is a long way to go before we have satisfied the demand. My impression is that as we establish more Code Clubs and spread to more schools, even more kids and parents become aware of the pos-sibilities and the demand increases.

45

By Bjørn Einar Bjartnes, developer at Computas

Page 46: Ndc magazine 1 issue

46

© G

rand

eDuc

/Shu

tter

stoc

k

Page 47: Ndc magazine 1 issue

In my experience, the most important aspect in building, testing and maintaining large-scale JavaScript applica-tions is separating the inherently global and stateful DOM from our application's state and business logic. This is what frameworks such as Backbone.js, React, Ember and Angu-larJS tries to help us solve. However, before we use any of these we should understand the main issues with how we tend to use jQuery.

ANTI-PATTERNSOne of the main problems with jQuery is that we tend to rely on several anti-patterns. Let's look at the following 14 lines of code:

When we allow any part of the DOM to be accessed from anywhere in our code, e.g. $('.menu .logged-in') and $that.closest(".info") in the example above, we create several problems for ourselves:

Our code is difficult to reason about as any part of the code can end up updating any part of the UI.

The code is harder to reuse since it's not contained. When we need to add similar functionality to another part of our application we often end up copy-pasting business logic and DOM-related code instead of reusing shared functionality.

Another problem is that it can be difficult to move func-tionality around on the page when we depend on the cur-rent DOM structure. In the example above we depend on ".info" being above the user form in the DOM tree. If we move the display of user information to another part of the site the code will break.

As we want to build more powerful and interactive web applications we increasingly rely on JavaScript. However, many of us have experienced the pain of fixing bugs and adding new features to 3000 lines of "jQuery spa-ghetti" in a single file.

47

By Kim Joar Bekkelund

Large-scale JavaScript applications and the DOM

jQuery(document).ready(function() { $(".user form").submit(function(e) { var $that = $(this); e.preventDefault(); $.ajax({ // ... success: function(data) { var name = data.name || "Unknown"; $that.closest(".info").append("<h1>" + name + "</h1>"); $(".menu .logged-in").append(name); } }) });});

Page 48: Ndc magazine 1 issue

48

Additionally, testing this little piece of functionality is a formidable task. The main problem is that the entire appli-cation is set up when the DOM is loaded and that we provide no public interface through which we can test. Another prob-lem is that we need to set up the DOM and submit a form to be able to test the Ajax request.

INJECTING THE DOMA first step in the right direction is injecting the piece of the DOM we need. Very simplified it can look like this, where we inject $(".info") when we want to show user information:

function showUserInfo($el, user) { // this function does not use $ directly $el.append("<h1>" + user.name + "</h1>");}

var user = { name: "Kim Joar" };showUserInfo($(".info"), user);

To better understand how this can work, we could rewrite the example above using Backbone.js into something like this:

jQuery(document).ready(function() { var user = new User();

new UserFormView({ el: $('.user'), model: user }); new UserInformationView({ el: $('.info'), model: user });});

Here we have separated our code into a Backbone model and two Backbone views. The form and the display is now separate and can easily be moved around on the page by changing the element we inject. As models in Backbone emit events when their content is updated, the UserInfor-mationView can listen for these events, such as "change", and update the displayed content. We have now decoupled our form from the display of information.

Now, if we are strict with only allowing views to work with the DOM and only allow each view to work on the jQuery element we inject, it is far easier to reason about the DOM and its current state. Also, with this change the functionality is now very easy to test, reuse and maintain as all external dependencies are injected.

TWO-WAY BINDINGOne interesting example of separating the DOM from the rest of our application is two-way binding. With two-way binding we have automatic synchronization between our state and the DOM. As AngularJS explains in their documen-

tation, "changes to the view are immediately reflected in the model, and any changes in the model are propagated to the view." With two-way binding we can in many cases forgo jQuery entirely.

Let's look at an example using Ember.js, with the following template:

And this controller which is connected to the template:

When the template is rendered to the DOM, it will show a button with "Show More..." as isExpanded is false. When the button is clicked, the body and a button with "Contract" will be shown instead. Here we have no jQuery at all – the two-way binding is responsible for automatically synchro-nizing the DOM and the PostController.

LEARNING MOREBetter handling of the DOM is just a first step towards building better JavaScript applications, but perhaps the most important step. If you want to learn more about build-ing large-scale JavaScript applications, check out http://superherojs.com

Kim is the practice lead for JavaScript and web technologies at BEKK, where he mostly works on large–scale JavaScript applications. He is a strong believer in treating JavaScript as a real language when we use it to build large applications. Kim is a frequent speaker on JavaScript and he is the creator of Superhero.js.

{{#if isExpanded}} <div class="body">{{body}}</div> <button {{action contract}}>Contract</button>{{else}} <button {{action expand}}>Show More...</button>{{/if}}

App.PostController = Ember.ObjectController.extend({ body: 'body', isExpanded: false,

actions: { expand: function() { this.set('isExpanded', true); },

contract: function() { this.set('isExpanded', false); } }});

Page 49: Ndc magazine 1 issue

© G

rand

eDuc

/Shu

tter

stoc

k

If you want to learn more about building

large-scale JavaScript applications, check out

http://superherojs.com

Page 50: Ndc magazine 1 issue

50

As an architect, you hear the following statements from the business: “Our business is constantly changing to meet new demands of the marketplace”; “We need faster time to market to remain competitive”; “Our plan is to engage heavily in mergers and acquisitions”. What do all these statements have in common? Change.

By Mark Richards

changeArchitecting for

Page 51: Ndc magazine 1 issue

It is a different world than it was many years ago. Both business and technology are in a constant state of rapid change. That means archi-tectures have to sometimes change as well. However, the very definition of architecture is “something that is really hard to change”. So how can we make our architectures respond bet-ter to change?

Architecting for change is one of sev-eral memes Neal Ford and I introduce

in our Software Architecture Funda-mentals video series from O’Reilly and conference workshops (soon to be held at the Architecture Day in Oslo (www.programutvikling.no/kurs/architecture-day/4353). In this article, I will explore the architecting for change meme and discuss several techniques for ensuring that your archi-tecture can properly adapt to change.

ARCHITECTURE AGILITYSimply put, traditional methods of

architecture are not sufficient to meet the ever-changing demands of the marketplace. Business is ever changing through mergers, acquisi-tions, growth, increased competition, and regulatory changes. Technology is also ever-changing through new platforms, languages, frameworks, patterns, and products.

Because of all this rapid change, we need to make our architectures more adaptable to change as well. Specifi-

51

© Ju

anjo

Tug

ores

/ Shu

tter

stoc

k

Page 52: Ndc magazine 1 issue

52

cally, we need our architectures to be agile. The term architecture agility means the ability to respond quickly to a constantly changing environment. Note the word “quickly” - this is the real key. All architectures can change; how-ever, really successful architectures are ones which can quickly adapt to change.

There are many techniques you can use for ensuring your architecture can quickly adapt to change. In this article I will describe three of those techniques: abstraction, leveraging standards, and creating product-agnostic architectures.

ABSTRACTIONThe first technique, abstraction, involves decoupling architecture com-ponents so that components know less about each other, hence mini-mizing the overall impact of changes made to those components. There are five main forms of abstraction: location transparency, name trans-parency, implementation transpar-ency, access decoupling, and finally contract decoupling (the hardest form to implement). In this section I will describe each of these forms of abstraction.

The first form, location transparency, means that the source component does not know or care where the tar-get component resides. For example, the target component may reside on a server in Frankfurt, or even a server in Paris - it simply doesn’t matter. This is the easiest form of abstraction to implement, with messaging, service locators, and proxies being the most common implementation methods.

Name transparency means that the source component does not know or care about the name of the compo-nent or service method. For example, suppose you need to access a pricing server for stock prices. Name trans-parency dictates that you can choose to call the service anything you want (e.g. GetLatestPrice), whereas the actual name of the method you are invoking on the target component is getSecurityPrice. The implementation name can continue to change, but the source component always refers to the service as GetLatestPrice. This form of abstraction is commonly found in messaging and service registries.

Implementation transparency means that the source component does not know or care about what language

or platform the target component is written in. It could be Java, C#, .NET, C++/Tuxedo, even CICS - it simply doesn't matter. Again, messaging is a common way to implement this form of abstraction.

Access decoupling means that the source component does not know or care about how the target component is accessed, whether it be RMI/IIOP (EJB), SOAP, REST, ATMI (Tuxedo), etc. Typically a source component standardizes on one access protocol (e.g., XML/JMS) and has a middleware component (e.g., integration hub or adapter) transform the protocol to that used by the target component.

Finally, contract decoupling means that the contract advertised by the target component doesn't necessar-ily need to match the contract used by the source component. For exam-ple, lets say the source component uses a CUSIP (a security identifier) to check the price of a particular security, but the target component requires a SEDOL (another type of security identifier). A middleware component or adapter can perform a CUSIP to SEDOL conversion, thereby decoupling the contract of the target

© C

arlo

s C

asti

lla/ S

hutt

erst

ock

Page 53: Ndc magazine 1 issue

53

component from source components. The level of abstraction you choose to implement is largely based on the trade offs you are willing to accept. For example, implementing abstrac-tion through basic messaging auto-matically provides you with location, name, and implementation transpar-ency. However, access and contract decoupling requires some sort of middleware component (like an enter-prise service bus or custom adapters), both of which are expensive to imple-ment and add a significant complexity to your application or system.

LEVERAGE STANDARDSAnother technique you can use to facilitate change within your architec-ture is to leverage standards. There are three types of standards you need consider as an architect: industry standards, de-facto standards, and corporate standards.

Industry standards primarily consist of protocols and payload formats defined as either universal or belong-ing to a particular business domain. XML and SOAP are examples of uni-versal industry standards, whereas SWIFT, FIX, and FpML are specific financial services domain standards. Sticking to industry standards, par-ticularly domain-specific industry standards, allows the architecture to adapt change more quickly by inte-grating better with other applications and systems within that domain. For example, by choosing SWIFT as your standard, you can pretty much inte-grate with any bank. However, if you have your own custom protocol and data format, integration will take significantly longer.

De-facto standards are those tech-nologies and products that are so well known and widely accepted in the industry that they generally become a standard part of almost every technology stack. Hibernate, Struts, Apache Tomcat, and the Spring Framework are all good examples of de-facto standards. By leveraging these technologies and products, your architecture can adapt quicker to change primarily because the resource pool is large for these de-facto standards and the availability of documentation and references is wide-spread. For example, if you

perform a Google search on a par-ticular issue you are experiencing in Hibernate, chances are good that you will find a plethora of information to help you solve your problem. However, perform a Google search on a lesser-known persistence framework, and chances are you will be on your own to figure out the issue.

Corporate standards are the third type of standard and include those technologies, tools, and products that your particular company uses. Sometimes corporate standards include industry and de-facto stand-ards, but usually include specific products and technologies like .NET, Java EE, JBoss, Eclipse, etc. Leverag-ing corporate standard is critical to achieving architecture agility. Change is quicker because the resource pool and skill set within the company for those products and technologies is widespread. For example, let's say you decided to break away from the corporate standards (say Java EE) and implement your architecture using Ruby on Rails. However, because the resource pool hired by the company is Java EE, changing the application will be difficult due to the lack of avail-able Ruby on Rails resources to make those changes.

PRODUCT AGNOSTIC ARCHITECTUREWhen designing an architecture for change, it is important to avoid what is known as vendor lock-in. While your architecture may need to be depend-ent on a particular product, the prod-uct should not be the architecture.

Creating a product agnostic architec-ture involves sufficiently abstracting the product using adapters, message bus technology, or messaging to form what my friend Neal Ford fondly refers to as an anti-corruption layer.

For example, let's say that you are using a major ERP product (e.g., Ora-cle, SAP, etc.) and you are asked to develop an architecture for the sys-tem. It is all-too tempting to just place the large ERP product in the middle of the architecture and leverage the many tools available from that prod-uct to develop and integrate various applications that use it. While this would certainly work, it is perhaps

the hardest type of architecture to change. It would literally take years to swap out one ERP product for another or integrate other products into the architecture. A much better approach would be to create an abstraction layer around the ERP product so that product upgrades can be better iso-lated and product changes be made more feasible.

CONCLUSIONWhile there are many techniques you can use to create architectures that quickly adapt to change, it is impor-tant to remember using these tech-niques comes with a price. Applying abstraction and creating product-agnostic architectures usually decreases performance, adds signifi-cant complexity to the architecture, and increases development, testing, and maintenance costs. As an archi-tect you must analyze the trade-offs between these disadvantages and the advantage of an agile architecture that can quickly adapt to change. If you are in an industry that is fre-quently changing (and most are), the trade-off is easy - you must architect for change. However, just how much agility you apply to the architecture depends on the trade-off's you are willing to accept.

Mark Richards is a hands-on architect with over 30 years of industry experience. Throughout his career he has performed roles as an application architect, integration architect, and enterprise architect. Although Mark works primarily in the Java platform, he also has experience in many other languages and technologies. Mark is the author of Java Message Service 2nd Edition by O'Reilly, contributing author of 97 Things Every Software Architect Should Know by O'Reilly, and most recently co-author with Neal Ford on a new video series by O'Reilly called Software Architecture Fundamentals. Mark has spoken at over 100 conferences worldwide, and is passionate about architecture, technology, and hiking.

Page 54: Ndc magazine 1 issue

54

By Charlotte Lyng. Photo: Kristoffer Sunnset

NDC London made its debut at the ICC Suites at the ExCel Exhibition Centre 2-6 December 2013. Close to 700 delegates from all over the world contributed in making NDC London an unqualified success.

NDC London fostered a great atmos-phere, with great speakers, culinary food, comfortable venue, loads of interesting sessions and an awesome party, creating a real community feel for its delegates.

The NDC team is excited to announce that they have already started the planning process for NDC London 2014. Save the date, NDC London will be back 1-5 December at the ExCel Exhibition Centre.

Last year marked the end of the long wait as NDC made its first appearance outside of Oslo.

NDC London returning in 2014

54

Page 55: Ndc magazine 1 issue

55

© E

lada

Vas

ilyev

a/Sh

utte

rsto

ck

55

Phot

o: C

harl

otte

Lyn

g

Page 56: Ndc magazine 1 issue

56

COURSES for developers and leadersADVERTISEMENT

Page 57: Ndc magazine 1 issue

57

Craig Larman

AGILE - MANAGEMENT

AGILE AND ITERATIVE DEVELOPMENT - A MANAGERS GUIDE Author and instructor: Craig LarmanThis practical, information-packed seminar summarizes the key research, ideas, and practices of iterative development, aimed at executive and project leadership. This is a high-impact guide for managers and students to agile and iterative development methods: what they are, how they work, how to implement them – and why you should. Whether you’re an IT executive, project manager, student of software engineering, or developer, Craig Larman will help you understand the promise of agile/iterative development, sell it throughout your organization – and transform the promise into reality.

ACCELERATED AGILE: FROM MONTHS TO MINUTES Author and instructor: Dan NorthDuring this course you will learn unusual and counter–intuitive techniques for software delivery and understand the principles behind them. Using a mixture of discussion, instruction and exploration you will start to think differently about agile development, automation and team dynamics. By exploring several architecture and development strategies you will learn how you and your teams can produce and deploy software faster than they thought possible. You’ll never look at TDD the same way again, not to mention copying–and–pasting code.

AGILE FOUNDATIONS FOR BUSINESS ANALYSTS Author and instructor: Allan KellyThis course focuses on the role of requirements in driving generic Agile teams with reference to Scrum project management and XP technical practices. The Business Analyst’s role on an Agile team is described together with the additional tools, techniques and approaches available.

RETROSPECTIVE TECHNIQUES Author and instructor: Geoff Watts The 2–day Retrospective Techniques course will teach the 5 step structure for facilitating a retrospective as described by Esther Derby and Diana Larsen and will also cover a number of approaches to be used in each part of the process. As well as leaving with new techniques for their retrospective toolboxes, attendees will get the opportunity to practice putting together a retrospective agenda and running and⁄or experiencing many of the techniques they will learn about.

Dan North

Allan Kelly

Geoff Watts

GIT

GITHUB FOUNDATIONSAuthor and instructor: Tim BerglundThis six-hour workshop gets you up and running with Git and GitHub. We'll cover the basics of the Git command line interface, introduce you to graphical clients, and learn how to collaborate using pull requests on GitHub.com. No matter whether you work in open source, for a small company, or in a large enterprise, this is the introductory course for you.

ADVANCED GIT AND GITHUBAuthor and instructor: Tim BerglundYou already know the basics of Git and GitHub, and you're ready for more. This six-hour workshop willequip you with the advanced skills you need to become the Git and GitHub expert on your team. Whether you work in open source, for a small company, or in a large enterprise, this is course is for you.

Tim Berglund

Tim Berglund

NEW

NEW

Page 58: Ndc magazine 1 issue

58

PEOPLE – SCRUM

AGILE DEVELOPMENT WITH SCRUMAuthor and instructor: Arne LaugstølThis course will give an introduction to development in Scrum and agile development. The Participants will learn how to practice Scrum by collaborating as part of a Scrum-team during the labs. The course is aimed at people that is either going to participate in Scrum-teams, or just wants to know more of the concepts of Scrum and agile-development. You don’t need to be a developer to gain a full benefit from the course.

CERTIFIED SCRUMMASTER CSMAuthor and instructor: Mike CohnDuring the ScrumMaster class, attendees will learn why such a seemingly simple process as Scrum can have such profound effects on an organization. Participants gain practical experience working with Scrum tools and activi-ties such as the product backlog, sprint backlog, daily Scrum meetings and sprint planning meeting. Participants leave knowing how to apply Scrum to all sizes of projects. The course gives you the title of Certified ScrumMaster.

CERTIFIED SCRUMMASTER CSMAuthor and instructor: Geoff WattsLearn the Scrum framework for an agile project and the essentials of working as a ScrumMaster or Scrum team member. Through a fun mix of theoretical explanation, problem exploration and practical exercises, this 2–day course will equip attendees for their first Scrum project or enable them to reflect on their projects and become more agile.

CERTIFIED SCRUM PRODUCT OWNER CSPOAuthor and instructor: Mike CohnThis course will teach you, the product owner, how to use the product backlog as a tool for success. As you watch the product take shape, iteration after iteration, you can restructure the Product Backlog to incorporate your insights or respond to changes in business conditions. You can also identify and cancel unsuccessful projects early, often within the first several months. The Certified Scrum Product Owner; course equips you with what you need to achieve success with Scrum.

CERTIFIED SCRUM PRODUCT OWNER CSPOAuthor and instructor: Geoff WattsDuring this course you will understand the product owner role with its authority and responsibility, and its interaction with the other Scrum roles. You will be able to create a product vision, stock and groom the product backlog, prioritise the backlog, and systematically refine requirements. You will also be able to create a realistic release and track the project progress and understand how you can effectively collaborate with the ScrumMaster and team in the sprint meetings.

AGILE INTERACTIONS WORKSHOP Author and instructor: Jessie ShternshusThe most important factor of an Agile team is the teams ability to communicate effectively. We often only focus on the technical aspect of things, when really most of the breakdowns happen when the team can´t communicate with one another. Understanding how to interact with your internal and external team is vital to the entire agile process.

Arne Laugstøl

Mike Cohn

Mike Cohn

Geoff Watts

Geoff Watts

Jessie Shternshus

NEW

For a complete course overview, price update, time and place, visit www.programutvikling.no and www.developerfocus.com

Registration Oslo: Tel 67 10 65 65 • [email protected] • www.programutvikling.no

Page 59: Ndc magazine 1 issue

59

BDD - SPECIFICATION BY EXAMPLE Author and instructor: Gojko AdzicThis three day workshop teaches you how to apply emerging practices for managing requirements, specifications and tests in agile and lean processes to bridge the communication gap between stakeholders and implementation teams, build quality into software from the start, design, develop and deliver systems fit for purpose.

TEST-DRIVEN DEVELOPMENT Author and instructor: Venkat SubramaniamThe course has a good balance of interactive lectures and hands–on exercises. The attendees are expected to pair–up and work on the lab exercises. The instructor will assist the attendees as they work on the exercises. The objective of the course is for the attendees to gain an in depth practical knowledge of the concepts so they can put them to immediate use on real projects.

TEST-DRIVEN DEVELOPMENT & REFACTORING TECHNIQUES COURSEAuthor and instructor: Robert C. Martin This course teaches you how to use the principles and practices of TDD to specify requirements and designs using acceptance tests and unit tests. You will learn the intensely granular TDD approach to development using XUnit for unit testing and FitNesse for acceptance testing. You will experience the frequent and regular feedback and progress of letting tests drive the development and design.

TEST – DRIVEN JAVASCRIPTAuthor and instructor: Christian JohansenEven the most seasoned backend programmer is too often on thin ice once a web application’s frontend is in need of development and/or maintenance. Rid yourself of the insecurity by learning to understand and appreciate JavaScript for the highly productive and unusual language it is. The course will take you through JavaScript’s object model and functional elements, giving you a solid understanding of how JavaScript really works. A series of practical assignments puts this understanding to use by implementing reusable code using idiomatic JavaScript patterns. Unit testing and TDD will be demonstrated through-out the course.

Gojko Adzic

TEST-DRIVEN DEVELOPMENT, TESTING

THE WHOLE TEAM APPROACH TO AGILE TESTINGInstructor: Janet GregoryThis three day course explains how testers can become valued agile team members, how they contribute to delivering a continuous stream of business value, and ways to overcome common cultural and logistical obstacles in transitioning to an agile development process. It describes the values and principles that help testers adopt an agile testing mindset, and gives practical alternatives to traditional testing processes, such as defect tracking, metrics, audits, and conforming to quality models. Students will be shown how to complete testing activities in short iterations, and how testers contribute on a daily basis during each iteration and release cycle.

Janet Gregory

V. Subramaniam

Robert C. Martin

Christian Johansen

FUNCTIONAL PROGRAMMING

PROGRAMMING IN FUNCTIONAL STYLE Author and instructor: Dr. Venkat SubramaniamThis three day course, offered by award winning author and trainer Dr. Venkat Subramaniam, will get you programming in functional programming. This course is not a theory of why this is a good idea, but a practical deep dive into the key aspects of functional programming. It will help you learn why, what, and exactly how to make use of this. Venkat is known for being a polyglot programmer and will demonstrate the functional style of programming in languages that the attendees use at their work each day.V. Subramaniam

NEW

Page 60: Ndc magazine 1 issue

60

For a complete course overview visit www.programutvikling.no

Herb Sutter

Gojko Adzic

EFFECTIVE CONCURRENCY

EFFECTIVE CONCURRENCY Author and instructor: Herb SutterThis course covers the fundamental tools that software developers need to write effective concurrent software for both single–core and multi–core⁄many–core machines. To use concurrency effectively, we must identify and solve four key challenges: 1. Leverage the ability to perform and manage work asynchronously. 2. Build applications that naturally run faster on new hardware having more and more cores. 3. Manage shared objects in memory effectively. 4. Engineer specifically for high performance

AGILE

APPLYING LEAN THINKING TO SOFTWARE DEVELOPMENT - INCLUDING AN INTRODUCTION TO THE KANBAN METHODAuthor and instructor: Allan KellyDemonstrate how Lean thinking can be applied to software development and equip students with practical tools for improving their development processes and environments. This workshop uses lecture material and exercises to teach Lean ideas and provide students with experience of applying Lean techniques. Those responsible for the development of software: Who should attend?: Project Managers, Team Leaders, Development Directors and Managers, Scrum Masters and Architects.

BDD - SPECIFICATION BY EXAMPLE Author and instructor: Gojko AdzicThis three day workshop teaches you how to apply emerging practices for managing requirements, specifications and tests in agile and lean processes to bridge the communication gap between stakeholders and implementation teams, build quality into software from the start, design, develop and deliver systems fit for purpose.

Allan Kelly

DATABASE

DATABASE DESIGN, -IMPLEMENTATION AND SQL-PROGRAMMINGAuthor and instructor: Dag Hoftun KnutsenThis course covers all phases of developing a database application: Analysis, design, implementation, SQL-programming and testing. Hands-on exercises will give you practical experience. There is particular focus on how physical database design is important from a performance perspective.

ORACLE SQL- PROGRAMMINGAuthor and instructor: Dag Hoftun KnutsenThis course is a comprehensive introduction to SQL, including coverage of Oracle-specific features. The course includes all aspects of SQL: Data Definition, Data Control and Data Manipulation with particular focus on querying. It also covers principles of database design for performance. Hands-on exercises provide practical experience with SQL, and you will also learn about common errors and pitfalls and how to avoid these.

ORACLE PL/SQL- PROGRAMMINGAuthor and instructor: Dag Hoftun KnutsenThis course provides a comprehensive introduction to Oracle’s procedural language PL/SQL. The course describes the language’s general structure and syntax as well as various ways of applying the language in an application. Programming experience is gained through hands-on exercises.

Dag Hoftun Knutsen

Dag Hoftun Knutsen

Dag Hoftun Knutsen

Page 61: Ndc magazine 1 issue

61

JAVA

CORE SPRING FRAMEWORKAuthor: Mårten Haglind Instructor: Mårten HaglindIn this four–day bootcamp you learn how to use the Spring Framework to create well–designed, testable business applications in an agile manner. Students build a Spring–powered JEE application that demonstrates the Spring Framework and other Spring technologies in an intensely productive, hands–on setting.

SPRING AND HIBERNATE DEVELOPMENTAuthor: Mårten Haglind Instructor: Mårten HaglindIn this five–day course you will learn how to use the Spring Framework to create well–designed, testable business applications in an agile manner. In addition to that, you will learn how to use Hibernate, to effectively map Java domain model objects to a relation database.

PROGRAMMING JAVA STANDARD EDITION Authors and Instructors: Eivind NordbyThis course is designed to give programmers a solid grounding in the Java Programming language. Starting with the core syntax and OO concepts, it then progresses to covering class design, arrays and collections, core libraries, exception handling, I⁄O and networking, JUnit testing an introduction to Swing as well as the new Java features (the course is always up to date with the latest versions of Java SE). After taking this course delegates should be comfortable with working from a design on real projects using core Java, will be able to attend more advanced Java courses such as JEE and have a firm grasp of the fundaments required for the SCJP exam.

EFFECTIVE SCALAAuthor and instructor: Jon-Anders TeigenYou will learn how to model rich object–oriented systems using Scala’s integration of concepts from object–oriented and functional programming. We will explore how these two paradigms complement each other to bring you the best of both worlds. During these three days you will go from learning how to explore APIs using Scala’s interpreter to building full blown applications using the Lift web framework.

PROGRAMMING IN JAVA 8Authors and instructors: Dr. Venkat SubramaniamJava is arguably one of the most widely used languages. This popular language is going through a makeover. This will have a significant impact on how programmers will code and design applications with Java. With the introduction of lambda expressions and method references in Java 8, we can now make use of functional stye of programming. With greater emphasis on immutability and state transformation instead of state mutation, this means fewer errors, more expressive and concise code that's easier to parallelize. All this comes with one caveat, we have to learn and adapt to not just the new syntax, but different and better way of thinking. This course is designed, by author of the first book on Java 8 to hit the market, to help you make a quick and effec-tive transition to Java 8 and its functional capabilities.

Jon-Anders Teigen

Mårten Haglind

Eivind Nordby

Mårten Haglind

V. Subramaniam

Espen Evje

XML

EXCHANGING AND MANAGING DATA USING XML AND XSLTAuthor and instructor: Espen EvjeThis course gives a broad overview of XML, in particular of the structure and the syntax of XML documents, and of how to use XML documents in your solutions. You will learn about XML Schemas and about XPATH, and you will get an insight on how to use XML with relational databases.

For a complete course overview visit www.programutvikling.no

NEW

Page 62: Ndc magazine 1 issue

62

V. Subramaniam

Robert C. Martin

Craig Larman

Eivind Nordby

Robert C. Martin

Kevlin Henney

Juval Lowy

DESIGN - ANALYSIS- ARCHITECTURES

AGILE DESIGN AND MODELING FOR ADVANCED OBJECT DESIGN WITH PATTERNSAuthor and instructor: Craig LarmanDuring this popular, high–impact, and hands–on course you will learn to design with patterns, apply visual modelling in an agile modelling approach, and a suite of related advanced design topics, including the design of packages. This course is based on acclaimed industry leader Craig Larman’s extensive experience coaching and applying OOD since the mid 1980s.

ANALYSIS AND DESIGN WITH SCRUMAuthor and instructor: Eivind NordbyThe course targets developers who need to catch the users’ needs and transform them into distinct development tasks and into a solution capable of adapting to continuous requirements changes. The workflow is Scrum based, and UML is used for analysis and design ahead of programming in each sprint. Bundled with object-orientation, this gives a powerful, practical, developer oriented approach to problem solving.

ARCHITECTURE SKILLS Author and instructor: Kevlin HenneyThe Architecture Skills course introduces a broad curriculum for software architects. The course introduces development process models, architectural styles, requirements techniques, sufficient modelling techniques, design patterns and testing practices. This course includes a number of practical exercises so that attendees can see how the different activities fit together. There is also plenty of opportunity for discussion.

AGILE ARCHITECTURE AND DESIGNAuthor and instructor: Robert C. MartinThis course is a deep dive into the well–known SOLID principles of Agile and Object Oriented Design. Students will learn the characteristics of sound Object–Oriented designs and architecture, and patterns and practices that create them. Principles include: The Single Responsibility Principle, The Open Closed Principle, The Liskov Substitution Principle, The Interface Segregation Principle, The Dependency Inversion Principle, and many others. Special attention is paid to Component oriented design, and the principles and patterns of large–scale component architecture.

PROJECT DESIGN MASTER CLASS Author and instructor: Juval LowyWhen designing a software system it is easy to forget that the process of developing your design is complex, involving numerous stages from calculating the planned duration and cost to devising several execution options and scheduling resources. Even validating your plan is a vital step in order to ensure that your plan is both sensible and feasible. The design process poses many challenges and to overcome these obstacles it is essential that you grasp the inner dependencies between services and activities, the critical path of integration, the staff distribution and the risks involved. All of these challenges stem from your system design and addressing them properly is a hard core engineering – designing the project. This design task requires both the Product Manager and Architect to work closely in order to create a project design structure that can survive the test of the developments process.

EVOLUTIONARY DESIGN AND ARCHITECTURE FOR AGILE DEVELOPMENTAuthor and instructor: Dr. Venkat SubramaniamThe course has a good balance of interactive lectures and hands-on exercises. The attendees are expected to pair-up and work on the lab exercises. The instructor will assist the attendees as they work on the exercises. The objective of the course is for the attendees to gain an in depth practical knowledge of the concepts so they can put them to immediate use on real projects.

CLEAN CODE: AGILE SOFTWARE CRAFTSMANSHIPAuthor and instructor: Robert C. MartinThis is a two–day hands–on course in which students learn the principles and practices of Clean Code as described in Robert C. Martin’s book: Clean Code: A Handbook of Agile Software Craftsmanship. This course alternates between lecture and exercise so that students can experience, first–hand, the practices and disciplines of these fundamental topics.

NEW

Page 63: Ndc magazine 1 issue

63

DESIGN - ANALYSIS- ARCHITECTURES continued

OBJECT-ORIENTED DEVELOPMENTAuthor and instructor: Eivind NordbyThis is a course for experienced developers who are new to, or wish to strengthen their object-orientedthinking. More than the programming itself, the difficulty in passing to object-orientation is mental. That is whythis course focuses on basic object-oriented thinking and basic design principles. Of course, there are plenty ofpractical exercises.

HTML5 – JAVASCRIPT

JAVASCRIPT FOR PROGRAMMERS Author and instructor: Christian JohansenThis three day workshop will introduce you to HTML5 with a brief backstory, before diving into the APIs one by one. As well as going through code and showing practical demonstrations, where possible, we’ll also talk about the alternatives and polyfills for old browsers that dont support ”awesome” out of the box.

TEST – DRIVEN JAVASCRIPTAuthor and instructor: Christian JohansenEven the most seasoned backend programmer is too often on thin ice once a web application’s frontend is in need of development and/or maintenance. Rid yourself of the insecurity by learning to understand and appreciate JavaScript for the highly productive and unusual language it is. The course will take you through JavaScript’s object model and functional elements, giving you a solid understanding of how JavaScript really works. A series of practical assignments puts this understanding to use by implementing reusable code usingidiomatic JavaScript patterns. Unit testing and TDD will be demonstrated through-out the course.

ANGULARJS AND HTML 5 Author and instructor: Scott Allen AngularJS brings testable architectural patterns to applications built with HTML 5. This course explains and demonstrates the many features of AngularJS, including directives, filters, routing, controllers, templates, services, views. But, the best applications need more than a single framework. We’ll also learn about responsive design, Bootstrap, and the latest HTML 5 features including local storage, the canvas, web workers, web sockets, and more

ANGULARJS END-TO-END SPA DEVELOPMENT Author and instructor: Dan WahlinThe AngularJS End-to-End Application Development course provides a hands-on look at working with the AngularJS framework. The course starts with an introduction to building Single Page Applications (SPA) and talks about the features AngularJS provides. From there students learn about different aspects of the framework such as views and directives, controllers and routes, as well as factories and services. Along the way, different debugging techniques and tools are discussed, how different AngularJS components can be customized and shared with other components, and different JavaScript patterns that can be applied to applications to make them more maintainable. By the end of the class students will have walked through the process of building a Single Page Application (SPA) from end-to-end using AngularJS and be ready to apply that knowledge to applications they need to build at work.

JAVASCRIPT AND HTML5 FOR DEVELOPERS Author and instructor: Christian WenzJavaScript has shown an impressive comeback over the past few years. The static, non-functional websites of the past have been replaced by smart web browsers which offer a runtime environment for actual applications. This course intends to bring you up to speed with today’s efficient and effective JavaScript.

Scott Allan

NEW

NEW

Christian Johansen

Christian Johansen

Christian Wenz

Dan Wahlin

Eivind Nordby

Page 64: Ndc magazine 1 issue

64

SHAREPOINT

SHAREPOINT 2010 AND OFFICE 365: END TO END FOR DEVELOPERS AND DESIGNERSAuthor and instructor: Sahil MalikThis 5 day course is packed with information that will load you with enough skills to work productively on any SharePoint project. It covers development aspects or UI design concepts in depth. This course is designed for technical audience or the architect who needs to learn all aspects of the product, for the developer, designer, and the administrator.

SHAREPOINT 2013 AND OFFICE 365: END TO END FOR TECHNICAL AUDIENCE Author and instructor: Sahil MalikThis 5 day course is packed with information that will load you with enough skills to work productivelyon any SharePoint project. It covers development aspects or UI design concepts in depth. This course is designed for technical audience or the architect who needs to learn all aspects of the product, for the developer, designer, and the administrator. The course has been written, and is delivered by Sahil Malik. You can expect plenty of real world insight that you don’t get in “canned courses”.

SHAREPOINT 2013 AND OFFICE 365: ONLY THE NEW STUFF Author and instructor: Sahil MalikThis 3 day course is packed with targeted information that will bring your skills up to date on SharePoint 2013. Thiscourse is designed for technical audience or the architect who is already familiar with SharePoint 2010 and isinterested in getting targeted information, or the delta between SharePoint 2013 and Share-Point 2010. The coursehas been written, and is delivered by Sahil Malik. You can expect plenty of real world insight that you don’t get in“canned courses”.

Sahil Malik

Sahil Malik

Sahil Malik

Wei-Meng Le

Wei-Meng Le

Wei-Meng Le

MOBILE APPLICATIONS

ANDROID DEVELOPER TRAININGAuthor and instructor: Wei-Meng LeeAndroid is Google’s operating system for mobile devices. Using the Android SDK, developers can develop applications on the Android platform using the Java Programming language. In this 5-day course, participants will learn the various techniques to program their Android devices. The first half of this feature-packed course will show you how to get started in Android development, right from the start till deployment. In the second-half of this course, you will explore Android beyond the basics. You will learn about the latest Android designed for tablet devices, and explore the new APIs that allow you to build both smartphone and tablet applications. In addition, you will also learn about networking technologies in Android – Bluetooth, Sockets, as well as push notifications using the Google Cloud Messaging (GCM) Framework.

FUNDAMENTALS OF IOSAuthor and instructor: Wei-Meng Lee The workshop will begin with the basic concepts such as Views, View Controllers, Protocols and Delegates, as well as the tools that help you develop compelling iOS applications – Xcode and Interface Builder. Participants will then dive into the details of programming the iPhone, such as how to invoke the built–in applications and access the hardware of the iOS device. In the second half of this course particpants will learn the advanced techniques for writing iOS applications. You will learn about iPad–specific programming, Location–based Services and network programming.

MOB101 – 3-DAY WRITING CROSS PLATFORM IOS AND ANDROID APPS USING XAMARIN AND C#Author and instructor: Wei-Meng Lee In this 3-day workshop, you will learn the fundamentals of building cross-platform mobile apps targeting iOS and Android devices using Xamarin and C#. Using the Xamarin Studio, you can now write iOS and Android apps using your familiar C# language. When you are ready to deploy your apps, the Xamarin compiler will compile your app into the native binary for each platform. The end result is you have a first class application that is optimized for the respective platform that it is compiled for.

Page 65: Ndc magazine 1 issue

65

C++

C++ FOR EMBEDDED DEVELOPERSAuthor and instructor: Mike TarltonThis course introduces the C++ language for general use. The course is suitable for programmers who do not need to have in–depth knowledge of embedded programming concepts or concurrency issues. The course is also useful for Hardware Engineers needing to learn C++, for example to move onto using SystemC. It is assumed delegates have a working knowledge of the C programming language.

ADVANCED C++ PROGRAMMING AND INTRODUCTION TO C++11 Author and instructor: Hubert MatthewsThis course is designed to introduce delegates to more advanced use of C++ as well as introducing the most common parts of C++11. It will cover techniques and idioms that allow for more efficient and safer use of the language as well as the concepts that make C++ different from other languages. Modern C++ techniques and facilities such as the STL are used throughout to introduce developers to the full power of the C++ language. One day is devoted to new C++11 features.

C++11 PROGRAMMING Author and instructor: Hubert MatthewsThis course is designed to upgrade delegates to C++11, the new C++ standard. C++11 is designed to make programming in C++ easier and more efficient for both the developer and the machine. It will cover all of the major features along with idioms for using them effectively, giving you access to the full power of the new language and libraries.

EFFECTIVE C++11 PROGRAMMING Author and instructor: Scott MeyersSoftware developers familiar with the fundamentals of C++11 are ready to advance from knowing what's in C++11 to understanding how to apply it effectively. This seminar, based on information in Scott Meyers' forthcoming Effective C++11, highlights the insights and best practices of the most accomplished C++11 programmers: the things they almost always do (or almost always avoid doing) to produce clear, correct, efficient code.

SCALABLE DESIGN AND IMPLEMENTATION USING C++ Author and instructor: Andrei AlexandrescuThis course teaches advanced topics in designing and implementing large, scalable systems using C++11. Performance and system-wide robustness are primary concerns. New features of C++11 (and idioms they enable) that help reduce boilerplate and make complex system implementations are introduced.

Mike Tarlton

Hubert Matthews

Hubert Matthews

Scott Meyers

A. Alexandrescu

NEW

NEW

C

DEEP C: A COURSE FOR EXPERIENCED C AND C++ DEVELOPERSAuthor and instructor: Olve MaudalProgramming is hard. Programming correct C is particularly hard. Indeed, even in serious industrial applications it is uncommon to see only correct, well defined and conforming code. Why do professional programmers write code like this? Because they lack a deep understanding, they don’t know the history and spirit of this wonderful programming language. C is not really a high level language, it is more like a portable assembler where you always need to consider the underlying hardware.Olve Maudal

For a complete course overview visit www.programutvikling.no

Page 66: Ndc magazine 1 issue

66

C#.NET: UTVIKLING AV APPLIKASJONER I .NET MED C#Author and instructor: Arne Laugstøl. Instructor: Arjan EinbuIn this 5-day course you will learn how to develop applications in the .Net environment. The course will teach you the C# language and how to use the platform to make applications that will run on the desktop with WPF(Window Presentation Foundation) or in the browser with ASP.Net. How to communicate with WCF(Windows Communication Foundation), and accessing data with Linq or Entity Framework is part of the course.

DESIGNING USER EXPERIENCES: PRINCIPLES AND TECHNIQUES FOR DEVELOPERS, MANAGERS AND ANALYSTSAuthor and instructor: Billy HollisThis class is aimed at developers, but it includes design, architecture, and development topics. Technical topics are mostly covered earlier in the class, with design and architectural topics coming later. However, because the class stresses effective design and architecture, design and architecture topics are listed first. This course will also discuss changes to WPF and related technologies in future Microsoft products, as presented at the BUILD Windows conference that takes place before the class.

CLAIMS-BASED IDENTITY & ACCESS CONTROL FOR .NET 4.5 APPLICATIONS Author and instructor: Dominick BaierThis course introduces to the fundamental concepts of identity & access control in .NET and covers the integration of these new technologies into the main application frameworks like ASP.NET, ASP.NET Web API and WCF. You will learn about patterns like single sign–on, federation, home realm discovery and identity delegation and how to implement them with .NET. You will learn how to implement authentication and authorization in web applications, SOAP services and HTTP⁄REST based services. You will learn about the SAML and JWT token types and the WS–Federation, WS–Trust and OAuth2 protocols.

70-513 - WCF 4.5 WITH VISUAL STUDIO 2012 Instructor: Sahil MalikThis course is aimed at .NET developers interested in developing deep architectural and developer level expertise in WCF 4. In addition, this course will teach you about Windows Server AppFabric and Windows Azure AppFabric. This course also explains good archtecture practises and enables you to take Exam 70–513.

Arjan EinbuArne Laugstøl

Billy Hollis

Sahil Malik

Dominick Baier

MICROSOFT

ZERO TO MICROSOFT BUSINESS INTELLIGENCE Author and instructor: Peter MyersThis five day intensive instructor–led training course has been designed to enable students to commence developing and maintaining state–of–the–art integrated Business Intelligence (BI) solutions developed by using Microsoft products. The course consists of numerous hands–on labs that will provide students with the opportu-nity to produce an end–to–end BI solution.

DEVELOPING WINDOWS AZURE AND WEB SERVICES Author and instructor: Magnus MårtenssonAbout this CourseIn this course, students will learn how to design and develop services that access local and remote data from various data sources. Students will also learn how to develop and deploy services to hybrid environments, including on-premises servers and Windows Azure. This course helps people prepare for exam 70-487

Peter Myers

M. Mårtensson

For a complete course overview, price update, time and place, visit www.programutvikling.no and www.developerfocus.com

Registration Oslo: Tel 67 10 65 65 • [email protected] • www.programutvikling.no

Page 67: Ndc magazine 1 issue

67

Arne Laugstøl

MICROSOFT continued

WEB DEVELOPMENT IN .NET - ASP.NET MVC , HTML5, CSS3, JAVASCRIPT Author and instructor: Scott Allen/Arjan EinbuThis course covers everything you need to know to start building applications with the latest Microsoft web development stack. We will use ASP.NET MVC on the server and see how to work with models, views, and controllers. On the client we’ll take advantage of HTML 5, CSS 3, and the best JavaScript frameworks, including jQuery, Modernizr, and more. During the course we’ll also see how to apply test driven development techniques, cover best practices for security, scalability, and maintainability, and see various tips and tricks for building a compelling user experience. Over 150 pages of hands–on lab material included.

70-511 WINDOWS PRESENTATION FOUNDATION - WPF/XAMLAuthor and instructor: Arne LaugstølWindows Presentation Foundation (WPF) is a .NET technology that makes it possible to create compelling applications with modern user experience. The course covers both the basic things and the advanced stuff you need to know, to be able to give the user a “wow” effect. This course will make you able to take the Exam in 70-511 Windows Application Development with Microsoft .NET Framework 4.

70-583 - MICROSOFT AZURE Author and instructor: Sahil MalikThis course is aimed towards the .NET developer who wishes to further their knowledge about Microsoft’s cloud offering – Azure. There are many parts to Azure, Windows Azure (Compute, Storage, Virtual Machine), SQL Azure, AppFabric and DataMarket. This course methodically looks at each piece and shows you practical usage of what you can use today.

CREATING WINDOWS 8 METRO APPS USING C# AND XAML Author and instructor: Gill CleerenIn this 3 day training course, attendees will learn how to build Windows 8 Metro style applications that offer a great user experience and interact with Windows. Developers will learn how to use the power of the XAML language to build their application all the way from the very first idea of the application to the deployment in the Windows Store. Throughout the course, attendees will see the relation between Windows 8 and other XAML–based technologies such as Silverlight or WPF.

ARCHITECTURE CLINICAuthor and instructor: Shy CohenIt is a 5 day highly interactive event where you will learn, improve, and exercise software architecture skills, all based on the IDesign Method – a breakthrough, battle–proven approach to software architecture that has shown up to 80% reduction in the effort and time required for architecting, designing, and implementing software solutions. Through its application, it produces an easy–to–follow blueprint for the construction of a software system, while covering all the important aspects involved.

WINDOWS COMMUNICATION FOUNDATION (WCF) MASTER CLASSAuthor and instructor: Miguel CastroThe training starts by explaining the motivation for WCF, and then continues to discuss in depth how to develop service–oriented applications using WCF. You will see how to take advantage of built–in features such as service hosting, instance management, asynchronous calls, synchronization, reliability, transaction management, disconnected queued calls, security as well as emerging technologies like cloud computing and the Windows Azure AppFabric service bus.

ASP.NET WEB API & SIGNALR: LIGHTWEIGHT WEB-BASED ARCHITECTURES FOR YOU! Author and instructor: Christian WeierLet's face it! The current trends and developments especially in the area of mobile platforms & devices and cloud computing will cause a re-thinking in architectural aspects for many software projects and products. If you ignore this today you may be in big trouble tomorrow. How can I reach a plethora of users and client devices? How can I integrate my systems and application parts in a lightweight and interoperable manner? How am I able to push data in near-real-time fashion from my services to my clients? This course tries to answer these and more questions. Christian Weyer will show you in a pragmatic way how to face the new challenges. See all of this coming to life by using technologies and frameworks like ASP.NET Web API, SignalR, .NET- and HTML5/Java-Script-based clients - mobile or not.

Sahil Malik

Arjan Einbu

Gill Cleeren

Christian Wenz

Shy Cohen

Miguel Castro

Page 68: Ndc magazine 1 issue

COURSE OVERVIEW OSLO

COURSETITLE

AGILE Days Mar Apr May Jun Location Price

Architecture Skills - Kevlin Henney - 20. November 2014 2 Oslo 18900

Agile Interactions Workshop - Jessie Shternshus 1 02 Plaza 6800

Get Unblocked - Denise Jacobs 1 03 Plaza 6800

BDD - Specification by Example - Gojko Adzic 2 12 Oslo 14900

SCRUM Days Mar Apr May Jun Location Price

Certified Scrum Product Owner - CSPO - Mike Cohn 2 12 04 Oslo 14900

Certified ScrumMaster - CSM - Geoff Watts 2 22 Oslo 14900

Product Owner Survival Camp - Gojko Adzic 1 05 Oslo 14900

Certified ScrumMaster - CSM - Mike Cohn 2 02 Oslo 14900

TEST-DRIVEN DEVELOPMENT Days Mar Apr May Jun Location Price

Test-Driven Development & Refactoring Techniques - Robert C. Martin 3 12 Oslo 18900

Test-Driven Development - Venkat Subramaniam - 18. August 5 Oslo 24900

Test-Driven JavaScript - Christian Johansen 3 26 Oslo 18900

DESIGN - ANALYSIS - ARCHITECTURES Days Mar Apr May Jun Location Price

Evolutionary Design and Architecture for Agile Development - Venkat Subramaniam 4 09 17 Oslo 21900

Agile Design and Modeling for Advanced Object Design with Patterns - Craig Larman - 12 januar 2015 4 Oslo 21900

Architecture Day - Neal Ford, Mark Richards and Venkat Subramaniam 1 20 Felix 1900

Project Design Master Class with Juval Lowy 13. October 5 Oslo 24900

Architecture Skills - Kevlin Henney - 20. november 3 Oslo 18900

MOBILE APPLICATIONS Days Mar Apr May Jun Location Price

Mobile to Multi-Device Web - Luke Wroblewski 1 3 Oslo 6800

Fundamentals of iOS Programming - Wei-Meng Lee 5 19 Oslo 24900

MICROSOFT Days Mar Apr May Jun Location Price

70-513 - WCF 4.5 with Visual Studio 2012 - Sahil Malik 5 12 Oslo 24900

Identity and access control for modern web applications and APIs - Dominick Baier 2 2 Plaza 9800

C#.NET: Utvikling av applikasjoner i .NET med C# - Arjan Einbu 5 5 23 Oslo 24900

Claims-based Identity & Access Control for .NET 4.5 Applications - Dominick Baier 2 9 Oslo 14900

Creating apps for Windows 8.1 using C#, XAML and VS2013 4 Oslo 21900

Web Development in .NET - ASP.NET MVC , HTML5, CSS3, JavaScript - Arjan Einbu 5 17 12 30 Oslo 24900

WPF/XAML - 70-511 / 10262A Windows Presentation Foundation/XAML - Arne Laugstøl 4 1 Oslo 21900

Developing Windows Azure and Web Services - Magnus Mårtensson 4 8 Oslo 21900

Windows Azure Racing Game Workshop - Alan Smith 1 3 Plaza 6800

SHAREPOINT Days Mar Apr May Jun Location Price

SharePoint 2013 and Office 365: End to End for Developers - Sahil Malik 5 13 Oslo 24900

JAVA Days Mar Apr May Jun Location Price

Core Spring - Mårten Haglind 4 6 Oslo 21900

Programming in Java 8 - Venkat Subramaniam 3 19 Oslo 18900

Programming Java Standard Edition - Eivind Nordby 5 Oslo 24900

Java EE Remastered - Mårten Haglind 4 24 Oslo 21900

HTML5 - JavaScript - CSS3 Days Mar Apr May Jun Location Price

JavaScript and HTML5 for Developers - Christian Wenz 3 11 Oslo 18900

JavaScript for programmers - Christian Johansen 3 23 Oslo 18900

68

Page 69: Ndc magazine 1 issue

www.programutvikling.no

Test-Driven JavaScript with Christian Johansen 3 26 Oslo 18900

AngularJS End-to-End SPA Development - Dan Wahlin 4 7 Oslo 21900

AngularJS workshop - Scott Allen 2 2 Plaza 9500

C++ Days Mar Apr May Jun Location Price

Advanced C++ programming and Introduction to C++11 - Hubert Matthews 4 24 Oslo 21900

C++ for Embedded Developers - Mike Tarlton 5 24 Oslo 24900

C++11 programming - Hubert Matthews 3 12 Kongs-berg 18900

Scalable design and implementation using C++ - Andrei Alexandrescu 2 2 Plaza 14900

C Days Mar Apr May Jun Location Price

Deep C: Et kurs for erfarne C og C++ programmerere - Olve Maudal - 28. August 2 24 Oslo 14900

DATABASE Days Mar Apr May Jun Location Price

Databasedesign, -implementering og SQL-programmering - Dag Hoftun Knutsen 4 5 Oslo 21900

PROGRAMMING Days Mar Apr May Jun Location Price

Objektorientert utvikling - Eivind Nordby 4 16 Oslo 21900

PRE-CONFERENCE WORKSHOPS AT NDC OSLO Days Mar Apr May Jun Location Price

Advanced Git and GitHub - Tim Berglund 1 3 Plaza 6800

Agile Interactions Workshop - Jessie Shternshus 1 2 Plaza 6800

AngularJS workshop - Scott Allen 2 2 Plaza 9500

Get Unblocked - Denise Jacobs 1 3 Plaza 6800

GitHub Foundations - Tim Berglund 1 2 Plaza 6800

Identity and access control for modern web applications and APIs - Dominick Baier 2 2 Plaza 9500

Information Alchemy: Crafting Better Presentations through Patterns - Neal Ford 1 2 Plaza 6800

Mobile to Multi-Device Web - Luke Wroblewski 1 3 Plaza 6800

Windows Azure Racing Game Workshop - Alan Smith 1 3 Plaza 6800

HOW TO FIND US PROGRAMUTVIKLING MAIN OFFICE, OSLO

ProgramUtvikling AS is located in the IT-Fornebu technology park at Snarøya.

ADDRESSMartin Lingesvei 17-25, 1367 Snarøya.

Our offices and course rooms are situated in the terminal building of the former Oslo airport. The photo shows the car park, bus stop and course rooms. For details of bus times, go to trafikanten.no

Entrance

Parking

Bus stop

FOLLOW US ON

twitter.com/progutvikling www.programutvikling.no/feed/news.aspx [email protected] facebook.com/programutvikling

ENROLMENT OPTIONSwww.programutvikling.no - [email protected] Tel.: +47 67 10 65 65 - Fax: +47 67 82 72 31

69

Page 70: Ndc magazine 1 issue

Scott AllenAngularJS workshopAngularJS brings testable architectural patterns to applications built with HTML 5. This course explains and demonstrates the many features of AngularJS, including directives, filters, routing, controllers, templates, services, views. But, the best applications need more than a single framework. We’ll also learn about responsive design, Bootstrap, and the latest HTML 5 features including local storage, the canvas, web workers, web sockets, and more.

Pablo Cibraro and Pedro FélixDesigning and implementing Web APIs in the .NET platform Web APIs are application programming interfaces exposed on the Web, using HTTP as an application protocol. They play an increasingly important role in the architecture of modern mobile-enabled distributed applications.This workshop aims to provide the attendees with both the technological and architectural knowledge required to design and implement Web APIs in the .NET platform.

Tim BerglundGitHub FoundationsThis six-hour workshop gets you up and running with Git and GitHub. We’ll cover the basics of the Git command line interface, introduce you to graphical clients, and learn how to collaborate using pull requests on GitHub.com. No matter whether you work in open source, for a small company, or in a large enterprise, this is the introductory course for you.

Jessie ShternshuAgile Interactions WorkshopThe most important factor of an Agile team is the teams ability to communicate effectively. We often only focus on the technical aspect of things, when really most of the breakdowns happen when the team can´t communicate with one another. Understanding how to interact with your internal and external team is vital to the entire agile process.

Gael FraiteurAdvanced PostSharp From the Horse’s Mouth Most people know PostSharp for logging or exception handling, but those who dare to go deeper often change the way they think about programming – forever. Delivered by PostSharp’s founder and lead engineer Gael Fraiteur, this course explores the concepts of aspect-oriented programming, explains how to automate the implementation of design patterns, and describes how to validate design rules and architecture.

Neal FordInformation Alchemy: Crafting Better Presentations through PatternsPatterns are like the lower-level steps found inside recipes; they are the techniques you must master to be considered a master chef or master presenter. You can use the patterns in this session to construct your own recipes for different contexts, such as business meetings, technical demonstrations, scientific expositions and keynotes, just to name a few.

2 DAYS OF WORKSHOPS ON TOP OF RADISSON BLU PLAZA

2 DAYS - JUNE 2-3rd

DAY 1 - JUNE 2nd

@NDC_conferences #ndcoslo

Venkat SubramaniamProgramming in Functional Style“Functional programming,” yes, everyone’s talking about it. But why? What’s this new excitement about something that’s been around for a very long time in some esoteric languages. For one thing, most mainstream languages now support it. C#, Java, C++,... To program in functional style you don’t have to change the language, but you have to change how you program in that language.

Dominick Baier and Brock AllenIdentity and access control for modern web applications and APIs With ASP.NET MVC, Web API and SignalR tied together using the new OWIN and Katana framework, Microsoft provides a compelling server-side stack to write modern web applications and services. In this new world we typically want to connect client platforms like iOS, Windows or Android as well as JavaScript-based applications using frameworks like AngularJS.

Denise JacobsGet UnblockedAs creative professionals, we are called upon to produce and deliver original strategies and solutions to make our companies or clients stand out in the crowd, requiring a high level of creative thinking and generation of innovative ideas.

Luke Wroblewski Mobile to Multi-Device WebThe web no longer starts and ends on our desktop and laptop computers. Today, the tremendous growth of mobile devices is turning more and more people into multi-device and, as a result, cross-device users.

Tim BerglundAdvanced Git and GitHubYou already know the basics of Git and GitHub, and you’re ready for more. This six-hour workshop will equip you with the advanced skills you need to become the Git and GitHub expert on your team. Whether you work in open source, for a small company, or in a large enterprise, this is course is for you.

Alan SmithWindows Azure Racing Game WorkshopThe Windows Azure racing game workshop will focus on the use of Windows Azure services to host a back end system for real-time telemetry processing in a 3D racing game. The use of asynchronous queues, worker roles, storage services and websites will be explained. Techniques for real-time data stream processing, data archiving and report generation will be discussed and explored.

Kevlin HenneyIntroduction to TDD with a differenceBring your laptop to this hands-on workshop. Everything will be built up from first principles, including writing a simple testing framework. Language used: C#

2 DAYS OF WORKSHOPS ON TOP OF RADISSON BLU PLAZA

2 DAYS - JUNE 2-3rd

DAY 2 - JUNE 3rd

DAY 1 - JUNE 2nd

You may attend these workshops without going to the conference

Workshops are included in the

NDC ALL ACCESS CONFERENCE PASS

25% VAT will be added

25% VAT will be added

2 Day Pass NOK 9800

1 Day Pass NOK 6800

NOK 18500

ndcoslo.com

Page 71: Ndc magazine 1 issue

Venkat SubramaniamProgramming in Functional Style“Functional programming,” yes, everyone’s talking about it. But why? What’s this new excitement about something that’s been around for a very long time in some esoteric languages. For one thing, most mainstream languages now support it. C#, Java, C++,... To program in functional style you don’t have to change the language, but you have to change how you program in that language.

Dominick Baier and Brock AllenIdentity and access control for modern web applications and APIs With ASP.NET MVC, Web API and SignalR tied together using the new OWIN and Katana framework, Microsoft provides a compelling server-side stack to write modern web applications and services. In this new world we typically want to connect client platforms like iOS, Windows or Android as well as JavaScript-based applications using frameworks like AngularJS.

Denise JacobsGet UnblockedAs creative professionals, we are called upon to produce and deliver original strategies and solutions to make our companies or clients stand out in the crowd, requiring a high level of creative thinking and generation of innovative ideas.

Luke Wroblewski Mobile to Multi-Device WebThe web no longer starts and ends on our desktop and laptop computers. Today, the tremendous growth of mobile devices is turning more and more people into multi-device and, as a result, cross-device users.

Tim BerglundAdvanced Git and GitHubYou already know the basics of Git and GitHub, and you’re ready for more. This six-hour workshop will equip you with the advanced skills you need to become the Git and GitHub expert on your team. Whether you work in open source, for a small company, or in a large enterprise, this is course is for you.

Alan SmithWindows Azure Racing Game WorkshopThe Windows Azure racing game workshop will focus on the use of Windows Azure services to host a back end system for real-time telemetry processing in a 3D racing game. The use of asynchronous queues, worker roles, storage services and websites will be explained. Techniques for real-time data stream processing, data archiving and report generation will be discussed and explored.

Kevlin HenneyIntroduction to TDD with a differenceBring your laptop to this hands-on workshop. Everything will be built up from first principles, including writing a simple testing framework. Language used: C#

2 DAYS OF WORKSHOPS ON TOP OF RADISSON BLU PLAZA

2 DAYS - JUNE 2-3rd

DAY 2 - JUNE 3rd

DAY 1 - JUNE 2nd

You may attend these workshops without going to the conference

Workshops are included in the

NDC ALL ACCESS CONFERENCE PASS

25% VAT will be added

25% VAT will be added

2 Day Pass NOK 9800

1 Day Pass NOK 6800

NOK 18500

ndcoslo.com

Page 72: Ndc magazine 1 issue

Donation

SMSAPI

Survey

Posisjonering

Merge

SMS

Loyalty Club

LOVESMS

Positio

nin

g

Voting

Vo

ting

Mobile

marketing

MarketingPassword

RemindersWarnings

Ordering

Confirmation

SMS

BillingHLR

VerifyingQuest SMS Loyalty Club

Pass

wo

rd

Survey

HLR Contact

update

Rabekkgata 9, Moss - Norway

[email protected] l +47 69 20 69 20

For more information:

www.vianett.com We love SMS!

The fast way to integrate

SMSinto your software

Donation

Reminders

Survey

PositioningMerge

SMSPayment

Payment

Positio

nin

g

Voting

Vo

ting

Marketing

Password

Password

Booking

Ordering

Ordering

Confirmation

SMS

Billing

MMSHLR

VerifyingGet inspired

AskSign up now for a free developer account: www.vianett.com/developer

JavaHTTP

ASP

COM

SMPP

MSSQL

YAP

SMTPFTP

Web Services

C#

“ViaNett`s API`s are simple and easy to understand, well documented and their support is excellent”

Erik Lerbæk IT-manager, Viking Redningstjeneste AS

Returadresse: ProgramUtvikling AS. Postboks 1, 1330 Fornebu