I'm trying to learn how to make my application has the same "face" in all files, the same pattern, but I do not know if this is the right thing to do.
I want know if the more correct in software development, is to limit the application to only one type of pattern.
For example, that's how my application looks like (just a piece)
Api.js:
'use strict'
var Server = require('./server');
var Api = {
init: function() {
Server.init('start');
}
};
Server.js:
'use strict'
var Server = {
init: function(command) {
this.command = command;
if (command === 'start') {
this.start();
}
}
};
I'm using the "initializer object pattern" in all my application. So i'm avoiding decorator pattern, facade, everything.
Should i avoid or i can use more than one? If the right answer is use several, depending on the needs, i have other question. This doesn't make the maintenance more difficult? Is not make the code like a spaghetti?
Thanks.
Aucun commentaire:
Enregistrer un commentaire