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.
Update.
I'm going to try explain again, this time with a bounty.
i already try to ask but seems that no one really can give me a concise answer.
I would like to know what are the secrets from making a good app, a good web app, talking about code appearance. I want know if I should maintain the same standard code throughout my hole application, if this is GOOD, or really doesn't matter.
For example, i have two EXAMPLES files
app.js:
var server = require('./server');
var app = {
 init: function() {
   server.init('DEVELOPMENT');
 }
};
module.exports = app;
server.js:
var server = {
 init: function(env) {
  if (env === 'DEVELOPMENT') {
    // CODE
  } else {
    // CODE
  }
 }
}
module.exports = server;
In this case, i'm using one object with method init, which is the pattern that i'm using in my hole app..
Or it doesn't matter, i should write anything:
first object:
var server = require('./server');
var app = {
 init: function() {
   server('DEVELOPMENT');
 }
};
module.exports = app;
than server as a function:
var server =function(env) {
  if (env === 'DEVELOPMENT') {
    // CODE
  } else {
    // CODE
  }
}
module.exports = server;
I can give 100 of my points. it's incredible how i can't find a good answer for this particular issue.
Thanks.
 
     
    