Skip to content

Instantly share code, notes, and snippets.

View wataruoguchi's full-sized avatar
🦥
Curiosity Driven

Wataru Oguchi wataruoguchi

🦥
Curiosity Driven
View GitHub Profile
@wataruoguchi
wataruoguchi / cleanArchitecturePart1.md
Last active May 16, 2021 23:49
Clean Architecture - PART I - Introduction #bookclub

Clean Architecture

PART I - Introduction

Getting it right is another matter entirely. Getting software right is hard.

Have you worked on a project that required reading tons of code? - Many people would have, unless it's a very early stage project, or your personal project. Often times, we're forced to read a huge code base. You must have a huge task trackers and almost endless backlogs. There's not enough architecture / design mindset, from my experience.

Chapter 1 - What Is Design and Architecture?

Bookclub

Process

  1. テーマになる本を決めます。
  2. 週に一章ペースで読み進めます。
  3. 週に一度チームで集まり、その週に読んだ章について話し合います。

Motivation

  • 書籍から得た共通の語彙や知識をチームで一緒に蓄えることができます。
  • 読み進めていく上で発生した疑問をチームに問いかけることができます。
@wataruoguchi
wataruoguchi / RefactoringChapter4.md
Created March 17, 2021 05:52
Refactoring - Chapter 4: Building Tests

Refactoring

Chapter 4: Building Tests

Even without refactoring, writing good tests increases my effectiveness as a programmer.

He also mentioned that "Agile" is formed with the following factors:

  • CI
  • Self-testing code
@wataruoguchi
wataruoguchi / RefactoringChapter3.md
Created March 3, 2021 07:12
Refactoring - Chapter 3: Bad Smells in Code

Refactoring

Chapter 3: Bad Smells in Code

“If it stinks, change it”

  • Grandma Beck, discussing child-rearing philosophy

Mysterious Name

@wataruoguchi
wataruoguchi / RefactoringChapter2.md
Created January 31, 2021 21:31
Refactoring - Chapter 2: Principles in Refactoring

Refactoring

Chapter 2: Principles in Refactoring

The previous chapter explained what refactoring is. This chapter is about some of the principles.

Defining Refactoring

  • Refactoring (noun): a change made to the internal structure of software to make it easier to understand and cheaper to modify without changing its observable behaviour.
  • Refactoring (verb): to restructure software by applying a series of refactorings without changing its observable behaviour.
@wataruoguchi
wataruoguchi / RefactoringChapter1.md
Created January 22, 2021 17:46
Refactoring - Chapter 1: Refactoring: A First Example

Refactoring

Chapter 1: Refactoring: A First Example

The Starting Point

Comments on the Starting Program

... when I change the system, there is a human involved, and humans do care.

@wataruoguchi
wataruoguchi / codeReadingNotesIstanbuljs.md
Created January 23, 2020 07:32
Notes for reading istanbuljs

Reading istanbuljs

It's a class file.

class Instrumenter

  • Methods:
    • instrumentSync: It takes code, filename, and inputSourceMap. It creates babelOpts and generate sourcemap and AST with @babel/core#transformSync. The babelOpts is using their own plugin programVisitor. readInitialCoverage is used against the AST generated.
  • instrument: Callback style... not sure if I'm interested.
// https://www.geeksforgeeks.org/rat-in-a-maze-backtracking-2/
// Rat in a maze
// https://practice.geeksforgeeks.org/problems/rat-in-a-maze-problem/1
function printSolution(grid) {
console.log(grid.map((row) => row.join(' | ')).join('\n') + '\n');
}
function isSafe(maze, x, y) {
const length = maze.length;
// https://www.geeksforgeeks.org/maximum-sum-increasing-subsequence-dp-14/
// https://practice.geeksforgeeks.org/problems/maximum-sum-increasing-subsequence/0
function maxSumIncreasingSubsequence(arr) {
const len = arr.length;
let idx;
let idx2;
let resSum = [...arr];
// Loop through all members
for (idx = 1; idx < len; idx++) {
// https://www.geeksforgeeks.org/longest-increasing-subsequence-dp-3/
// https://practice.geeksforgeeks.org/problems/longest-increasing-subsequence/0
/**
* Optimal Substructure:
* Let arr[0..n-1] be the input array and L(i) be the length of the LIS ending
* at index i such that arr[i] is the last element of the LIS.
* Then, L(i) can be recursively written as:
* L(i) = 1 + max( L(j) ) where 0 < j < i and arr[j] < arr[i]; or
* L(i) = 1, if no such j exists.