DDD with repository by JPA: simple example

Under develop The code published is a simple example with the following requisites: Stack: Java SE (model) Java EE (JPA) Dependencies management: Maven Model: Based on DDD Using of repositories Core: Completly agnostic from the persistence infraestructure Persistence: Implemented by JPA – EclipseLink Using Collection-Oriented repositories Ports as contractual definition for persistence functionality Methodology: TDD… Read More »

Strategy pattern: Transcoder example (JavaScript flavour)

This example is based on the declaration “Strategy pattern: Transcoder example“ Sources JS Bin About the code Based on as commented with generic example: TrancoderStrategy Declaration by prototype property The default behavior throw an exception in order to force subclasses to implement thesse methods

Concretes Strategies Declaration by prototype property  and Object.create()

Strategy pattern: Transcoder example (Java flavour)

This example is based on the declaration “Strategy pattern: Transcoder example”  Source: Sources: GIST About the code TranscondigTextService: class with “context” role. This class is interested of change its behavior in order to produce diferents kind of output codes TranscondigTextService(strategy: Strategy): constructor with initial strategy injection. transcoder: state that store the the reference to the… Read More »

Inheritance approaches in JavaScript

We are going to develop the following case: Two classes: Base: parent class with the same structure. State: color (string type, private scope). Behavior: sayColor, returning color. Child: subclass from Base with: State: name (string type, private scope). Behavior: sayName, returning name. Instanciating of child object. If we use a “classical” OOP language like Java:… Read More »

Defining Classes and Objects in JavaScript

We’d like to create one new object “Car” in JavaScript with the same features: property / state: color method: showColor One way to create your own objects in JavaScript instancing from JavaScript Object:

But so that we have a trouble: we can’t reuse the same structure (states & methods) to generate new oCar objects How… Read More »