Affichage des articles dont le libellé est the troll inception. Afficher tous les articles
Affichage des articles dont le libellé est the troll inception. Afficher tous les articles

vendredi 17 janvier 2014

ILN (Intuitive Language Notation) configuration language

I really like YAML language for object configuration, but I was thinking about something more basic, something simpler, easy accessible without have to take some hours to completely learn a syntax.

I thought about a file extension, ILN for Intuitive Language notation.
The principle is simple, very simple for now.

When you have something inside a ILN config file:
db.driver: \TTI\DbUtil\PdoDriver
    __construct:
        hostname: localhost
        username: root
        password:
        database: test
        port: 3603
The first instruction is the alias of the namespace.
The second instruction separated by 4 spaces is mandatory the name of a method.
The other instructions separated by 4 spaces too, are the arguments of the method they're in, specified in the same order as in the real class.

If you have to comment some configurations, you just have to write like this:
#cache.driver: \TTI\CacheUtil\MemCache
#    __construct:
#        cache_hostname: xxxxx
#        cache_port: xxxx

You can add multiple dependencies for a driver:
db.driver: \TTI\DbUtil\PdoDriver
    __construct:
        hostname: localhost
        username: root
        password:
        database: test
        port: 3603
    setTable:
        name: blog
You can also include aliases like this:
db.driver: \TTI\DbUtil\PdoDriver
    setTable:
        name: %cache.driver%
You can also add type to variables like this:
db.driver: \TTI\DbUtil\PdoDriver
    setTable:
        name: array| 'table' => 'blog'
 
That's all for the moment.

But at this point, it is fully clear and easily reachable.
You are able to do some dependency injection, and use a service container in your application.

You can concretely use it with ILN Parser, you can download via composer:

require: "edouardkombo/parser-strategy": "1.0.0.*@dev"

I was thinking about adding some instructions later to handle Observer design pattern for events handling. It will come soon.

It is just a beginning, always in the spirit of having fun by coding our applications.

Thanks.

The Troll Inception - Objective Reality Php Framework

The Troll Inception is an objective reality php "solution" NOT A FRAMEWORK, based over the CSS (Code Similar Situations) principle, and a strict personal notion of object, all thought by Edouard Kombo.

Because you don't have to learn a framework, but only good development practices, TTI is not a framework, but a concentration of good practices made extremely intuitive and playful!

The initiative behind TTI was to rethink the notion of object based from the CABIN principle (http://le-code-vulgarise.blogspot.fr/2014/01/principe-cabin-pour-la-construction-d.html).
We truly believe a true object is only an interface, implemented by an abstracted shape you can concretely use. That's all!
That means, a concrete class that doesn't have a contract with an abstract class and an interface, can't be considered as real object, but rather as a trait, or "lost son", or anything else, but not as an object.

Based from this notion, we developed two powerfull collection of generic classes that is a standard base for true objects, and, that can be used in any of your projects to fully respect SOLID and GRASP principles.

"InterfaceFactory" and "AbstractFactory" collection of classes, are the heart of The Troll Inception solution.
AbstractFactory is a collection of abstracted classes that have very single responsibilities implemented by specifics and generic interfaces grouped in the InterfaceFactory.

Together, they offer powerfull possibilities and constraints for better closed development practices in your applications development.

Coupled with the CSS principle (http://le-code-vulgarise.blogspot.fr/2014/01/what-is-css-principle.html) and the Objective Reality (http://le-code-vulgarise.blogspot.fr/2014/01/what-is-objective-reality-design-pattern.html), TTI offers you a new generation of framework that can involve agile development.



The Troll Inception STORY (CSS and Objective Reality implementation)

You play Roar, a troll cave, lost in the Breeze forest by his stupidity. To survive, he has to conquer and dominate this forest.
Roar has several tools at its disposal, like a torch, a map, an eagle that will guide him to the best routes he can teleport to, via the magical portal, an ancestral passort...
The goal is to reach all routes and respond, to affirm your territory.
When Roar responds, he may beat the asian forest spirit, "Foucking Law".
Foucking Law has one powerful wild beast, CodeCeption, which will test Roar as many possible times, like a ghost.
Everytime Roar responds successfully to Foucking Law, he wins 5 Chicken points.

These points will help you estimate more precisely the technical debt a project will introduce.



How is it applicable?
 
You start to play with objective reality in the heart of your application, just by renaming variables as living objects or characters of the story telling.
This way, all the application you are designing, is easily printable in your subconscious mind.
You are playing with it, and it is now easier for other developers to play with it too.



How to download the Troll Inception Project?

Go on Github, just here: https://github.com/edouardkombo/TheTrollInception

What is CSS principle?

Before introducing you the CSS principle, it is extremely important not to confuse the CSS (Cascading Style Sheet) language, with CSS (Code Similar Situations) principle.


What is CSS Principle?

CSS principle means Code Similar Situations.
This principle has been introduced by Edouard Kombo, starting from the need to bring more creativity in applications code.

The theory is, if we can connect the code and the developer by its creativity, then we will no more learn, we will start playing with the code forever.


Why do CSS principe useful?
 
Because it is hard in very short development process to understand how to apply all necessary design patterns.


Because it is hard to fully capture in seconds, a complex code from someone else, or even from ourself, some weeks or months later.


Because too much complex code doesn't connect you with your passion, and makes you code bad.


Because it is hard for beginners and more experienced developers to intuitively appropriate themselves a complex architecture.


Because it is funnier to code something you can play with, and that will be easier for others, to intuitively understand and play with it too.



What do CSS principle recommend?
 
It recommends to URA (Understand, retain, apply) something, by inspiring yourself from a similar situation we've already seen or lived in real life (story telling, concrete experience, game, cartoon, movie...).



How do CSS principle can solve those problems?

Instead of simply coding instructions and objects, when you play with them, then you emotionnaly connect with your application and your job gets funnier, more pleasant and intuitively accessible by other developpers.

What is Objective Reality design pattern?

Objective Reality is the fact of coding real and funny situations, in an objective and professional goal.
It is a design pattern based over the CSS (Code Similar Situations) principle, that has also been thought by Edouard Kombo.



Concrete Example

Before, to open a file and send it by mail, you were coding like this:
$parser = new Parser();
$mail = new Mailer();

$file = $parser->open($file);
$mail->send($file);
Now, with Objective Reality design pattern, you should imagine a story and code like this:
$torch = new Parser();
$boomerang = new Mailer();

$file = $torch->open($file);
$boomerang->send($file);

Explanation

In the second example, you added a little bit of creativity in your code, that implies a story-telling creation.
That's it, with a story telling, you are now able to play with your code, and help other developers understand more easily the purpose of your instructions.

The structure of your program doesn't have to change, just rename the variables to begin openning a universe that could revolutionnate the way you develop applications and master it.


Advantages

When you play, you except to win something and earn a reward.

By example, you can establish within your team a reward board for every classes tested and developed that will help you estimate more precisely the technical debt of a project.

In all cases, developers will have the illusion to play with something, rather than building a complex architecture.


What kind of story telling to apply?

The goal of Objective Reality is not to apply fancy things to variables names.
There are rules to make it efficient.

The first and unique rule is to apply CSS (Code Similar Situations) principle.
It could be a movie you liked, a cartoon, a real life experience, it could be anything you imagine, but only a situation the largest number of people may have lived.

This will significantly facilitate code reuse of your applications.


To learn more about CSS principle, click here http://le-code-vulgarise.blogspot.fr/2014/01/what-is-css-principle.html.