overview

A temporal collection is a simple way to implement a Temporal Property or a Temporal Object.​A temporal instance (either a Temporal Property or Temporal Object), when going through a series of amendments, the property itself or the properties the object references change over time. Each version of the temporal instance captures the state of the instance that will last for some period of time until the instance changes again with another amendment.​

Temporal Property vs. Temporal Object

If your underlying implementation tracks the changes of an instance at the property level but not at the object level, the implementation is Temporal Property. On the other hand, if the changes are tracked with snapshots at the object level, the implementation is Temporal Object.

When a class has a few properties that has temporal behavior and you want access to those temporal values, use Temporal Property. Whereas, if most of the properties of the class are temporal, use Temporal Object.

implementation

Temporal Collection

The basic representation and interface for a temporal collection provides get and put operations that use a date as an index:

overview

Data Transfer Object (DTO) is an object used to pass data with multiple items in one shot between client and server, to avoid client from issuing multiple calls to a remote server to get each item in separate calls.

Optionally, we can make use of a DTO Assembler class as some sort of a mapper in between DomainObject and DataTransferObject to map from one side to another in either direction. That is, to create a serializable DTO object given a Domain Object, or to update a Domain Object given a DTO object.

People who just started to learn Spring framework is often confused by the term "Inversion of Control" (IoC) which can be achieved through "Dependency Injection" (DI).

DI is a way of providing the dependencies (e.g. creating objects and its dependencies), wiring components into application. In Spring, those objects defined and instantiated by Spring containers then inject into application are called Spring Beans.

IoC means to create instances of dependencies first. IoC is the end result of DI. However, DI is not the only way to achieve IoC.

​Some good explanations:

Inversion of Control (IoC) means to create instances of dependencies first and latter instance of a class (optionally injecting them through constructor), instead of creating an instance of the class first and then the class instance creating instances of dependencies. Thus, inversion of control inverts the flow of control of the program. Instead of the callee controlling the flow of control (while creating dependencies), the caller controls the flow of control of the program.

IoC is a programming technique, expressed here in terms of object-oriented programming, in which object coupling is bound at run time by an assembler object and is typically not known at compile time using static analysis.

Spring helps in the creation of loosely coupled applications because of Dependency Injection.

​In Spring, objects define their associations (dependencies) and do not worry about how they will get those dependencies. It is the responsibility of Spring to provide the required dependencies for creating objects.

Given coins of different denominations and a total amount of money, find the number of combinations that makes up that amount. ​For example, given unlimited coins in 1, 2, 4 denominations, how many combinations are there to make up the amount of 12?

Thought Process

Given coins in different denominations, we'd solve this problem by breaking it into sub-problems which means given coins in less different denominations. The answer to the problem of given coins in n different denominations is based on solving the problem of given coins in (n-1) different denominations, and the answer to the problem of coins in (n-1) different denominations is based on solving the problem of coins in (n-2) different denominations.

We can use an array named combination to store the number of combinations that make up the amount. For example, the number of combinations to make up the amount of 1 is stored combination[1], and the combinations to make up the amount of 12 is stored in combination [12].

The number of combinations to make up a given amount is equal to the number of combinations before a coin denomination is added to the picture, plus the number of combinations after such a coin denomination is added to the picture for the amount of "amount - coin".

When adding the first coin to the picture, we'd calculate this array - combination. When adding the 2nd coin to the picture, the same combination[amount] is being calculated based on the following pseudocode:

definitions

A full binary tree (sometimes referred to as a proper binary tree or plane binary tree) is a tree in which every node other than the leaves has two children. In other words, each node has either 0 child or 2 children.

A complete binary tree is a binary tree in which every level, except possibly the last, is completely filled, and all nodes are as far left as possible.

A perfect binary tree is a binary tree with all leaf nodes at the same depth. All internal nodes have degree 2.

Perfect Tree

A Binary Heap is a binary tree with following 2 properties:​

A complete tree.

A Min Heap or Max Heap. In a Min Binary Heap, the key at root must be minimum among all keys present in Binary Heap. The same property must be recursively true for all nodes in Binary Tree. Max Binary Heap is similar to Min Heap.

Copywriting is using words to get people to give up their money in exchange for services or products. In other words, it is “salesmanship in print.” as defined by John E. Kennedy back in 1904.

The copywriting should be all about the consumers so the copywriter have to talk about them, talk about the problem, the promise, the proof, and the proposal to solve the problem. The copy must be useful and valuable. No copy is too long, too short, only too boring. Write about the preponderance of proof so the consumer have to make a decision.

You want to stand out when the competition is already there when entering a market. Think about three things:

Form your own personality for your identity: Clone a service offer by a guru won't make you a guru. You want to have the content come out your personality, yourself. Clients respond to what you like. It's too risky to be a me-too.

Flyweight pattern is a structural pattern in GoF as it supports large numbers of fine-grained objects efficiently. Since each fine-grained object (e.g. a character in an editor application) may incur overhead that adds up. This pattern shares objects in a pool (Flyweight Factory) to minimize memory use.