SlideShare a Scribd company logo
1 of 37
WHY LEARN NEW
PROGRAMMING LANGUAGES?

What I’ve learned from Ruby and Scheme that
applies to my daily work in C# and JavaScript




               Trondheim XP Meetup
  Jonas Follesø, Scientist/Manager BEKK Trondheim
                   08/02/2012
3
PERSONAL HISTORY OF PROGRAMMING LANGUAGES                                4




                 QBasic             Turbo Pascal    Delphi    VBScript
                  (1996)               (1998)        (1999)    (2001)




   C#      JavaScript      Java        Python      Scheme      Ruby
  (2002)     (2003)        (2004)       (2005)      (2006)     (2010)
PERSONAL HISTORY OF PROGRAMMING LANGUAGES                                5




                 QBasic             Turbo Pascal    Delphi    VBScript
                  (1996)               (1998)        (1999)    (2001)




   C#      JavaScript      Java        Python      Scheme      Ruby
  (2002)     (2003)        (2004)       (2005)      (2006)     (2010)
HIGHER ORDER FUNCTIONS                 6




       Formulating Abstractions with
          Higher-Order Functions
ABSTRACTIONS THROUGH FUNCTIONS   7




(* 3 3 3) ; outputs 27

(define (cube x)
  (* x x x))

(cube 3) ; outputs 27
ABSTRACTIONS THROUGH FUNCTIONS               8




(define (sum-int a b)
  (if (> a b)
      0
      (+ a (sum-int (+ a 1) b))))


(define (sum-cubes a b)
  (if (> a b)
      0
      (+ (cube a) (sum-cubes (+ a 1) b))))
ABSTRACTIONS THROUGH FUNCTIONS               9




(define (sum-int a b)
  (if (> a b)
      0
      (+ a (sum-int (+ a 1) b))))


(define (sum-cubes a b)
  (if (> a b)
      0
      (+ (cube a) (sum-cubes (+ a 1) b))))
ABSTRACTIONS THROUGH FUNCTIONS             10




(define (<name> a b)
  (if (> a b)
      0
      (+ <term> (<name> (<next> a) b))))
ABSTRACTIONS THROUGH FUNCTIONS                    11




(define (sum term a next b)
  (if (> a b)
      0
      (+ (term a) (sum term (next a) next b))))

(define (inc n) (+ n 1))
(define (identity n) n)

(define (sum-int a b) (sum identity a inc b))
(define (sum-cubes a b) (sum cube a inc b))

(sum-int 0 10) ; outputs 55
(sum-cubes 0 10) ; outputs 3025
ABSTRACTIONS THROUGH FUNCTIONS                    12




(define (sum term a next b)
  (if (> a b)
      0
      (+ (term a) (sum term (next a) next b))))

(define (inc n) (+ n 1))
(define (identity n) n)

(define (sum-int a b) (sum identity a inc b))
(define (sum-cubes a b) (sum cube a inc b))

(sum-int 0 10) ; outputs 55
(sum-cubes 0 10) ; outputs 3025
ABSTRACTIONS THROUGH FUNCTIONS - JAVASCRIPT   13




$("li").click(function() {
    $(this).css({'color':'yellow'});
});

$("li").filter(function(index) {
    return index % 3 == 2;
}).css({'color':'red'});

$.get("/some-content", function(data) {
    // update page with data...
});
ABSTRACTIONS THROUGH FUNCTIONS – C#                    14




SumEvenCubes(1, 10); // outputs 1800

public int SumEvenCubes() {
    var num = new[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
    return num
             .Where(IsEven)
             .Select(Cube)
             .Aggregate(Sum);
}

public bool IsEven(int n) { return n % 2 == 0; }
public int Cube(int n) { return n*n*n; }
public int Sum(int a, int b) { return a + b; }
OBJECTS FROM CLOSURES                 15




             You don’t need classes
               to create objects
OBJECTS FROM CLOSURES IN SCHEME             16


(define (make-account balance)

  (define (withdraw amount)
    (if (>= balance amount)
        (set! balance (- balance amount))
        "Insufficient funds"))

  (define (deposit amount)
    (set! balance (+ balance amount))
    balance)

  (define (dispatch m . args)
    (case m
      ((withdraw) (apply withdraw args))
      ((deposit) (apply deposit args))))

  dispatch)

(define account1 (make-account 100))
(account1 'withdraw 50)
(account1 'deposit 25) ; outputs 75
OBJECTS FROM CLOSURES IN JAVASCRIPT                 17


var make_account = function (balance) {
    var withdraw = function (amount) {
        if (balance >= amount) balance -= amount;
        else throw "Insufficient funds";
        return balance;
    };
    var deposit = function (amount) {
        balance += amount;
        return balance;
    };
    return {
        withdraw: withdraw,
        deposit: deposit
    };
};

var account1 = make_account(100);
account1.withdraw(50);
account1.deposit(25); // outputs 75
READABILITY                       18




              Extreme emphasis
              on expressiveness
READABILITY                                   19




 “[…] we need to focus on humans, on how
 humans care about doing programming or
 operating the application of the machines.
 We are the masters. They are the slaves…”
EXAMPLES OF RUBY IDIOMS          20




abort unless str.include? "OK"

x = x * 2 until x > 100

3.times { puts "olleh" }

10.days_ago
2.minutes + 30.seconds

1.upto(100) do |i|
  puts i
end
EXAMPLE OF RSPEC TEST                        21




describe Bowling do
    it "should score 0 for gutter game" do
        bowling = Bowling.new
        20.times { bowling.hit(0) }
        bowling.score.should == 0
    end
end
C# UNIT TEST INFLUENCED BY RSPEC                          22



public class Bowling_specs {
    public void Should_score_0_for_gutter_game() {
        var bowling = new Bowling();
        20.Times(() => bowling.Hit(0));
        bowling.Score.Should().Be(0);
    }
}

public static class IntExtensions {
    public static void Times(this int times, Action action) {
        for (int i = 0; i <= times; ++i)
            action();
    }
}
C# FLUENT ASSERTIONS                                             23



string actual = "ABCDEFGHI";

actual.Should().StartWith("AB")
               .And.EndWith("HI")
               .And.Contain("EF")
               .And.HaveLength(9);

IEnumerable collection = new[] { 1, 2, 3 };
collection.Should().HaveCount(4, "we put three items in collection"))
collection.Should().Contain(i => i > 0);
READABILITY                        24




              Internal DSLs and
               Fluent Interfaces
RUBY DSL EXAMPLES - MARKABY   25
RUBY DSL EXAMPLES – ENUMERABLE PROXY API   26
C# LINQ EXAMPLE                                               27


static void Main(string[] args)
{
    var people = new[] {
        new Person { Age=28, Name   =   "Jonas Follesø"},
        new Person { Age=25, Name   =   "Per Persen"},
        new Person { Age=55, Name   =   "Ole Hansen"},
        new Person { Age=40, Name   =   "Arne Asbjørnsen"},
    };

    var old = from p in people
              where p.Age > 25
              orderby p.Name ascending
              select p;

    foreach(var p in old) Console.WriteLine(p.Name);
}

---
Arne Asbjørnsen
Jonas Follesø
Ole Hansen
C# STORYQ EXAMPLE                                            28


[Test]
public void Gutter_game()
{
    new Story("Score calculation")
        .InOrderTo("Know my performance")
        .AsA("Player")
        .IWant("The system to calculate my total score")
            .WithScenario("Gutter game")
                .Given(ANewBowlingGame)
                .When(AllOfMyBallsAreLandingInTheGutter)
                .Then(MyTotalScoreShouldBe, 0)
            .WithScenario("All strikes")
                .Given(ANewBowlingGame)
                .When(AllOfMyBallsAreStrikes)
                .Then(MyTotalScoreShouldBe, 300)
        .ExecuteWithReport(MethodBase.GetCurrentMethod());
}
C# OBJECT BUILDER PATTERN                                           29


[Test]
public void Should_generate_shipping_statement_for_order()
{
    Order order = Build
                    .AnOrder()
                    .ForCustomer(Build.ACustomer())
                    .WithLine("Some product", quantity: 1)
                    .WithLine("Some other product", quantity: 2);

    var orderProcessing = new OrderProcessing();
    orderProcessing.ProcessOrder(order);
}
MONKEY PATCHING                       30




         Runtime generation of code
              and behaviour
RUBY ACTIVE RECORD AND METHOD MISSING   31
C# DYNAMIC AND EXPANDO OBJECT                                  32


static void Main(string[] args)
{
    dynamic person = new ExpandoObject();
    person.Name = "Jonas Follesø";
    person.Age = 28;

    Console.WriteLine("{0} ({1})", person.Name, person.Age);
}

Jonas Follesø (28)
C# MONKEY PATCHING                                                  33


public class DynamicRequest : DynamicObject
{
    public override bool TryGetMember(GetMemberBinder binder,
                                               out object result)
    {
        string key = binder.Name;
        result = HttpContext.Current.Request[key] ?? "";
        return true;
    }
}

@using MvcApplication1.Controllers
@{
    Page.Request = new DynamicRequest();
}

<h4>Hello @Page.Request.Name</h4>
<h4>Hello @HttpContext.Current.Request["Name"]</h4>
C# MICRO ORMS                                                34




• Afrer C# 4.0 with support for dynamic typing a whole new
  category of micro ORMs has emerged:

 • Massive
 • Simple.Data
 • Peta Pico
 • Dapper
C# MICRO ORMS                                                       35




IEnumerable<User> u = db.Users.FindAllByName("Bob").Cast<User>();


db.Users.FindByNameAndPassword(name, password)
// SELECT * FROM Users WHERE Name = @p1 and Password = @p2


db.Users.FindAllByJoinDate("2010-01-01".to("2010-12-31"))
// SELECT * FROM [Users] WHERE [Users].[JoinDate] <= @p1
SAPIR–WHORF HYPOTHESIS                                                 36




 The principle of linguistic relativity holds that
 the structure of a language affects the ways in
 which its speakers are able to conceptualize their
 world, i.e. their world view.

                  http://en.wikipedia.org/wiki/Linguistic_relativity
37




TAKK FOR MEG

   Jonas Follesø

More Related Content

What's hot

The Ring programming language version 1.6 book - Part 183 of 189
The Ring programming language version 1.6 book - Part 183 of 189The Ring programming language version 1.6 book - Part 183 of 189
The Ring programming language version 1.6 book - Part 183 of 189Mahmoud Samir Fayed
 
C Code and the Art of Obfuscation
C Code and the Art of ObfuscationC Code and the Art of Obfuscation
C Code and the Art of Obfuscationguest9006ab
 
Что нам готовит грядущий C#7?
Что нам готовит грядущий C#7?Что нам готовит грядущий C#7?
Что нам готовит грядущий C#7?Andrey Akinshin
 
Python opcodes
Python opcodesPython opcodes
Python opcodesalexgolec
 
Cbse question paper class_xii_paper_2000
Cbse question paper class_xii_paper_2000Cbse question paper class_xii_paper_2000
Cbse question paper class_xii_paper_2000Deepak Singh
 
Modular Module Systems
Modular Module SystemsModular Module Systems
Modular Module Systemsleague
 
Dynamic C++ ACCU 2013
Dynamic C++ ACCU 2013Dynamic C++ ACCU 2013
Dynamic C++ ACCU 2013aleks-f
 
The Ring programming language version 1.3 book - Part 83 of 88
The Ring programming language version 1.3 book - Part 83 of 88The Ring programming language version 1.3 book - Part 83 of 88
The Ring programming language version 1.3 book - Part 83 of 88Mahmoud Samir Fayed
 
C# 6.0 - April 2014 preview
C# 6.0 - April 2014 previewC# 6.0 - April 2014 preview
C# 6.0 - April 2014 previewPaulo Morgado
 
The Ring programming language version 1.9 book - Part 38 of 210
The Ring programming language version 1.9 book - Part 38 of 210The Ring programming language version 1.9 book - Part 38 of 210
The Ring programming language version 1.9 book - Part 38 of 210Mahmoud Samir Fayed
 
Computer Graphics Lab File C Programs
Computer Graphics Lab File C ProgramsComputer Graphics Lab File C Programs
Computer Graphics Lab File C ProgramsKandarp Tiwari
 
Cg my own programs
Cg my own programsCg my own programs
Cg my own programsAmit Kapoor
 
The Ring programming language version 1.8 book - Part 73 of 202
The Ring programming language version 1.8 book - Part 73 of 202The Ring programming language version 1.8 book - Part 73 of 202
The Ring programming language version 1.8 book - Part 73 of 202Mahmoud Samir Fayed
 
Class list data structure
Class list data structureClass list data structure
Class list data structureKatang Isip
 
C# v8 new features - raimundas banevicius
C# v8 new features - raimundas baneviciusC# v8 new features - raimundas banevicius
C# v8 new features - raimundas baneviciusRaimundas Banevičius
 

What's hot (20)

The Ring programming language version 1.6 book - Part 183 of 189
The Ring programming language version 1.6 book - Part 183 of 189The Ring programming language version 1.6 book - Part 183 of 189
The Ring programming language version 1.6 book - Part 183 of 189
 
C Code and the Art of Obfuscation
C Code and the Art of ObfuscationC Code and the Art of Obfuscation
C Code and the Art of Obfuscation
 
Что нам готовит грядущий C#7?
Что нам готовит грядущий C#7?Что нам готовит грядущий C#7?
Что нам готовит грядущий C#7?
 
Python opcodes
Python opcodesPython opcodes
Python opcodes
 
Advance java
Advance javaAdvance java
Advance java
 
Cbse question paper class_xii_paper_2000
Cbse question paper class_xii_paper_2000Cbse question paper class_xii_paper_2000
Cbse question paper class_xii_paper_2000
 
Modular Module Systems
Modular Module SystemsModular Module Systems
Modular Module Systems
 
Metaprogramming
MetaprogrammingMetaprogramming
Metaprogramming
 
Dynamic C++ ACCU 2013
Dynamic C++ ACCU 2013Dynamic C++ ACCU 2013
Dynamic C++ ACCU 2013
 
The Ring programming language version 1.3 book - Part 83 of 88
The Ring programming language version 1.3 book - Part 83 of 88The Ring programming language version 1.3 book - Part 83 of 88
The Ring programming language version 1.3 book - Part 83 of 88
 
C# 6.0 - April 2014 preview
C# 6.0 - April 2014 previewC# 6.0 - April 2014 preview
C# 6.0 - April 2014 preview
 
C++ TUTORIAL 4
C++ TUTORIAL 4C++ TUTORIAL 4
C++ TUTORIAL 4
 
The Ring programming language version 1.9 book - Part 38 of 210
The Ring programming language version 1.9 book - Part 38 of 210The Ring programming language version 1.9 book - Part 38 of 210
The Ring programming language version 1.9 book - Part 38 of 210
 
Computer Graphics Lab File C Programs
Computer Graphics Lab File C ProgramsComputer Graphics Lab File C Programs
Computer Graphics Lab File C Programs
 
Cg my own programs
Cg my own programsCg my own programs
Cg my own programs
 
Container adapters
Container adaptersContainer adapters
Container adapters
 
The Ring programming language version 1.8 book - Part 73 of 202
The Ring programming language version 1.8 book - Part 73 of 202The Ring programming language version 1.8 book - Part 73 of 202
The Ring programming language version 1.8 book - Part 73 of 202
 
OOP v3
OOP v3OOP v3
OOP v3
 
Class list data structure
Class list data structureClass list data structure
Class list data structure
 
C# v8 new features - raimundas banevicius
C# v8 new features - raimundas baneviciusC# v8 new features - raimundas banevicius
C# v8 new features - raimundas banevicius
 

Viewers also liked

Introduction to MonoTouch
Introduction to MonoTouchIntroduction to MonoTouch
Introduction to MonoTouchJonas Follesø
 
Hvordan lage en vellykket WP7 applikasjon
Hvordan lage en vellykket WP7 applikasjonHvordan lage en vellykket WP7 applikasjon
Hvordan lage en vellykket WP7 applikasjonJonas Follesø
 
Hvordan lage en vellykket Windows Phone 7 App
Hvordan lage en vellykket Windows Phone 7 AppHvordan lage en vellykket Windows Phone 7 App
Hvordan lage en vellykket Windows Phone 7 AppJonas Follesø
 
Smidig 2011 TDD Workshop
Smidig 2011 TDD WorkshopSmidig 2011 TDD Workshop
Smidig 2011 TDD WorkshopJonas Follesø
 
BK2011 Trafikanten - Et webprosjekt med full oppgradering av karttjenester
BK2011 Trafikanten - Et webprosjekt med full oppgradering av karttjenesterBK2011 Trafikanten - Et webprosjekt med full oppgradering av karttjenester
BK2011 Trafikanten - Et webprosjekt med full oppgradering av karttjenesterGeodata AS
 
An overview of the Windows Phone 7 platform
An overview of the Windows Phone 7 platformAn overview of the Windows Phone 7 platform
An overview of the Windows Phone 7 platformJonas Follesø
 
Smidig brukeropplevelse med skjermbildeprototyper (Smidig2009)
Smidig brukeropplevelse med skjermbildeprototyper (Smidig2009)Smidig brukeropplevelse med skjermbildeprototyper (Smidig2009)
Smidig brukeropplevelse med skjermbildeprototyper (Smidig2009)Jonas Follesø
 
Get a flying start with Windows Phone 7 - NDC2010
Get a flying start with Windows Phone 7 - NDC2010Get a flying start with Windows Phone 7 - NDC2010
Get a flying start with Windows Phone 7 - NDC2010Jonas Follesø
 
Cross platform mobile apps using .NET
Cross platform mobile apps using .NETCross platform mobile apps using .NET
Cross platform mobile apps using .NETJonas Follesø
 

Viewers also liked (9)

Introduction to MonoTouch
Introduction to MonoTouchIntroduction to MonoTouch
Introduction to MonoTouch
 
Hvordan lage en vellykket WP7 applikasjon
Hvordan lage en vellykket WP7 applikasjonHvordan lage en vellykket WP7 applikasjon
Hvordan lage en vellykket WP7 applikasjon
 
Hvordan lage en vellykket Windows Phone 7 App
Hvordan lage en vellykket Windows Phone 7 AppHvordan lage en vellykket Windows Phone 7 App
Hvordan lage en vellykket Windows Phone 7 App
 
Smidig 2011 TDD Workshop
Smidig 2011 TDD WorkshopSmidig 2011 TDD Workshop
Smidig 2011 TDD Workshop
 
BK2011 Trafikanten - Et webprosjekt med full oppgradering av karttjenester
BK2011 Trafikanten - Et webprosjekt med full oppgradering av karttjenesterBK2011 Trafikanten - Et webprosjekt med full oppgradering av karttjenester
BK2011 Trafikanten - Et webprosjekt med full oppgradering av karttjenester
 
An overview of the Windows Phone 7 platform
An overview of the Windows Phone 7 platformAn overview of the Windows Phone 7 platform
An overview of the Windows Phone 7 platform
 
Smidig brukeropplevelse med skjermbildeprototyper (Smidig2009)
Smidig brukeropplevelse med skjermbildeprototyper (Smidig2009)Smidig brukeropplevelse med skjermbildeprototyper (Smidig2009)
Smidig brukeropplevelse med skjermbildeprototyper (Smidig2009)
 
Get a flying start with Windows Phone 7 - NDC2010
Get a flying start with Windows Phone 7 - NDC2010Get a flying start with Windows Phone 7 - NDC2010
Get a flying start with Windows Phone 7 - NDC2010
 
Cross platform mobile apps using .NET
Cross platform mobile apps using .NETCross platform mobile apps using .NET
Cross platform mobile apps using .NET
 

Similar to Why learn new programming languages

Aaron Bedra - Effective Software Security Teams
Aaron Bedra - Effective Software Security TeamsAaron Bedra - Effective Software Security Teams
Aaron Bedra - Effective Software Security Teamscentralohioissa
 
The Ring programming language version 1.2 book - Part 79 of 84
The Ring programming language version 1.2 book - Part 79 of 84The Ring programming language version 1.2 book - Part 79 of 84
The Ring programming language version 1.2 book - Part 79 of 84Mahmoud Samir Fayed
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with ClojureDmitry Buzdin
 
Design Patterns - Compiler Case Study - Hands-on Examples
Design Patterns - Compiler Case Study - Hands-on ExamplesDesign Patterns - Compiler Case Study - Hands-on Examples
Design Patterns - Compiler Case Study - Hands-on ExamplesGanesh Samarthyam
 
The Ring programming language version 1.5 book - Part 3 of 31
The Ring programming language version 1.5 book - Part 3 of 31The Ring programming language version 1.5 book - Part 3 of 31
The Ring programming language version 1.5 book - Part 3 of 31Mahmoud Samir Fayed
 
BDD - Behavior Driven Development Webapps mit Groovy Spock und Geb
BDD - Behavior Driven Development Webapps mit Groovy Spock und GebBDD - Behavior Driven Development Webapps mit Groovy Spock und Geb
BDD - Behavior Driven Development Webapps mit Groovy Spock und GebChristian Baranowski
 
The Ring programming language version 1.10 book - Part 22 of 212
The Ring programming language version 1.10 book - Part 22 of 212The Ring programming language version 1.10 book - Part 22 of 212
The Ring programming language version 1.10 book - Part 22 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 14 of 181
The Ring programming language version 1.5.2 book - Part 14 of 181The Ring programming language version 1.5.2 book - Part 14 of 181
The Ring programming language version 1.5.2 book - Part 14 of 181Mahmoud Samir Fayed
 
Emerging Languages: A Tour of the Horizon
Emerging Languages: A Tour of the HorizonEmerging Languages: A Tour of the Horizon
Emerging Languages: A Tour of the HorizonAlex Payne
 
TDD CrashCourse Part3: TDD Techniques
TDD CrashCourse Part3: TDD TechniquesTDD CrashCourse Part3: TDD Techniques
TDD CrashCourse Part3: TDD TechniquesDavid Rodenas
 
Mary Had a Little λ (QCon)
Mary Had a Little λ (QCon)Mary Had a Little λ (QCon)
Mary Had a Little λ (QCon)Stephen Chin
 
The Ring programming language version 1.9 book - Part 99 of 210
The Ring programming language version 1.9 book - Part 99 of 210The Ring programming language version 1.9 book - Part 99 of 210
The Ring programming language version 1.9 book - Part 99 of 210Mahmoud Samir Fayed
 
Computer science-2010-cbse-question-paper
Computer science-2010-cbse-question-paperComputer science-2010-cbse-question-paper
Computer science-2010-cbse-question-paperDeepak Singh
 
The Ring programming language version 1.2 book - Part 19 of 84
The Ring programming language version 1.2 book - Part 19 of 84The Ring programming language version 1.2 book - Part 19 of 84
The Ring programming language version 1.2 book - Part 19 of 84Mahmoud Samir Fayed
 
Programmation fonctionnelle Scala
Programmation fonctionnelle ScalaProgrammation fonctionnelle Scala
Programmation fonctionnelle ScalaSlim Ouertani
 
Java Performance Puzzlers
Java Performance PuzzlersJava Performance Puzzlers
Java Performance PuzzlersDoug Hawkins
 
Functional Design Explained (David Sankel CppCon 2015)
Functional Design Explained (David Sankel CppCon 2015)Functional Design Explained (David Sankel CppCon 2015)
Functional Design Explained (David Sankel CppCon 2015)sankeld
 
Дмитрий Верескун «Синтаксический сахар C#»
Дмитрий Верескун «Синтаксический сахар C#»Дмитрий Верескун «Синтаксический сахар C#»
Дмитрий Верескун «Синтаксический сахар C#»SpbDotNet Community
 
The Ring programming language version 1.5.1 book - Part 36 of 180
The Ring programming language version 1.5.1 book - Part 36 of 180The Ring programming language version 1.5.1 book - Part 36 of 180
The Ring programming language version 1.5.1 book - Part 36 of 180Mahmoud Samir Fayed
 

Similar to Why learn new programming languages (20)

Aaron Bedra - Effective Software Security Teams
Aaron Bedra - Effective Software Security TeamsAaron Bedra - Effective Software Security Teams
Aaron Bedra - Effective Software Security Teams
 
The Ring programming language version 1.2 book - Part 79 of 84
The Ring programming language version 1.2 book - Part 79 of 84The Ring programming language version 1.2 book - Part 79 of 84
The Ring programming language version 1.2 book - Part 79 of 84
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with Clojure
 
Design Patterns - Compiler Case Study - Hands-on Examples
Design Patterns - Compiler Case Study - Hands-on ExamplesDesign Patterns - Compiler Case Study - Hands-on Examples
Design Patterns - Compiler Case Study - Hands-on Examples
 
The Ring programming language version 1.5 book - Part 3 of 31
The Ring programming language version 1.5 book - Part 3 of 31The Ring programming language version 1.5 book - Part 3 of 31
The Ring programming language version 1.5 book - Part 3 of 31
 
BDD - Behavior Driven Development Webapps mit Groovy Spock und Geb
BDD - Behavior Driven Development Webapps mit Groovy Spock und GebBDD - Behavior Driven Development Webapps mit Groovy Spock und Geb
BDD - Behavior Driven Development Webapps mit Groovy Spock und Geb
 
The Ring programming language version 1.10 book - Part 22 of 212
The Ring programming language version 1.10 book - Part 22 of 212The Ring programming language version 1.10 book - Part 22 of 212
The Ring programming language version 1.10 book - Part 22 of 212
 
The Ring programming language version 1.5.2 book - Part 14 of 181
The Ring programming language version 1.5.2 book - Part 14 of 181The Ring programming language version 1.5.2 book - Part 14 of 181
The Ring programming language version 1.5.2 book - Part 14 of 181
 
Emerging Languages: A Tour of the Horizon
Emerging Languages: A Tour of the HorizonEmerging Languages: A Tour of the Horizon
Emerging Languages: A Tour of the Horizon
 
Novidades do c# 7 e 8
Novidades do c# 7 e 8Novidades do c# 7 e 8
Novidades do c# 7 e 8
 
TDD CrashCourse Part3: TDD Techniques
TDD CrashCourse Part3: TDD TechniquesTDD CrashCourse Part3: TDD Techniques
TDD CrashCourse Part3: TDD Techniques
 
Mary Had a Little λ (QCon)
Mary Had a Little λ (QCon)Mary Had a Little λ (QCon)
Mary Had a Little λ (QCon)
 
The Ring programming language version 1.9 book - Part 99 of 210
The Ring programming language version 1.9 book - Part 99 of 210The Ring programming language version 1.9 book - Part 99 of 210
The Ring programming language version 1.9 book - Part 99 of 210
 
Computer science-2010-cbse-question-paper
Computer science-2010-cbse-question-paperComputer science-2010-cbse-question-paper
Computer science-2010-cbse-question-paper
 
The Ring programming language version 1.2 book - Part 19 of 84
The Ring programming language version 1.2 book - Part 19 of 84The Ring programming language version 1.2 book - Part 19 of 84
The Ring programming language version 1.2 book - Part 19 of 84
 
Programmation fonctionnelle Scala
Programmation fonctionnelle ScalaProgrammation fonctionnelle Scala
Programmation fonctionnelle Scala
 
Java Performance Puzzlers
Java Performance PuzzlersJava Performance Puzzlers
Java Performance Puzzlers
 
Functional Design Explained (David Sankel CppCon 2015)
Functional Design Explained (David Sankel CppCon 2015)Functional Design Explained (David Sankel CppCon 2015)
Functional Design Explained (David Sankel CppCon 2015)
 
Дмитрий Верескун «Синтаксический сахар C#»
Дмитрий Верескун «Синтаксический сахар C#»Дмитрий Верескун «Синтаксический сахар C#»
Дмитрий Верескун «Синтаксический сахар C#»
 
The Ring programming language version 1.5.1 book - Part 36 of 180
The Ring programming language version 1.5.1 book - Part 36 of 180The Ring programming language version 1.5.1 book - Part 36 of 180
The Ring programming language version 1.5.1 book - Part 36 of 180
 

More from Jonas Follesø

Windows Phone 7 lyntale fra Grensesnittet Desember 2010
Windows Phone 7 lyntale fra Grensesnittet Desember 2010Windows Phone 7 lyntale fra Grensesnittet Desember 2010
Windows Phone 7 lyntale fra Grensesnittet Desember 2010Jonas Follesø
 
NNUG Trondheim 30.09.2010 - Windows Phone 7
NNUG Trondheim 30.09.2010 -  Windows Phone 7NNUG Trondheim 30.09.2010 -  Windows Phone 7
NNUG Trondheim 30.09.2010 - Windows Phone 7Jonas Follesø
 
Generating characterization tests for legacy code
Generating characterization tests for legacy codeGenerating characterization tests for legacy code
Generating characterization tests for legacy codeJonas Follesø
 
MVVM Design Pattern NDC2009
MVVM Design Pattern NDC2009MVVM Design Pattern NDC2009
MVVM Design Pattern NDC2009Jonas Follesø
 
Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008Jonas Follesø
 

More from Jonas Follesø (6)

Introduction to F#
Introduction to F#Introduction to F#
Introduction to F#
 
Windows Phone 7 lyntale fra Grensesnittet Desember 2010
Windows Phone 7 lyntale fra Grensesnittet Desember 2010Windows Phone 7 lyntale fra Grensesnittet Desember 2010
Windows Phone 7 lyntale fra Grensesnittet Desember 2010
 
NNUG Trondheim 30.09.2010 - Windows Phone 7
NNUG Trondheim 30.09.2010 -  Windows Phone 7NNUG Trondheim 30.09.2010 -  Windows Phone 7
NNUG Trondheim 30.09.2010 - Windows Phone 7
 
Generating characterization tests for legacy code
Generating characterization tests for legacy codeGenerating characterization tests for legacy code
Generating characterization tests for legacy code
 
MVVM Design Pattern NDC2009
MVVM Design Pattern NDC2009MVVM Design Pattern NDC2009
MVVM Design Pattern NDC2009
 
Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008
 

Recently uploaded

A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 

Recently uploaded (20)

A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 

Why learn new programming languages

  • 1. WHY LEARN NEW PROGRAMMING LANGUAGES? What I’ve learned from Ruby and Scheme that applies to my daily work in C# and JavaScript Trondheim XP Meetup Jonas Follesø, Scientist/Manager BEKK Trondheim 08/02/2012
  • 2.
  • 3. 3
  • 4. PERSONAL HISTORY OF PROGRAMMING LANGUAGES 4 QBasic Turbo Pascal Delphi VBScript (1996) (1998) (1999) (2001) C# JavaScript Java Python Scheme Ruby (2002) (2003) (2004) (2005) (2006) (2010)
  • 5. PERSONAL HISTORY OF PROGRAMMING LANGUAGES 5 QBasic Turbo Pascal Delphi VBScript (1996) (1998) (1999) (2001) C# JavaScript Java Python Scheme Ruby (2002) (2003) (2004) (2005) (2006) (2010)
  • 6. HIGHER ORDER FUNCTIONS 6 Formulating Abstractions with Higher-Order Functions
  • 7. ABSTRACTIONS THROUGH FUNCTIONS 7 (* 3 3 3) ; outputs 27 (define (cube x) (* x x x)) (cube 3) ; outputs 27
  • 8. ABSTRACTIONS THROUGH FUNCTIONS 8 (define (sum-int a b) (if (> a b) 0 (+ a (sum-int (+ a 1) b)))) (define (sum-cubes a b) (if (> a b) 0 (+ (cube a) (sum-cubes (+ a 1) b))))
  • 9. ABSTRACTIONS THROUGH FUNCTIONS 9 (define (sum-int a b) (if (> a b) 0 (+ a (sum-int (+ a 1) b)))) (define (sum-cubes a b) (if (> a b) 0 (+ (cube a) (sum-cubes (+ a 1) b))))
  • 10. ABSTRACTIONS THROUGH FUNCTIONS 10 (define (<name> a b) (if (> a b) 0 (+ <term> (<name> (<next> a) b))))
  • 11. ABSTRACTIONS THROUGH FUNCTIONS 11 (define (sum term a next b) (if (> a b) 0 (+ (term a) (sum term (next a) next b)))) (define (inc n) (+ n 1)) (define (identity n) n) (define (sum-int a b) (sum identity a inc b)) (define (sum-cubes a b) (sum cube a inc b)) (sum-int 0 10) ; outputs 55 (sum-cubes 0 10) ; outputs 3025
  • 12. ABSTRACTIONS THROUGH FUNCTIONS 12 (define (sum term a next b) (if (> a b) 0 (+ (term a) (sum term (next a) next b)))) (define (inc n) (+ n 1)) (define (identity n) n) (define (sum-int a b) (sum identity a inc b)) (define (sum-cubes a b) (sum cube a inc b)) (sum-int 0 10) ; outputs 55 (sum-cubes 0 10) ; outputs 3025
  • 13. ABSTRACTIONS THROUGH FUNCTIONS - JAVASCRIPT 13 $("li").click(function() { $(this).css({'color':'yellow'}); }); $("li").filter(function(index) { return index % 3 == 2; }).css({'color':'red'}); $.get("/some-content", function(data) { // update page with data... });
  • 14. ABSTRACTIONS THROUGH FUNCTIONS – C# 14 SumEvenCubes(1, 10); // outputs 1800 public int SumEvenCubes() { var num = new[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; return num .Where(IsEven) .Select(Cube) .Aggregate(Sum); } public bool IsEven(int n) { return n % 2 == 0; } public int Cube(int n) { return n*n*n; } public int Sum(int a, int b) { return a + b; }
  • 15. OBJECTS FROM CLOSURES 15 You don’t need classes to create objects
  • 16. OBJECTS FROM CLOSURES IN SCHEME 16 (define (make-account balance) (define (withdraw amount) (if (>= balance amount) (set! balance (- balance amount)) "Insufficient funds")) (define (deposit amount) (set! balance (+ balance amount)) balance) (define (dispatch m . args) (case m ((withdraw) (apply withdraw args)) ((deposit) (apply deposit args)))) dispatch) (define account1 (make-account 100)) (account1 'withdraw 50) (account1 'deposit 25) ; outputs 75
  • 17. OBJECTS FROM CLOSURES IN JAVASCRIPT 17 var make_account = function (balance) { var withdraw = function (amount) { if (balance >= amount) balance -= amount; else throw "Insufficient funds"; return balance; }; var deposit = function (amount) { balance += amount; return balance; }; return { withdraw: withdraw, deposit: deposit }; }; var account1 = make_account(100); account1.withdraw(50); account1.deposit(25); // outputs 75
  • 18. READABILITY 18 Extreme emphasis on expressiveness
  • 19. READABILITY 19 “[…] we need to focus on humans, on how humans care about doing programming or operating the application of the machines. We are the masters. They are the slaves…”
  • 20. EXAMPLES OF RUBY IDIOMS 20 abort unless str.include? "OK" x = x * 2 until x > 100 3.times { puts "olleh" } 10.days_ago 2.minutes + 30.seconds 1.upto(100) do |i| puts i end
  • 21. EXAMPLE OF RSPEC TEST 21 describe Bowling do it "should score 0 for gutter game" do bowling = Bowling.new 20.times { bowling.hit(0) } bowling.score.should == 0 end end
  • 22. C# UNIT TEST INFLUENCED BY RSPEC 22 public class Bowling_specs { public void Should_score_0_for_gutter_game() { var bowling = new Bowling(); 20.Times(() => bowling.Hit(0)); bowling.Score.Should().Be(0); } } public static class IntExtensions { public static void Times(this int times, Action action) { for (int i = 0; i <= times; ++i) action(); } }
  • 23. C# FLUENT ASSERTIONS 23 string actual = "ABCDEFGHI"; actual.Should().StartWith("AB") .And.EndWith("HI") .And.Contain("EF") .And.HaveLength(9); IEnumerable collection = new[] { 1, 2, 3 }; collection.Should().HaveCount(4, "we put three items in collection")) collection.Should().Contain(i => i > 0);
  • 24. READABILITY 24 Internal DSLs and Fluent Interfaces
  • 25. RUBY DSL EXAMPLES - MARKABY 25
  • 26. RUBY DSL EXAMPLES – ENUMERABLE PROXY API 26
  • 27. C# LINQ EXAMPLE 27 static void Main(string[] args) { var people = new[] { new Person { Age=28, Name = "Jonas Follesø"}, new Person { Age=25, Name = "Per Persen"}, new Person { Age=55, Name = "Ole Hansen"}, new Person { Age=40, Name = "Arne Asbjørnsen"}, }; var old = from p in people where p.Age > 25 orderby p.Name ascending select p; foreach(var p in old) Console.WriteLine(p.Name); } --- Arne Asbjørnsen Jonas Follesø Ole Hansen
  • 28. C# STORYQ EXAMPLE 28 [Test] public void Gutter_game() { new Story("Score calculation") .InOrderTo("Know my performance") .AsA("Player") .IWant("The system to calculate my total score") .WithScenario("Gutter game") .Given(ANewBowlingGame) .When(AllOfMyBallsAreLandingInTheGutter) .Then(MyTotalScoreShouldBe, 0) .WithScenario("All strikes") .Given(ANewBowlingGame) .When(AllOfMyBallsAreStrikes) .Then(MyTotalScoreShouldBe, 300) .ExecuteWithReport(MethodBase.GetCurrentMethod()); }
  • 29. C# OBJECT BUILDER PATTERN 29 [Test] public void Should_generate_shipping_statement_for_order() { Order order = Build .AnOrder() .ForCustomer(Build.ACustomer()) .WithLine("Some product", quantity: 1) .WithLine("Some other product", quantity: 2); var orderProcessing = new OrderProcessing(); orderProcessing.ProcessOrder(order); }
  • 30. MONKEY PATCHING 30 Runtime generation of code and behaviour
  • 31. RUBY ACTIVE RECORD AND METHOD MISSING 31
  • 32. C# DYNAMIC AND EXPANDO OBJECT 32 static void Main(string[] args) { dynamic person = new ExpandoObject(); person.Name = "Jonas Follesø"; person.Age = 28; Console.WriteLine("{0} ({1})", person.Name, person.Age); } Jonas Follesø (28)
  • 33. C# MONKEY PATCHING 33 public class DynamicRequest : DynamicObject { public override bool TryGetMember(GetMemberBinder binder, out object result) { string key = binder.Name; result = HttpContext.Current.Request[key] ?? ""; return true; } } @using MvcApplication1.Controllers @{ Page.Request = new DynamicRequest(); } <h4>Hello @Page.Request.Name</h4> <h4>Hello @HttpContext.Current.Request["Name"]</h4>
  • 34. C# MICRO ORMS 34 • Afrer C# 4.0 with support for dynamic typing a whole new category of micro ORMs has emerged: • Massive • Simple.Data • Peta Pico • Dapper
  • 35. C# MICRO ORMS 35 IEnumerable<User> u = db.Users.FindAllByName("Bob").Cast<User>(); db.Users.FindByNameAndPassword(name, password) // SELECT * FROM Users WHERE Name = @p1 and Password = @p2 db.Users.FindAllByJoinDate("2010-01-01".to("2010-12-31")) // SELECT * FROM [Users] WHERE [Users].[JoinDate] <= @p1
  • 36. SAPIR–WHORF HYPOTHESIS 36 The principle of linguistic relativity holds that the structure of a language affects the ways in which its speakers are able to conceptualize their world, i.e. their world view. http://en.wikipedia.org/wiki/Linguistic_relativity
  • 37. 37 TAKK FOR MEG Jonas Follesø