Day 1 : “Getting Into Programming World”

 On Day 1 :  “Getting Into Programming World” 

Let us learn about :

 

> Why C++ in software development   

 

> Steps In developing a C++ program  

 

> How to enter, compile, and link your first C++ program


Brief History:

Early On, Programmers worked with Machine Language which were represented as long strings and zeros.

 

After a while the assemblers were invented to map machine instructions to the human-readable those where ADD and MOV .

 

Meanwhile higher-level-languages were evolved those where BASIC & COBOL.

These languages helped people in approximating words and sentences, for example Let P = 2000. 
This instruction was translated into machine language by interpreters and compilers.

Interpreter : 

An interpreter translates and executes a program as it reads it, turning the program instructions directly into actions.

Compiler : 

A compiler translates source code into an intermediary Language. This step is called compiling, and that produces an object file. The compiler then invokes a linker, which combines the object file into an executable program.

(I Hope You are OK with the History of Programming World)

 

Programming Language is a Source for Problem Solving :

Programming languages usability now-a-days are not as languages that were used in past 10 to 20 years. 

It is not only used for managing the large amount of data or processing raw data they are getting used by the people in problem solving, business problems solving and etc. 

Now-a-days we use the friendly user interfaces namely menus, multiple windows, dialogue boxes and etc.

Evolution of Programming Languages: 

Procedural Language :  Also called as function or Method . It works of specific instructions executed one after the other.

 Structured Programming : It will help you to keep a track on which function is     called and which function is responding to it by which what was the data change   status.

 Example for Structured Programming : Let me find the best college offer Chemical Engineering across India in which a student need low fee payment, that might be complex . However, we can find it by breaking it down into the following subtasks:

1. Count how many Colleges you have across India. 

2. Divide it by Sectors (Govt , Private, Affiliated & so on . 

3. Total all the Sector Colleges. 

4. Divide the total by the number of Colleges by NBA Accreditation. 

5. Then divide the colleges based on the NAAC Grade. 

Then choosing the best colleges can be broken down into the following steps: 

1. Get record of colleges with NAAC Grade above A+.  

2. Look for Chemical Branch in the Institute (college)

2. Find the fee structure 

Then choosing the college according to the low college fees after which the steps:

1. Lookout for the college location. 

2. Add the college to the wish list if nearer to the location of your residence or with the hostel facilities and with low hostel fees . 

3. Get the next College record and do the same.  

In turn, obtaining each colleges record can be broken down into the following: 

1. Open the files of colleges. 

2. Go to the correct record. 

3. Read the data and get joined

 

By which you support in saving your time in searching the best colleges from the rest.

Structured programming is often called procedural programming because of its focus on procedures rather than focusing on "Objects".


Second, people were in need of reusing functions. But functions that work for a typed data often could not be used with other typed data because the approach might be different which made in limiting the benefits gained.

Object-Oriented Programming  (OOP)

OOP will provide various techniques in managing enormous complexities along with achieving the reusability factor of software components by grouping them as object (s). 

Use of OOP is to model the "Objects" rather than simply using it as "Data" all the time. Object might be Colleges  (From the above example).     

Objects have characteristics, also called properties or attributes such as Govt College, Private College, NAAC Grade, NBA  (From the above example).  

They also have capabilities, also called operations or functions such as choose_this_college( ) or ignore_this_college( )   (From the above example). The main work of OOP is to represent these objects.

C++ :

 C++ fully supports object-oriented programming, 

It is due to 3 concepts in it (These are just like 3 children support family in being stronger) 

1. Encapsulation, 

2. Inheritance (Reuse) & 

3. Polymorphism.


Encapsulation :

C++ supports encapsulation through creating a user-defined types, called classes. I will explain more about in , “Understanding Object-Oriented Programming.” After being created, a well-defined class acts as a fully encapsulated entity—it is used as a complete unit. Users , they just need to know how to use it not about how the class works since it is hidden.

Example: 
Using fan with no idea on internally working of capacitors and internal wired connections.
Using refrigerator with no idea on how compressor works. 
Fan and Refrigerators are the well defined Objects & the Capacitors and Compressors are the well defined classes.

Inheritance (Reuse) :

With Inheritance, you can declare a new type that is an extension of an existing type of class. This new subclass is said to derive from the existing type and is sometimes called a derived type.


Example: Great Grand Father -> Grand Father -> Father -> Son -> Grand Son -> Great Grand Son ............................................... so on , where we find the inherited characteristics between any two successive generation (s). 

Let previous generation be a class then next generation will be inherited with some additional features (It will be the subclass that has derived from the existing class (Previous Generation)).

Polymorphism:

The new generation might respond differently than a Previous generation did when you assign them the same work. C++ supports the idea that different objects do “the right thing” through what is called function polymorphism and class polymorphism. Poly means many, and morph means form. Polymorphism refers to the same name taking many forms.
Polymorphism means "many forms", and it occurs when we have many classes that are related to each other by inheritance. Inheritance lets us inherit attributes and methods from another class. Polymorphism uses those methods to perform different tasks.

Should I Learn C First? :

It is unnecessary to learn C Programming Language because C++ is a superclass for the C programming language.

C++, Java, and C# :

 C++ is one of the best languages for the development of software. C++ and Java are the two languages are so similar that to learn one is to learn 85 percent of the other. C# is a newer language developed by Microsoft for the .NET platform. C# uses essentially the same syntax as C++, and although the languages are different in a few important ways. If you learn C++ then it will be the best investment in learning C#.

Steps In developing a C++ program :

Creating an Object File with the compiler

Creating an Executable File with the Linker

The steps for the executable file are 
1. Create a source code file (.cpp). 
2. Compile the source code into an object file (.obj). 
3. Link Object file with any needed libraries to produce an executable program.


How to enter, compile, and link your first C++ program (Development Cycle) :

To create and test the Hello World program,

 follow these steps: 

1. Start the compiler. 

2. Choose File, New from the menus. 

3. Choose Win32 Console Application and enter a project name, such as hello, and click OK.

4. Choose An Empty Project from the menu of choices and click Finish. A dialog box is displayed with new project information. 

5. Start your hello.cpp program

6. #include<iostream> // iostream library helps in input and output operations.

    using namespace std; //namespace will help in avoiding confusion

    int main( )             //main function

    {

        cout<<"Hello World\n"; 

        return 0;

     }

Output: Hello World


Summary:

 After reading Day-01 Blog page, you should have a good understanding of how C++ evolved and what problems it was designed to solve. Today, you learned how to enter, compile, link & run first C++ program, and what the normal development cycle is. You also learned a little of what object-oriented programming is all about. You will return to these topics during the next blog pages.



Comments