2015년 1월 28일 수요일

Software & Hardware

What distinguishes software from hardware is the fact that it's alive.

It changes over time unlike hardware that don't.

Then, what makes software alive? ( = easy to change?)

  • Modularity (makes codes easy to fix)
  • Careful documentation of specification (makes codes readable)
  • Defensive programming (makes bugs easier to detect)



* small thought: These days, however, hardware is becoming alive(= easier to change) with modularization. See Google's Ara. Software's 'softness' is being injected into hardware.

2015년 1월 15일 목요일

Algorithms - baby step

1. Straight line algorithms: every code is executed, no reuse    (construct: sequence)

2. Branching algorithms: some codes are not executed, no reuse    (construct: selection)

1] conditional statement (if, elif, else)

3. Iterative algorithms (looping algorithms): reuse code    (construct: loop)

1] guess and check algorithms (for, while loop)

->  ways to generate guesses:

1) Exhaustive enumeration
2) Bisection search: faster
3) Newton-Raphson method: even faster

4. Recursive algorithms: call code multiple times (same code within the code, fractal)

2015년 1월 14일 수요일

Functions

Functions: Custom-made functions   cf) built-in functions


  • Make your own functions and play with it like Lego block.
  • Clients don't have to know what's inside the block. If the block is what you want, you can use it without knowing how it is structured inside.
  • Functions are composed of primitive calculations and algorithms. However, from a broad view, functions become primitive calculations that belong to broader algorithms.



Expressions: Everything that returns value.   cf) statements

source: https://docs.python.org/2/glossary.html

Control:

Invocation: invoke = call