Pages

Friday, August 14, 2020

Rebase steps

 Terminal > 

git rebase -i HEAD~3

> GIT window comes up to make changes

[[[ > If I want to cancel, without changes, use # to comment out all lines and "wq!". No changes will be made.

> OR another way is to use "q!" to quit. Then use "git rebase --abort". ]]]

replace "pick" with s or f

ESC > : > wq! > press ENTER

git push -f origin feature/test-9999_sampleBranch    (force push will completely overwrite the origin branch)

Thursday, September 5, 2019

Resolve merge conflicts

SourceTree > rebase branch on top of Develop > Merge Conflicts !


Go to Visual Studio > Team Explorer > Changes > Conflicts

Click each conflict and click MERGE button.
Resolve (left side) by adding both changes.
Click "Accept Merge" top left.


Conflicts are resolved.


Go to SourceTree. Will not be on a branch. Stage all changes.
> Terminal > git rebase --continue






This will finish rebase and go to correct branch. If all looks good, then do a final push:
> Terminal > git push -f origin feature/3100_NewFeatureBranch

Saturday, January 12, 2019

React JS notes

- ES7 to generate quick template

In VS Code, go to 1) Extensions tab  2) Install ES7



This makes creating new JS files easy.

Create new file:  TestFile.js
Type "rce" and press Tab (rcf for function template)
It auto creates this template code:




- UUID (unique id generator)

> CNTL - C to stop dev server
> npm i uuid  (to install package)
> npm start (restart dev server)

import uuid from 'uuid';

id: uuid.v4();   < this will generate the ID


- React Router

> npm i react-router-dom


- HTTP API library (Axios) - can use instead of jQuery or fetch

> npm i axios





Saturday, December 22, 2018

SOLID - Liskov Substitution Principle

If S is a subtype of T, then objects of type T can be substituted by objects of type S without breaking the program.

public class Employee {
    public string Firstname {get; set;}
    public string Lastname { get; set;}

    public virtual void AssignManager (Employee Manager)
    {
          // set manager for employee
    }
}


Employee emp = new Employee();
emp.AssignManager();


Above, Employee type is T.


public class Staff : Employee {
    public string Dept {get; set;}
    public string Manager {get; set;}
}

Above, Staff (S) is a subtype of T (Employee). Liskov says that since S is a subtype of T, then this should work:


Employee emp = new Staff();
emp.AssignManager();


Let's create another subtype of Employee (T).

public class CEO : Employee{
       public string Rating {get; set;}
       public override void AssignManager(Employee manager)
       {
               throw new Exception("CEO does not have a manager");
       }
}


Above, CEO is subtype of Employee. However, this does not work and thus, it violates the Liskov Principle:

Employee emp = new CEO();
emp.AssignManager();

This code throws an exception because 1) CEO does not have a manager  2) code is set to throw error for invalid method.

Liskov Sub Principle states that Staff() should be a TRUE Employee().
CEO should be a TRUE Employee(), but it is not. So LSP is violated.

How to fix so that even CEO (subtype object of T) can be substituted for the objects of T? So that above code works?

Wednesday, December 19, 2018

Agile Methodology

2 week sprints.

Weekly PAR review. Small group reviews new defects.

BACKLOG GROOMING (every 2 weeks):
- Stories: discuss story and using pointingPoker.com to point. Goal is to create a score to help estimate relative complexity. Stories are items that add value for customer (e.g., product feature, performance improvements, etc.)
- Tasks do not get pointed. Tasks are items good things to do, but does not correlate directly to a benefit for a customer.
- Review defects (high level)
- Move priority items to top of backlog

SPRINT PLANNING (every 2 weeks):
- Occurs at the start of a sprint. 4 hrs allocated and then we officially start the sprint.
- Assess total team hours available
- Add items to sprint and check team hours remaining
- For stories, create sub-tasks
- For defects, set hours

START SPRINT
- Tickets are prioritized
- Tickets are not assigned so anyone can take
- If a bug is found during a story, create a BUG subtask and take hours from the story's time bank.

SPRINT RETROSPECTIVE (when sprint ends):
- Discuss good and bad points
- Action items (past and future)

Monday, December 17, 2018

GIT Cheat sheet

REBASE:

git rebase -i HEAD~3     > pulls up the latest 3 commits

[INSERT] Edit the interactive screen
[ESC]
[Shift :]
wq!         > saves and exits

git log    view new rebased log

git push -f origin bug/sample-1000   > pushes latest changes to origin



RESET:

git reset --hard HEAD~1    > undo prior commit and delete it
git reset --soft HEAD~1     > undo prior commit and keep changes

Tuesday, August 9, 2016

c# Dependency Injection

Dependency Injection is a way to implement the Inversion of Control (IOC) principle. 

Start of app, need to configure container. One option is to create a class to configure (register interfaces to implementations). 

Benefits of Dependency Injection.

A) Unit testing. Can now mock implementations for interfaces. So instead of actually Saving data, it mocks a successful save. Instead of reading data, it mocks returned data. In the unit test, you can Verify that each call is done. Can check logged messages. 

B) Able to change code implementations later. Without changing the "internal" code. Just change the container to register the interface to the new implementation (new class) ... existing code should work as is. This decoupling of code makes large applications very modular and flexible. It is now plug and play. 

Types of DI:

1) Constructor Injection (most popular)

public class InjectedClass
{
    private IDepInterface _iDependInterface;

    public InjectedClass(IDepInterface myInterface)
    {
        _iDependInterface = myInterface;
    }
}


2) Property Injection (applied at the property level)
 
private IDepInterface _myProp;

public IDepInterface MyDependencyProperty
{
     get { return ths._myProp;  }
    set { this.myProp = value;  }
}


3) Method Injection (when entire class doesn't need dependency, but just that one method)

public class InjectedClass
{
     readonly IDepInterface _iDependencyInterface;
  
    public MyMethod(IDepInterface myInterface)
    {
        // use myInterface
    }
}