This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Classify(string number, Action<int> onArabic, Action<string> onRoman) { | |
if (int.TryParse(number, out var arabicNumber)) | |
onArabic(arabicNumber); | |
else | |
onRoman(number); | |
} | |
/* | |
* Note how all details about how classification works are hidden in the function Classify(). | |
* It's not visible to the outside wheter an "if" is used or a table lookup or whatever. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
namespace terraingenBlog | |
{ | |
public class TerrainGenerator { | |
public static void Interpolate(Terrain terrain, float offset, float amplitude) { | |
Interpolate(terrain, offset, amplitude, Random_numbers_between_minus_1_and_1()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main exposing(main) | |
import Html exposing (Html, div, span, br, text, table, tr, td, button) | |
import Html.Attributes exposing (style) | |
import Html.App exposing (beginnerProgram) | |
import Html.Events exposing (onClick) | |
import Array exposing (Array) | |
import List |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AssemblyLineFor<T> | |
{ | |
public interface IFilter | |
{ | |
T Process(T message); | |
} | |
private readonly IList<Func<T, T>> _stages = new List<Func<T, T>>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Pipeline | |
{ | |
public interface IFilter<in TIN,out TOUT> | |
{ | |
TOUT Process(TIN message); | |
} | |
private readonly IList<Func<object,object>> _stages = new List<Func<object,object>>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var BlackBox = function() { | |
var self = this; | |
self._events = []; | |
self.Record = function(event) { | |
self._events.push(event); | |
self.Recorded(event); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Seite Erste_Seite_laden() { | |
Seite seite; | |
var dateiname = Dateiname_von_Kommandozeile_holen(); | |
Zeilen_lesen(dateiname, | |
zeilen => { | |
seite = new Seite { | |
Überschrift = Überschrift_extrahieren(alleDatenzeilen), | |
Datenzeilen = Zeilen_der_ersten_Seite_selektieren(alleDatenzeilen) | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Be sure to reference System.Web and System.Web.Extensions in your C# project | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Net; | |
using System.Web.Script.Serialization; | |
namespace parse.com | |
{ | |
public class ParseFiles |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Be sure to reference System.Web and System.Web.Extensions in your C# project | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Net; | |
using System.Web; | |
using System.Web.Script.Serialization; | |
namespace parse.com | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Dynamic; | |
using NUnit.Framework; | |
namespace KataWordWrap | |
{ | |
[TestFixture()] | |
public class test_Wrapper | |
{ | |
[TestCase("word", 4, Result="word")] |