mercredi 20 décembre 2017

REST API that calls another REST API

Is it proper programming practice/ software design to have a REST API call another REST API? If not what would be the recommended way of handling this scenario?

what pattern or process to notify multiple systems about changes in another system

Imagine a system X with an http api with a lot of data from a (mysql) database. Imagine multiple systems being dependent on this data but doing very different tasks. Some work on one data-set others work on a huge bunch of data-sets. The data changes to an unknown number of sets in system X do not have a periodic rhythm. There can be a large number of changes in a very short time.

The other systems must somehow be aware of those data changes and react accordingly. What pattern or process is advisable to keep bottlenecks in all system at the lowest level. So that you prevent that either system X won't be able to handle to notify all other systems or handle all other systems trying to fetch changes. And prevent other systems to slow down because they need to fetch large datasets or wait for system X being overloaded.

Also ideally all systems should not need to know about the other systems. Especially system X shouldn't need to implement specific notification methods for each system.

Would the observer pattern be applicable in this situation?

do java enums are singleton?

do java enums are singleton?

for example :

public enum State {

ACTIVE(0),
PENDING(1),
DELETED(2),
}


State s = State.ACTIVE;
State s2 = State.PENDING;
State s3 = State.PENDING;

is java create new instances every time we use State.FOO ??

What is Memoization exactly?

Could memoization be considered as a design pattern or is simply a method for caching?

http://ift.tt/28MPV5P

Design patterns - abstract factory and composite

i would like (and i must) to implement bank transfer as abstract factory, but i don't know what component should be in transfer. I know that there must be a recipient there, but i have no idea for other components. What should i put there?

Also i want implement a group of (or one) transfers as composite but i must have business reason why i must use it instead of list of transfers. Any idea?

Implementation of my composite: enter image description here

IoC + Layered Architecture + static class

If application uses inversion of control and its structure is:

  • Controllers
  • Core
  • Services

Controllers can reference only Core (Interfaces) and Services contain classes that implement those Interfaces.

When I want to create a new service that is static I am not sure how to call that service in my controller. Interfaces can't be static. Is there some design pattern that would fit my needs?

mardi 19 décembre 2017

module pattern angularjs 1.5 not registering the components

Am trying to use modulePattern in angularjs appication. (1.5) but had to do the 2nd approach as per the code given below to make it work. seems I can't get the component s properly isolated. What Am I missing here?

my index.js entry point to the app

import registerFooterTemplate from './footerBar/footerBar';

const app = angular.module('app', [uirouter])

registerFooterTemplate(app);

MY COMPONENT footerBar.js

import footerTemplate from './footer.html';

// ********** TRYING TO USE MODULE PATTERN HERE **************
// -- This doesn't work---------------
// const mod = angular.module('budgetTracker.footerBar', [

// ]);

// mod.component('footerBar',{
//   template: footerTemplate,
//   bindings: {},
//   controllerAs: 'vm',
//   controller: function($state) {}
// });

// export default mod.name;

// **************************************************************


// THIS Works -----
export default ngModule => {
  ngModule.component('footerBar', {
    template: footerTemplate,
    controllerAs: 'vm',
    controller: function($state) {}
  });
}