Antoine Sauvinet — Technology Executive & Entrepreneur
FR | EN
Blog Resume Contact

[EnhanceYourCode] : the Builder Pattern, Part2

Hello, In the previous article, we explored the theory of the builder pattern. Let’s see a more concrete example : Let’s assuming that we are building a Role Playing Game core model. Here are the basic rules: A player can be a Hero : a Warrior, a Wizard, or a Thief (we keep it simple) Every Hero has 4 main characteristics: Health, Strength, Spirit, and Speed, that are counted in points. Heroes have a Level, and starting characteristics are based on this level (Health starts at Level * 10, Strength and Spirit start at Level * 5, and Speed starts at Level * 3) Warrior has a (+2 Strength, -2 Spirit) Modificator, Wizard has (+2 Spirit, -2 Strength) Modificator Player can improve 2 Characteristics of 1 points each or 1 characteristic of 2 points, in order to cutomize his Hero. A naive implementation of the Hero class would be : ...

September 16, 2015 · 7 min · 1343 words · oinant

[EnhanceYourCode] : the Builder Pattern

Hello, In this article, I’d like to present you the Builder pattern and how I use it in my C# code. The Builder Pattern is a Creational design pattern, like the Factory Method Pattern I already covered un this previous article. Its main focus is to provide a light DSL to build objects by settings startup properties, by seperating the process of constructing an object from the object itself. Basically, the idea is to create a class with mutable fields, that will be initialized with dedicated methods, and a final method that create the object itself from thoses values. Here is an abstract example : ...

September 9, 2015 · 3 min · 621 words · oinant

Canopy : Automate your browser tests the F# way!

Hello, I’d like to introduce you Canopy, a Selenium overlay written in F#. It brings you the concision and the clarity of F# to your selenium tests. First of all, we have to create a new F# console application, then we install canopy in our project: As you can see, the canopy nuget will bring back the selenium ecosystem. Lets create our first test. It will check that a search of “canopy F#” in google will feature the official Canopy website as the first result. Here is the little bootstrapping needed by Canopy : ...

August 31, 2015 · 3 min · 569 words · oinant

[EnhanceYourCode] : the Factory Method Pattern

The Factory Method pattern is one of the most useful creational design patterns. It allows us to delegate the creation of an object to a dedicated class, improving testability and respecting the Single Responsibility Principle.

July 22, 2015 · 6 min · 1123 words · oinant