2016. 02. 12

# Field Development

## Solve a problem

• Think
• Code
• Goto Think while not accepted

## Code a general program

• Think
• Code
• Goto Think while not qualified

• Procedure

• Procedure
• Tool

• Procedure
• Tool
• Due

• Procedure
• Tool
• Due
• Bugs

• Procedure
• Tool
• Due
• Bugs
• ...

• Procedure
• Tool
• Due
• Bugs
• ...

• Scale
• Complexity
• ...

• Procedure
• Tool
• Due
• Bugs
• ...

## Differences

• Scale
• Complexity
• ...

They're both programming!

# NO MORE

### ...but still better than making no layer at all.

``````void main() {
input();
process();
output();
}``````

# Quiz

dist

P1

P2

``double dist = (P1 - P2).size();``

# Quiz

dist

P1

P2

``````double dist = (P1 - P2).size();
double theta = acos(R / dist);``````

theta

theta

R

# Quiz

dist

P1

P2

``````double dist = (P1 - P2).size();
double theta = acos(R / dist);
Point base = (P1 - P2).resize(R);``````

theta

theta

base

R

# Quiz

dist

P1

P2

``````double dist = (P1 - P2).size();
double theta = acos(R / dist);
Point base = (P1 - P2).resize(R);
Point ans[] = {P2 + base.rotate(theta),
P2 + base.rotate(-theta)}; ``````

theta

theta

base

base.rotate(theta)

base.rotate(-theta)

# Base struct for Point

``````struct Point {
double x, y;
Point operator – (Point arg) { return Point{x – arg.x, y – arg.y}; }
double size() { return hypot(x, y); }
Point resize(double newSize) {
double ratio = newSize / size();
return Point{x * ratio, y * ratio};
}
Point rotate(double theta) {
return Point{x * cos(theta) – y * sin(theta),
x * sin(theta) + y * cos(theta)};
}
};``````

## Abstraction

• is the way we think

## Abstraction

• is the way we think
• makes code simpler

## Abstraction

• is the way we think
• makes code simpler
• Easy to debug / review

# And?

Much more similarities to go!

By xhae

• 1,059