Brief Introduction To Computers And Programming¶
Lets talk a little bit about computer. If we do not have computers most of the works will take much time to complete it. Computers reduces the human efforts and speedup the working process. It doesn't make errors while doing a task, but humans do. There are other factors that affect humans to make errors.
Lets start with introduction to computers and its working.
What is computer?¶
- A computer is an electronic device. It takes inputs such as numbers, text, images, videos, sound, etc. and processes it and converts it into meaningful information that can be understand by humans.
- A computer solves/computes complex problems quickly but, humans take years to compute it.
Hardware Vs Software¶
- In a computer, hardware is everything that makes a computer to work.
- A CPU processes information and the information can be stored in memory(RAM/ROM)
- A sound card can provide sound to speakers and a video card can provide an image to a monitor. All of this is hardware.
- Software is a collection of instructions that enable the user to interact with a computer, its hardware, or perform tasks.
- Without software, most computers would be useless.
- For example, without our browser(chrome/firefox, etc) software, we could not surf the Internet and without an OS, the browser could not run on our computer.
Types of computer memories¶
- Memory is the best essential element of a computer because computer can’t perform simple tasks. The performance of computer mainly based on memory and CPU.
Primary Memory(RAM - Random Access Memory):
Secondary Memory(ROM - Read Only Memory):
- It's a non volatile memory. We can have the information after power off the computer.
- Types of ROM's:
Speed in RAM vs ROM¶
- RAM is faster than ROM. Because, RAM is made of transistors where as ROM is made of magnetic disks/coils.
- RAM is very costly compared to ROM.
What is programming?¶
- Programming is the process of creating a set of instructions that tell a computer how to perform a task.
Example: find a given number is even or not ?
- To solve above problem we write instructions to the computer that tells computer how to solve it.
- The process of writing instructions to the computer is called programming.
What is programming language?
- The computer language which is used to write programs is a programming language.
- Python, Java, C, C++, .Net, etc.
Natural languages vs Formal languages¶
- Natural languages are the languages that people speak, such as English,Telugu, Hindi, etc.
- Natural languages were not designed by people, they evolved naturally.
- Formal languages are languages that are designed by people for specific applications.
- Some of the formal languages are chemical representation of formulas, computer programming languages(python, java, etc).
Compilers vs Interpreters¶
- A compiler is a software program that converts high-level source code that is written by a developer in a high-level source code into machine understandable code.
- A compiler reads all lines in a program at a time and checks for syntax errors if found it reports all errors at once. If no error found then it produces bytecode/machine understandable code.
- On execution of bytecode we will get output.
- An interpreter is a software program that converts high-level source code into byte code or machine understandable code.
- An interpreter reads one line at a time in a program and executes it on machine. If it finds any error then it will stop executing.
- Compiled code is faster than interpreted code. Because compilers uses static typing where as interpreters uses dynamic typing.
Types of programming languages?¶
High-level languages: Human understandable computer languages but these need a compiler or an interpreter to convert it into a machine understandabe code.
- Examples: C, Java, Python, C++, .Net, R, Ruby, etc.
Low level language: These are machine understandable languages. For humans these are very difficult to understand.
- Examples: Assembly