https://github.github.com/training-kit/downloads/github-git-cheat-sheet/

https://try.github.io/

Git branches are simply pointers pointing to a specific command. 

 

Branch early, and branch often.

 

rebase in git

 

HEAD - symbolic name for currently checked out commit. always points to the most recent commit. 

instead of checking out to a branch, you could check out towards specific commit. 

 

Caret(^) - travels to parent version

 

Tilde(~) - travles specific number of parents 

 

git branch -f master HEAD~3 = =        move master branch to head + 3

 

reversing changes in git::

git reset - works great in local repository, going back to rewrite history

 

git revert  - works great for remote repository, git revert creates a new commit of the previous version, allowing you to push to other checkouts. 

 

 

 

 

Above commands should cover 90% of vcs(version control system) while 10% will help in more flexible precise ways.

 

cherry-pick

 

git rebase -i HEAD~4, omit and pick 

use tag for version display 

 

'ETC' 카테고리의 다른 글

IP 주소(3/11/2020)  (0) 2020.03.11
Checked vs Unchecked  (0) 2020.03.05
Design ToolBox  (0) 2020.02.29
Chapter 2  (0) 2020.02.28
Chapter 1  (0) 2020.02.27

object composition - composition simple defines HAS-A relation. For example, abstract factory pattern uses object composition, having many interfaces in the abstract factory showing a has-a relationship. 

 

OO Basics 

 - Abstraction

 - Encapsulation - wrapping up of data under a single unit. (varies variables under a class)

 - Polymorphism - the ability of an object to take on many forms. (person, employee, boss)

 - Inheritance

 

OO Principles 

 - Encapsulate what varies -

 

Take the parts that vary and encapsulate them, so that later you can alter or extend the parts that vary without affecting those that don't. (chapter 1, duck flying and quack behavior)

(Hide the potentional change inside the interface. When things change, the function inside the interface might need to change but software written using the interface does not.) 

 

 - Favor composition over inheritance -

Inheritance is abstract concept while composition is actual existing component. Implementing a class cannot be changed during runtime while compositions can be changed and be used dynamically. (See design pattern strategy pattern's strategy part of strategy vs concept)

 

 - Program to interfaces(supertype), not implementations -

 

the declared type of the variables should be a supertype, usually an abstract class or interfact, so that the objects assigned to those variables can be of any concrete implementation of the supertype. 

 

Instead of creating a class and implementing it, create a seperate interface or abstract and sets of classes for certain behaviors. (ex. Duck flying behavior in chapter 1)

(use interface for polymorphism reasons etc not for its implementations. )

 

Programming to an implementation would be :

Dog d = new Dog();

 

Programing to an interface/supertype : 

Animal animal = new Dog(); 

 

assign the concrete implementation object a runtime :

a = getAnimal();

a.makeSound();

 

 - Strive for loosely coupled designs between objects that interact

 - Depend on abstractions. Do not depend on concrete classes. (Dependency Inversion Principle)

 

OO patterns 

 - Strategy : defines a family of algorithms, encapsulates each one, and makes them interchangeable. Strategy lets the algorithm vary independently from clients that use it. 

 - Observer : defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically. 

 - Decorator : attaches additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality. 

 - Abstract Factory : Provide an interface for creating families of related or dependent objects without specifying their concrete classes.

 - Factory Method : Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to the subclasses. 

- Singleton : Ensure a class only has one instance and provide a global point of access to it. 

'ETC' 카테고리의 다른 글

Checked vs Unchecked  (0) 2020.03.05
Git  (0) 2020.03.04
Chapter 2  (0) 2020.02.28
Chapter 1  (0) 2020.02.27
HLS vs DASH  (0) 2020.02.24

Strategy pattern is useful when we want our application to be flexible. Made up of strategy and context.

Source code : https://github.com/Tonyzorz/DesignPatterns/tree/master/bin/behavior/strategy

'디자인 패턴' 카테고리의 다른 글

Builder Design Pattern  (0) 2020.02.25
Abstract Factory Design Pattern  (0) 2020.02.24
Factory Design Pattern  (0) 2020.02.22
Singleton Pattern  (0) 2020.02.19

Observer pattern can be visualized as newspaper subscription service with its publishers and subscribers.

 

the subject is the publisher, observers are the subscribers.

 

The observer pattern - defines a one-to-many dependency between objects so that when one object changes state, all of its dependents are notified and updated automatically. 

 

Design principles : Strive for loosely coupled designs between objects that interact

'ETC' 카테고리의 다른 글

Git  (0) 2020.03.04
Design ToolBox  (0) 2020.02.29
Chapter 1  (0) 2020.02.27
HLS vs DASH  (0) 2020.02.24
Sites to view later  (0) 2020.02.24

https://github.com/Tonyzorz/HeadFirstDesignPattern

 

Tonyzorz/HeadFirstDesignPattern

Head first design pattern. Contribute to Tonyzorz/HeadFirstDesignPattern development by creating an account on GitHub.

github.com

Design principles:

- Identify the aspects of your application that vary and separte them frmo what stays the same.

- Program to an interface, not an implementation. 

- Favor composition over inheritance. 

 

Strategy pattern : defines a family of algorithms, encapsulate each one, and makes them interchangeable. Strategy lets the algoirthm vary indepdently from clients that use it. 

 

Design pattern gives you shared vocabulary with other developers. Also allows you to view things in pattern ways instead of object way. 

'ETC' 카테고리의 다른 글

Design ToolBox  (0) 2020.02.29
Chapter 2  (0) 2020.02.28
HLS vs DASH  (0) 2020.02.24
Sites to view later  (0) 2020.02.24
Media files note 1  (0) 2020.02.24

When instantiating a class in client program, passing many arguments to a constructor can cause errors in many situations and bothersome. ex. having to remember constructor's parameter sequence. 

 

Builder design pattern solves this issue by building step by step, allowing client to designate only needed variables. 

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package creational.builder;
 
public class Phone {
    
    private int gb;
    private int ram;
    private boolean graphicsCardEnabled;
    
    
    
    public Phone(PhoneBuilder builder) {
        super();
        this.gb = builder.gb;
        this.ram = builder.ram;
        this.graphicsCardEnabled = builder.graphicsCardEnabled;
    }
    
    public int getGb() {
        return gb;
    }
    public int getRam() {
        return ram;
    }
    public boolean isGraphicsCardEnabled() {
        return graphicsCardEnabled;
    }
    
    @Override
    public String toString() {
        return "Phone [gb=" + gb + ", ram=" + ram + ", graphicsCardEnabled=" + graphicsCardEnabled + "]";
    }
 
    public static class PhoneBuilder{
        
        private int gb;
        private int ram;
        private boolean graphicsCardEnabled;
        
        
        public PhoneBuilder(int gb) {
            super();
            this.gb = gb;
        }
        
        public PhoneBuilder setGb(int gb) {
            this.gb = gb;
            return this;
        }
        public PhoneBuilder setRam(int ram) {
            this.ram = ram;
            return this;
        }
        public PhoneBuilder setGraphicsCardEnabled(boolean graphicsCardEnabled) {
            this.graphicsCardEnabled = graphicsCardEnabled;
            return this;
        }
        
        public Phone build() {
            return new Phone(this);
        }
        
        
    }
}
 
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
 
1
2
3
4
5
6
7
8
public class MainClass {
 
    public static void main(String[] args) {
        Phone phone = new PhoneBuilder(2).setGraphicsCardEnabled(true).build();
        System.out.println(phone);
    }
}
 
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
 

 

 

 

'디자인 패턴' 카테고리의 다른 글

Strategy Pattern  (0) 2020.02.28
Abstract Factory Design Pattern  (0) 2020.02.24
Factory Design Pattern  (0) 2020.02.22
Singleton Pattern  (0) 2020.02.19

Using Factory design pattern within factory design pattern. 

 

Great for predefined objects but if new object has to be added, whole code needs to be adjusted. 

'디자인 패턴' 카테고리의 다른 글

Strategy Pattern  (0) 2020.02.28
Builder Design Pattern  (0) 2020.02.25
Factory Design Pattern  (0) 2020.02.22
Singleton Pattern  (0) 2020.02.19

HLS

- stable media format, it has been out for more than ten years.

- suuports its own DRM only

 

DASH 

- can deliver low latency

- uses templated manifest that can be cached

- DASH supports range of encryption solutions

 

'ETC' 카테고리의 다른 글

Chapter 2  (0) 2020.02.28
Chapter 1  (0) 2020.02.27
Sites to view later  (0) 2020.02.24
Media files note 1  (0) 2020.02.24
Debugging  (0) 2020.02.14

+ Recent posts