Skip to main content

Basics of Programming

Intro to Programming


Programming language is a language in which develop programs
program is a  set of instructions - on what to do & how to do a task
Computer is a dumb machine that does nothing until you tell it what to do and how to do with the help of a program.

Levels of programming language
----------------------------------------
computer understands only binary language - (binary means it is made up of only two things - 0 and 1) - programming in binary language is very difficult and time consuming 

1. Low level or Machine language - programming done with 0's and 1's
very fast and efficient - very difficult for developers
2. Middle level language - Consists some keywords - mnemonics - we can program using mnemonics 
ADD, MUL, STO, MOV - little slower than low level , translation needed, time consuming 
a bit easier for programmer
Ex. 8086 - Microprocessors 
3. High level language - English like language - speed is low, translation needed, 
easy for developers
Ex. C, C++, Java, Python etc.

We need translators which convert middle or high level language to low level language. This job is done by software
1. Compiler - translates the source code to binary all at once
2. Interpreter - translates the source code line by line

we need software to develop the code and also need software to translate code

Software --> is a set of programs
1. System Software - Operating System - software needed to start the system - Windows, Linux, Unix, MacIntosh....
2. Application Software - Any software which runs in System software
MS office , VLC Media player, TempleRun , Super Mario

Program can be divided in to functions - one big task can be divided in to smaller tasks - for easy development - later we combine/call all functions  in to  one main function 
Function is a group of statements - which performs a task
For example
 Student Management System - software may be divided in to following functions
Student info -- function
Student Marks -- function
Student Result -- function

Programming Paradigm(Style/Model/Types of programming)
-------------------------------------------------------------------------
1. Structured/Procedure Oriented Programming
2. Object Oriented Programming


1. Structured/Procedure Oriented Programming
Program  is divided in to  functions - data is not secure
Ex. C language, C++ (hybrid)
We have a main() method calling other functions 
Top Down approach - Divide big problem in to smaller problems/functions                 
 Reusability is high.
Flexibility is less 

Example: (In C language)
-------------------------------
int result(int marks1, int marks2, int marks3){
return (marks1+marks2+marks3);
}

void main()
{
int m1, m2, m3;
  m1 = 45; m2 = 90; m3=89;
int result = result(m1,m2,m3);
}



2. Object Oriented Programming
---------------------------------------
The basic unit of programming here is an Object
Object 
---------
Real world entity - anything existing in the world is an Object
Every object has some attributes/properties that help us to uniquely identify it and it exhibits some behavior.
Ex. Bank Account, ATM Machine, Barcode reader, Pen, Laptop, You and Me , Mouse, Mobile etc
More realistic way of programming 
Bottom Up approach 
Reusability is high
Flexibility is high

Example (in Java)
----------------------
class Student{
int id;
String name;
String collegeName;
String branch;

public void studentInfo() {
//logic for student info
}

public void studentMarks() {
    //logic to get marks
}

public int result(int marks1, int marks2, int marks3){
totalMarks= marks1+marks2+marks3;
return totalMarks;
}
public static void main(String args[]) {
Student obj = new Student();    //object
obj.studentInfo();
obj.studentMarks();
obj.result(34,45,56);
Student s1 = new Student();
}
}


OOPS (Object Oriented Programming)
----------------------------------------------
**Concepts
=========
1. Class     class is a blue print or template for creating objects - it is a group of similar type of objects - class helps to create objects 
2. Object       -     real world entity - memory is not allocated until object is created.     Objects have attributes and behavior 
attributes - characteristics which help us identify object, differentiate from others-- technically represented by data members or variables in a program
behavior - functionality - technically represented by methods
3. Abstraction -     hiding internal implementation details from the end user 
4. Encapsulation - Wrapping up of data members (variables) and member functions (methods in to        single unit  - like capsule - provides security to data 
5. Inheritance - Reusability concept - DRY concept (Don't Repeat Yourself) 
6. Polymorphism - Poly = many , morphos = forms ---> something existing in multiple forms


Comments

Popular posts from this blog

Types of programming languages | Software

Hi, Lets get going further in to the basics of computers. For those of you who are new to this blog, I recommend you to go through part - 1 of the basics before going ahead with this post. Here is the link to part-1: https://techspireme.blogspot.in/2018/04/basics-of-computers.html We have already read from part 1 that Software is a set of applications. Software is basically of two types: 1. System software: software required to start up the system i.e the Operating System software (by booting - a process named Boot Strap Loader loads the operating system from the Hard disk drive to the working memory RAM) 2. Application software: Software designed for a specific purpose that is a collection of programs. Application software always runs on the top of system software. Examples of Application software are: word processors like notepad, wordpad A suite of applications like MS Office Media players (VLC etc) and many more. System software is the base on which applicat...

Types of Computers

Based on the size, computing power and capabilities, the computers are divided in to several types. Let us have a look at these ranking from top to low. 1. Super Computer The fastest and extremely fast computer capable of execution hundreds of millions of instructions per second (MIPS) is called a Super computer. They are highly expensive (around 50-100 million dollars to a few billion dollars) and most powerful.  It can execute n* 10 power 10 to n* 10 power 50 operations per second ex. the NASA super computer Pleiades can execute 5.95 to 7.25 petaflops per second.  1petaflop = one thousand million million = 10 power 15 floating-point operations per second - FLOPS) The super computers are used in research purposes and in intense calculations like weather forecast, Earth quake studies, nuclear reactors & simulations, Astro physics, complex scientific operations etc. NASA uses super computers to launch satellites, rockets and for space exploration. Ti...

Everything about computers

Hi, I am quite excited to start the technical part of my blog! I hope so are you! Let's start with the Abc of computers that we all find a bit hard to put in to words. These are my own definitions made really simple and easy to understand! Computer:   An electronic device that computes, stores, processes , manipulates and displays the data. Coined from the term "compute", means to calculate. Facts:  First ever computer was used for mathematical calculations. Founder: Charles Babbage - The Father of computers - invented the first ever mechanical computer called "Babbage's Analytical Engine"! Features of a Computer / Advantages of computer over a calculator: Speed, Accuracy, Storage, Multi tasking, Diligence (and many more). A computer comprises of Software and Hardware (all the physical - internal or external components/peripherals that are connected to or a part of computer ex. Keyboard, Mouse, Cabinet, Joystick, USB - pen drive etc. that we c...