Monday, November 19, 2018

Object Orinted Programming &''C++ Part 2

PART 2




1.7 Object Oriented Language

 Object-oriented programming is not the right of any particular languages. Like structured programming, OOP concepts can be implemented using languages such as C and Pascal. However, programming becomes clumsy and may generate confusion when the programs grow large. A language that is specially id designed to support the OOP concepts makes it easier to implement them.

 The languages should support several of the OOP concepts to claim that they are object-oriented. Depending upon the features they support, they can be classified into the following two categories

: 1. Object-based programming languages, and
2. Object-oriented programming languages
.
Object-based programming is the style of programming that primarily supports encapsulation and object identity. Major feature that are required for object based programming are:

• Data encapsulation
• Data hiding and access mechanisms
• Automatic initialization and clear-up of objects
 • Operator overloading

Languages that support programming with objects are said to the objects-based programming languages. They do not support inheritance and dynamic binding. Ada is a typical object-based programming language. Object-oriented programming language incorporates all of object-based programming features along with two additional features, namely, inheritance and dynamic binding. Object-oriented programming can therefore be characterized by the following statements:

 Object-based features + inheritance + dynamic binding

1.8 Application of OOP

 OOP has become one of the programming buzzwords today. There appears to be a great deal of excitement and interest among software engineers in using OOP. Applications of OOP are beginning to gain importance in many areas. The most popular application of object-oriented programming, up to now, has been in the area of user interface design such as window. Hundreds of windowing systems have been developed, using the OOP techniques. Real-business system are often much more complex and contain many more objects with complicated attributes and method. OOP is useful in these types of application because it can simplify a complex problem.

The promising areas of application of OOP include:

 • Real-time system
 • Simulation and modeling
• Object-oriented data bases
• Hypertext, Hypermedia, and expertext
• AI and expert systems
• Neural networks and parallel programming
• Decision support and office automation systems
• CIM/CAM/CAD systems


 1.10 Simple C++ Program

 Let us begin with a simple example of a C++ program that prints a string on the


simple c++ program

#include<iostream>
 void main()
{


1.10.1 Program feature

 Like C, the C++ program is a collection of function. The above example contain only one function main(). As usual execution begins at main(). Every C++ program must have a main(). C++ is a free form language. With a few exception, the compiler ignore carriage return and white spaces. Like C, the C++ statements terminate with semicolons.

1.10.2 Comments

 C++ introduces a new comment symbol // (double slash). Comment start with a double slash symbol and terminate at the end of the line
. A comment may start anywhere in the line, and whatever follows till the end of the line is ignored. Note that there is no closing symbol.
 The double slash comment is basically a single line comment. Multiline comments can be written as follows
: // This is an example of
 // C++ program to illustrate
 // some of its features The C comment symbols /*,*/
 are still valid and are more suitable for multiline comments. The following comment is allowed: /* This is an example of C++ program to illustrate some of its feature



1.10.3 Output operator The only statement in program 1.10.1 is an output statement. The statement Cout<<”C++ is better than C.”; Causes the string in quotation marks to be displayed on the screen. This statement introduces two new C++ features, cout and <<. The identifier cout(pronounced as C out) is a predefined object that represents the standard output stream in C++. Here, the standard output stream represents the screen. It is also possible to redirect the output to other output devices. The operator << is called the insertion or put to operator.


 1.10.4 The iostream File


 We have used the following #include directive in the program: #include The #include directive instructs the compiler to include the contents of the file enclosed within angular brackets into the source file. The header file iostream.h should be included at the beginning of all programs that use input/output statements. 

Object Oriented Programming & C++ Part 1




Object Oriented Paradigm

The major motivating factor in the invention of object-oriented approach is to remove some of the flaws encountered in the procedural approach. OOP treats data as a critical element in the program development and does not allow it to flow freely around the system. It ties data more closely to the function that operate on it, and protects it from accidental modification from outside function. OOP allows decomposition of a problem into a number of entities called objects and then builds data and function around these objects. The organization of data and function in object-oriented programs is shown in fig.1.3. The data of an object can be accessed only by the function associated with that object. However, function of one object can access the function of other objects. Organization of data and function


Image result for object oriented paradigm
Add caption


Some of the features of object oriented programming are:
 • Emphasis is on data rather than procedure.

• Programs are divided into what are known as objects.

 • Data structures are designed such that they
 characterize the objects

 • Functions that operate on the data of an object are ties together in the data structure.

 • Data is hidden and cannot be accessed by external function.

• Objects may communicate with each other through function.

 • New data and functions can be easily added whenever necessary.

• Follows bottom up approach in program design. Object-oriented programming is the most recent
 concept among programming paradigms and still means different things to different people.



1.5 Basic Concepts of Object Oriented Programming
 It is necessary to understand some of the concepts used extensively in object-oriented programming. These include:


 • Objects •
 Classes •
Data abstraction and encapsulation
• Inheritance
• Polymorphism
 • Dynamic binding
 • Message passing We shall discuss these concepts in some detail in this section.


1 OBJECT


Objects are the basic run time entities in an object-oriented system. They may represent a person, a place, a bank account, a table of data or any item that the program has to handle. They may also represent user-defined data such as vectors, time and lists. Programming problem is analyzed in term of objects and the nature of communication between them. Program objects should be chosen such that they match closely with the real-world objects. Objects take up space in the memory and have an associated address like a record in Pascal, or a structure in c. When a program is executed, the objects interact by sending messages to one another. Foe example, if “customer” and “account” are to object in a program, then the customer object may send a message to the count object requesting for the bank balance. Each object contain data, and code to manipulate data. Objects can interact without having to know details of each other’s data or code. It is a sufficient to know the type of message accepted, and the type of response returned by the objects. Although different author


Image result for fig for representing object in oop




2 Classes


We just mentioned that objects contain data, and code to manipulate that data. The entire set of data and code of an object can be made a user-defined data type with the help of class. In fact, objects are variables of the type class. Once a class has been defined, we can create any number of objects belonging to that class. Each object is associated with the data of type class with which they are created. A class is thus a collection of objects similar types. For examples, Mango, Apple and orange members of class fruit. Classes are user-defined that types and behave like the built-in types of a programming language. The syntax used to create an object is not different then the syntax used to create an integer object in C. If fruit has been defines as a class, then the statement Fruit Mango; Will create an object mango belonging to the class fruit.


.3 Data Abstraction and Encapsulation


 The wrapping up of data and function into a single unit (called class) is known as encapsulation. Data and encapsulation is the most striking feature of a class. The data is not accessible to the outside world, and only those functions which are wrapped in the class can access it. These functions provide the interface between the object’s data and the program. This insulation of the data from direct access by the program is called data hiding or information hiding. Abstraction refers to the act of representing essential features without including the background details or explanation. Classes use the concept of abstraction and are defined as a list of abstract attributes such as size, wait, and cost, and function operate on these attributes. They encapsulate all the essential properties of the object that are to be created. The attributes are some time called data members because they hold information. The functions that operate on these data are sometimes called methods or member function.


Inheritance

 is the process by which objects of one class acquired the properties of objects of another classes. It supports the concept of hierarchical classification. For example, the bird, ‘robin’ is a part of class ‘flying bird’ which is again a part of the class ‘bird’. The principal behind this sort of division is that each derived class shares common characteristics with the class from which it is derived as illustrated in fig 1.6. In OOP, the concept of inheritance provides the idea of reusability. This means that we can add additional features to an existing class without modifying it. This is possible by deriving a new class from the existing one. The new class will have the combined feature of both the classes. The real appeal and power of the inheritance mechanism is that it

 Fig. 1.6 Property inheritances

Image result for fig for reprasenting inheritance in oop

Allows the programmer to reuse a class i.e almost, but not exactly, what he wants, and to tailor the class in such a way that it does not introduced any undesirable side-effects into the rest of classes.


Polymorphism


 is another important OOP concept. Polymorphism, a Greek term, means the ability to take more than on form. An operation may exhibit different behavior is different instances. The behavior depends upon the types of data used in the operation. For example, consider the operation of addition. For two numbers, the operation will generate a sum. If the operands are strings, then the operation would produce a third string by concatenation. The process of making an operator to exhibit different behaviors in different instances is known as operator overloading. Fig. 1.7 illustrates that a single function name can be used to handle different number and different types of argument. This is something similar to a particular word having several different meanings depending upon the context. Using a single function name to perform different type of task is known as function overloading.

Image result for fig for reprasenting polymorphism in oop




.6 Dynamic Binding

 Binding refers to the linking of a procedure call to the code to be executed in response to the call. Dynamic binding means that the code associated with a given procedure call is not known until the time of the call at run time. It is associated with polymorphism and inheritance. A function call associated with a polymorphic reference depends on the dynamic type of that reference. Consider the procedure “draw” in fig. 1.7. by inheritance, every object will have this procedure. Its algorithm is, however, unique to each object and so the draw procedure will be redefined in each class that defines the object. At run-time, the code matching the object under current reference will be called.


 .7 Message Passing

An object-oriented program consists of a set of objects that communicate with each other. The process of programming in an object-oriented language, involves the following basic steps: 1. Creating classes that define object and their behavior, 2. Creating objects from class definitions, and 3. Establishing communication among objects. Objects communicate with one another by sending and receiving information much the same way as people pass messages to one another. The concept of message passing makes it easier to talk about building systems that directly model or simulate their realworld counterparts. A Message for an object is a request for execution of a procedure, and therefore will invoke a function (procedure) in the receiving object that generates the desired results. Message passing involves specifying the name of object, the name of the function (message) and the information to be sent. Example: Employee. Salary (name);


Image result for fig for representing message passing in oop


Object has a life cycle. They can be created and destroyed. Communication with an object is feasible as long as it is alive.




1.6 Benefits of OOP


OOP offers several benefits to both the program designer and the user. ObjectOrientation contributes to the solution of many problems associated with the development and quality of software products. The new technology promises greater programmer productivity, better quality of software and lesser maintenance cost. The principal advantages are:

 • Through inheritance, we can eliminate redundant code extend the use of existing

• Classes.
 • We can build programs from the standard working modules that communicate with one another, rather than having to start writing the code from scratch. This leads to saving of development time and higher productivity.
 • The principle of data hiding helps the programmer to build secure program that can not be invaded by code in other parts of a programs.
• It is possible to have multiple instances of an object to co-exist without any interference.
• It is possible to map object in the problem domain to those in the program.
• It is easy to partition the work in a project based on objects.
 • The data-centered design approach enables us to capture more detail of a model can implemental form.
• Object-oriented system can be easily upgraded from small to large system.
 • Message passing techniques for communication between objects makes to interface descriptions with external systems much simpler.
• Software complexity can be easily managed.

 While it is possible to incorporate all these features in an object-oriented system, their importance depends on the type of the project and the preference of the programmer. There are a number of issues that need to be tackled to reap some of the benefits stated above. For instance, object libraries must be available for reuse. The technology is still developing and current product may be superseded quickly. Strict controls and protocols need to be developed if reuse is not to be compromised.


PART 2



                                             Image result for arrow symbol
   

Thursday, July 26, 2018

HTML & History of HTML


Hypertext Markup Language (HTML

Hypertext Markup Language (HTML) is the standard markup language for creating web pages and web applications. With Cascading Style Sheets (CSS) and JavaScript, it forms a triad of cornerstone technologies for the World Wide Web.[4]Web browsers receive HTML documents from a web server or from local storage and render the documents into multimedia web pages. HTML describes the structure of a web page semantically and originally included cues for the appearance of the document.
HTML elements are the building blocks of HTML pages. With HTML constructs, images and other objects such as interactive forms may be embedded into the rendered page. HTML provides a means to create structured documents by denoting structural semantics for text such as headings, paragraphs, lists, links, quotes and other items. HTML elements are delineated by tags, written using angle brackets. Tags such as <img /> and <input /> directly introduce content into the page. Other tags such as <p> surround and provide information about document text and may include other tags as sub-elements. Browsers do not display the HTML tags, but use them to interpret the content of the page.
HTML can embed programs written in a scripting language such as JavaScript, which affects the behavior and content of web pages. Inclusion of CSS defines the look and layout of content. The World Wide Web Consortium (W3C), maintainer of both the HTML and the CSS standards, has encouraged the use of CSS over explicit presentational HTML since 1997.[5]  




Photograph of Tim Berners-Lee in April 2009
Tim Berners-Lee

History

Development



In 1980, physicist Tim Berners-Lee, a contractor at CERN, proposed and prototyped ENQUIRE, a system for CERN researchers to use and share documents. In 1989, Berners-Lee wrote a memo proposing an Internet-based hypertext system.[6] Berners-Lee specified HTML and wrote the browser and server software in late 1990. That year, Berners-Lee and CERN data systems engineer Robert Cailliau collaborated on a joint request for funding, but the project was not formally adopted by CERN. In his personal notes[7] from 1990 he listed[8]"some of the many areas in which hypertext is used" and put an encyclopedia first.
The first publicly available description of HTML was a document Tim Berners-Leecalled "HTML Tags", first mentioned on the Internet by Tim Berners-Lee in late 1991.[9][10] It describes 18 elements comprising the initial, relatively simple design of HTML. Except for the hyperlink tag, these were strongly influenced by SGMLguid, an in-house Standard Generalized Markup Language(SGML)-based documentation format at CERN. Eleven of these elements still exist in HTML 4.[11]
Related image HTML is a markup language that web browsers use to interpret and compose text, images, and other material into visual or audible web pages. Default characteristics for every item of HTML markup are defined in the browser, and these characteristics can be altered or enhanced by the web page designer's additional use of CSS. Many of the text elements are found in the 1988 ISO technical report TR 9537 Techniques for using SGML, which in turn covers the features of early text formatting languages such as that used by the RUNOFF command developed in the early 1960s for the CTSS (Compatible Time-Sharing System) operating system: these formatting commands were derived from the commands used by typesetters to manually format documents. However, the SGML concept of generalized markup is based on elements (nested annotated ranges with attributes) rather than merely print effects, with also the separation of structure and markup; HTML has been progressively moved in this direction with CSS.
Berners-Lee considered HTML to be an application of SGML. It was formally defined as such by the Internet Engineering Task Force (IETF) with the mid-1993 publication of the first proposal for an HTML specification, the "Hypertext Markup Language (HTML)" Internet Draft by Berners-Lee and Dan Connolly, which included an SGML Document type definition to define the grammar.[12][13] The draft expired after six months, but was notable for its acknowledgment of the NCSA Mosaic browser's custom tag for embedding in-line images, reflecting the IETF's philosophy of basing standards on successful prototypes.[14]Similarly, Dave Raggett's competing Internet-Draft, "HTML+ (Hypertext Markup Format)", from late 1993, suggested standardizing already-implemented features like tables and fill-out forms.[15]                                                                   Image result for history of htmlAfter the HTML and HTML+ drafts expired in early 1994, the IETF created an HTML Working Group, which in 1995 completed "HTML 2.0", the first HTML specification intended to be treated as a standard against which future implementations should be based.[16]Further development under the auspices of the IETF was stalled by competing interests. Since 1996, the HTML specifications have been maintained, with input from commercial software vendors, by the World Wide Web Consortium (W3C).[17] However, in 2000, HTML also became an international standard (ISO/IEC 15445:2000). HTML 4.01 was published in late 1999, with further errata published through 2001. In 2004, development began on HTML5 in the Web Hypertext Application Technology Working Group (WHATWG), which became a joint deliverable with the W3C in 2008, and completed and standardized on 28 October 2014.[18]

C Basic commands & Explanation


C Basic commands

Explanation

#include <stdio.h>

This is a preprocessor command that includes standard input output header file(stdio.h) from the C library before compiling a C program

int main()

This is the main function from where execution of any C program begins.

{

This indicates the beginning of the main function.

/*_some_comments_*/

whatever is given inside the command “/*   */” in any C program, won’t be considered for compilation and execution.

printf(“Hello_World! “);

printf command prints the output onto the screen.

getch();

This command waits for any character input from keyboard.

return 0;

This command terminates C program (main function) and returns 0.

}

This indicates the end of the main function.



2. A SIMPLE C PROGRAM:


Below C program is a very simple and basic program in C programming language. This C program displays “Hello World!” in the output window. And, all syntax and commands in C programming are case sensitive. Also, each statement should be ended with semicolon (;) which is a statement terminator.


C

Sunday, July 22, 2018

C Programing Overview

Overview


Dennis Ritchie (right), the inventor of the C programming language, with Ken Thompson
Like most imperative languages in the ALGOL tradition, C has facilities for structured programming and allows lexical variable scope and recursion, while a static type system prevents many unintended operations. In C, all executable code is contained within subroutines, which are called "functions" (although not in the strict sense of functional programming). Function parameters are always passed by value. Pass-by-reference is simulated in C by explicitly passing pointer values. C program source text is free-format, using the semicolon as a statement terminator and curly braces for grouping blocks of statements.
The C language also exhibits the following characteristics:
  • There is a small, fixed number of keywords, including a full set of control flowprimitives: forif/elsewhileswitch, and do/while. User-defined names are not distinguished from keywords by any kind of sigil.
  • There are a large number of arithmetical and logical operators, such as ++=++&~, etc.
  • More than one assignment may be performed in a single statement.
  • Function return values can be ignored when not needed.
  • Typing is static, but weakly enforced: all data has a type, but implicit conversions may be performed.
  • Declaration syntax mimics usage context. C has no "define" keyword; instead, a statement beginning with the name of a type is taken as a declaration. There is no "function" keyword; instead, a function is indicated by the parentheses of an argument list.
  • User-defined (typedef) and compound types are possible.
    • Heterogeneous aggregate data types (struct) allow related data elements to be accessed and assigned as a unit.
    • Union is a structure with overlapping members; only the last member stored is valid.
    • Array indexing is a secondary notation, defined in terms of pointer arithmetic. Unlike structs, arrays are not first-class objects; they cannot be assigned or compared using single built-in operators. There is no "array" keyword, in use or definition; instead, square brackets indicate arrays syntactically, for example month[11].
    • Enumerated types are possible with the enum keyword. They are freely interconvertible with integers.
    • Strings are not a separate data type, but are conventionally implemented as null-terminated arrays of characters.
  • Low-level access to computer memory is possible by converting machine addresses to typed pointers.
  • Procedures (subroutines not returning values) are a special case of function, with an untyped return type void.
  • Functions may not be defined within the lexical scope of other functions.
  • Function and data pointers permit ad hoc run-time polymorphism.
  • preprocessor performs macro definition, source code file inclusion, and conditional compilation.
  • There is a basic form of modularity: files can be compiled separately and linked together, with control over which functions and data objects are visible to other files via static and extern attributes.
  • Add caption
  • Complex functionality such as I/Ostring manipulation, and mathematical functions are consistently delegated to library routines.
While C does not include some features found in some other languages, such as object orientation or garbage collection, such features can be implemented or emulated in C, often by way of external libraries (e.g., the Boehm garbage collector or the GLib Object System).

Relations to other languages

Many later languages have borrowed directly or indirectly from C, including C++C#, Unix's C shellDGoJavaJavaScriptLimboLPCObjective-CPerlPHPPythonRustSwift, and Verilog (hardware description language)[5]. These languages have drawn many of their control structures and other basic features from C. Most of them (with Python being the most dramatic exception) are also very syntactically similar to C in general, and they tend to combine the recognizable expression and statement syntax of C with underlying type systems, data models, and semantics that can be radically different.

    for more information click on onhttps://en.wikipedia.org/wiki/C_%28programming_language%29

Object Orinted Programming &''C++ Part 2

PART 2 1.7 Object Oriented Language  Object-oriented programming is not the right of any particular languages. Like structured progr...

caraze programming