Please enable JavaScript.
Coggle requires JavaScript to display documents.
Intro to OOPs - Coggle Diagram
Intro to OOPs
HLLs
Procedure Oriented Programing Langs:
-Allows user to use their logic by using functions to enhance program's productivity
-Eg. BASIC, COBOL, FROTRAN, C
-POPs consist of lists of instructions for the comp to follow= functions
-Flowchart used to organize these actions & represent the flow of control from one function-->another
-Most of the funcs. share global data which flows around openly in the system from one function to another
- GD loosely attached to the functions, keep floating, to make any change in func, may need to reschedule associated data values, could affect program's logic
Characteristics
-Emphasis on functions
-Funcs. share data
-Data values keep floating from 1f-another
-Uses top-->down approach
Limitations:
-Data values= global to all funcs. necessary changes may have to be made to funcs. in case of change in dvs
-Not suitable to solve complex problems in real situations
Object Oriented Programming Langs:
- consists of list of instruction= func.
-Funcs may share global data
-Partitioned memory areas for both data & funcs. created to standardize
-Doesn't allow data to flow freely
-Complete problem decomposed into entities called objects
-Data values in an object can only be handled by the functions in the obj not by external func.
Eg. C++, Java, Python, Smalltalk, Ruby, Eiffel
Features:
-Importance given to items data items over functions
-Problem made simpler by dividing it into objs
-Objs can be used as bridge to have data dlow
-Data hiding enhances security in the program
-Uses bottom-->top approach
-Highly beneficial to solve complex problems.
Benefits: -Reusability of the program code is enhanced
-Software quality and performance are improved
-Modularity is achieved
-Data abstraction makes software easy to handle
-Software for complex tasks can easily be developed
-
Structure Oriented Programing Langs:
-Uses modular approach to improve clarity, quality and development time
-Use various logical structures, like selective control flow, structure of looping block, structure of subroutines or functions
egs. ALGOL & PASCAL
Computer languages
High Level- Allow users to write code in simple english phrases/words/sentences. Uses common words and mathematical symbols, thus program is easier to understand and more logical. Eg. BASIC, C++, Java, Python
Advantages:
-Machine independent lang
-Instructions can be in English
-Easier to understand program logic
-Error detection and correction is easier
Limitations:
-Requires translator
-Translated machine code may be less efficient than code generated from an assembly lvl lang
-
Lang. Processors
Compiler: a software that accepts the whole code written in a HHL and converts it into obj code= compiler
Interpreter: a software that converts HLL into obj code line by line= interpreter (if there is error at line 6, then interp. stops at line 6 until error is corrected)
-
Definitions:
-Object: It is a unique entity with data and functions, that is nature and behavior, together in a Object Oriented Programming Language.
-Class: A class is a template or blueprint for similar type of objects. Each class object within a class possesses some attributes and common behavior as defined within the class.
-Polymorphism: It is process of using a function or method for more than one purposes.
-Data abstraction: It is an act of representing the essential features without knowing their background details. It is always relative to the purpose of the user.
-Encapsulation: It is the system of wrapping data and functions into a single unit.
-Inheritance: It means to link and share some common properties of one class with another class. This can be done by extending a class into another one.
-Reusability: During inheritance, elements of the base class are shared by the derived class. Thus, elements used in a base class can be used in the derived class as well. This is called Reusability
-Function overloading : It is the technique of to use a number of functions, with the same name but different parameters.
-Package
Encapsulation's benefits: a) Source code of an obj can be maintained independently
b) Obj maintains the privacy of the data members
Java package= collection of classes. Keyword to insert a package is 'import' syntax=
import java.io.asterisk;
java.io= I/O & java.util= utility function
java.lang= default package.
Packages in JDK
-
-
-
java.txt For localizing text elements like dates, time, currecy etc.
-
-
java.lang To support classes containing String/char, math, integer, thread
Basic Features of JAVA: -It is an OOP lang
-Program is both compiled+ interpreted
-Can access data from local system+ internet
-Program written within a class, variables and functions are declared within the class
-Java can create applets (programs executed inside java based web browser) + applications (programs developed by users)
-Doesn't need preprocessor/inclusion of header files for creating java app program
-Java is case sensitive
Java compiler is a software that converts source code into an intermediate binary form called byte code. It is further converted into binary code/ machine code by the Java interpreter or the JVM.
It is called a virtual machine because of its nature of conversion of byte code from multiple source codes.
Reserved words
Words that carry special meaning to the system compiler and cannot be used in naming a variable
list-
case--switch--else--break--static--do--const--throws--float--char--try--int--double--void--goto--for--while--new--import--boolean--long--if--byte--package--private--catch--short--public--class--default
Basic Structure in Java Programming
-Comments in a program: a non-executable comment
-Declaration of class: contains the word, access specifier (public) + defines keyword class.
Declaration of main func.: the main( ) func encloses the programming statement within the opening and closing { }
-Termination of each statement with a semi-colan
-Closing of curly bracket= closing block of statements, functions and class