Programming
Approach
-
Programs dont respond to
make tea rather they expect instructions
-
These instructions or the way we represent these instructions is referred as programming logic or algo etc.
-
Note:
- Never Write Program with out instructions
- Programs fail
-
Principle: Programming is 80% debugging and 20% writing
-
Lets instruct
chaitra
-
Chaitra knows + -
- Sample instruction
Hi chaitra
say 5 + 6
11
Hi Chaitra
remember 90 as maths
remember 80 as science
say maths + science
170
- Write instructions for chaitra to calculate 3 * any number.
Chaitra knows + -
Hello Chaitra
Remember 2 as number
say number + number + number
- Chaitra now knows
+ - * / // % ==
- Write instructions for chaitra to say if the number is even
Hello Chaitra
Remember 6 as number
calculate number %2 and remember as result
say even if result == 0
- Moral of story sofar
- Learn to write instructions
- Examine Instructions (debugging)
How Programs are Executed on a System
- Typically we run our program on Operating Systems.
- Operating System allows us to
- run custom applications
- allows application to interacts with hardware with an abstracted interface
-
Operating Systems creates a Process with a unique id, some ram & cpu allocated to it
-
CPU w.r.t your program executes instructions and RAM stores values
Memory in RAM
- Data Types: The basic idea of data type is to allocate memory in a way convinient to developers.
- Size
- nature:
- static size (mutable types)
- dynamic size (immutable types)
Like this:
Like Loading...