Decorators and i18n

Decorators are quite useful in Angular.
If you are not familiar with their usage, let’s say that they allow you to extend or overwrite a service (or directive or filter) in specific parts of your application without modifying the original one.

One of the advantages is that you don’t have to change too much of the implementation or your in-page code, but every part of your application will use the correct (decorated or original) version of every component.

If you need more information about decorators in Angular read the official documentation here

If you need more information about the decorator pattern in general you can find something here

i18n is the internationalization module provided by Angular: it is really useful for multi language applications as it offers an easy management not only for your labels, but calendar and currency as well.

Even if there is not a strict relation between Decorators and i18n, it’s quite possible that in multi language applications you need not only different translations, but custom rules depending on the language/country and in that situation the decorators come in handy.

Continue reading

Playing with software architecture in a Space Opera

In 2030 a massive project were kicked-off in order to colonize new planets.
The name of the project was International Space Program.

A lot of planets had been probed looking for the best candidate of the first mankind settlement in the space.
At the end Mars won and a bunch of settlers were chosen to colonize it.

The main reason for the colonization of space was the research and the harvesting of an important resource missing on Earth: “Whatsoever” (on periodic element table: WH)

What you could achieve using the “Whatsoever” was limitless, so a lot of Companies invested on the International Space Program.

The settlers were sent on Mars in 2032 and an interspace link granted the quick send of designs, prototypes useful to build objects on Mars.

The name of this link was: New Universal Gate for Extraterrestrial Transport or N.U.G.E.T for short.
Continue reading

TDD workshop

sherlockFew months ago in the office we started a discussion about testing.
The original topic was “how to implement a continuous integration/continuous delivery workflow”, so “how to test” became immediately a requirement and a parallel important topic.

My suggestion was to start coding in TDD of course, but like every office we had a lot of legacy code to deal with.
In order not to be stuck by that, we decided temporarily to focus on new (or almost new) projects and apply it to them.

So the point became to find a way to have all the developers, regardless on the seniority and the project, on the same page about the topic.

Continue reading

The hangman in angularjs

Source Wikipedia:

The Hangman is a paper and pencil guessing game for two or more players. One player thinks of a word, phrase or sentence and the other tries to guess it by suggesting letters or numbers.

The word to guess is represented by a row of dashes, giving the number of letters, numbers and category. If the guessing player suggests a letter or number which occurs in the word, the other player writes it in all its correct positions. If the suggested letter or number does not occur in the word, the other player draws one element of a hanged man stick figure as a tally mark. The game is over when:

  • The guessing player completes the word, or guesses the whole word correctly
  • The other player completes the diagram:

This diagram is, in fact, designed to look like a hanging man. Although debates have arisen about the questionable taste of this picture,[1] it is still in use today. A common alternative for teachers is to draw an apple tree with ten apples, erasing or crossing out the apples as the guesses are used up.

Continue reading

Blackjack in AngularJs (reprise)

After the first implementation of the game, my friend and I compared our versions.
He focused on the deck model instead of the dealer like I did.

This simple choice drove his design to a complete different path.
He put a lot of effort trying to replicate a realistic deck, implementing the shuffle logic and making impossible to draw the same card twice.

This hypotheses never came up to my mind because I knew that in the real game there are multiple decks in order to make almost impossible for the players the calculation of the drawn cards.
Continue reading

Clarifying the expectations.

sherlockAlong this year in London I’m learning how the projects are managed here, how teams are formed and dismissed, how to deal with the day-to-day activities, how to create roadmaps for projects…and a lot of other things.

Needless to say that the environment in the London office is more fluid and working with Projects is very very different from working with the Products.

I’m attending a few business classes focused on Communication and Management, nothing specifically Agile related, but very focused on the Business and the Company.

An important concept that I Iearned in these months and I’m using to re-analyze how I did before is “be sure to set and clarify the expectations”.

Continue reading

A platform game (more or less) in angularjs

If you read the introduction to angularjs, it’s stated clearly that angularjs can be not the best choice to create games.
I can imagine the reason easily: the performances can be very problematic, mostly if the game requires a complex DOM.

Moreover a lot of good frameworks exist to create amazing games in html5 (have you ever heard about impactjs?).

Nevertheless I have found very fascinating the idea to manage via directive a level design instead of a classic multidimensional array as I did in the pawn and tiles experiment.
Continue reading