Software Development. Modular Design and Algorithm Analysis

Similar documents
Chapter 5 Object-Oriented Programming

IT101. Inheritance, Encapsulation, Polymorphism and Constructors


Inheritance. Benefits of Java s Inheritance. 1. Reusability of code 2. Code Sharing 3. Consistency in using an interface. Classes

Computer Science 4U Unit 1. Programming Concepts and Skills Modular Design

Java Object Oriented Design. CSC207 Fall 2014

Object Oriented Programming is a programming method that combines: Advantage of Object Oriented Programming

What are the characteristics of Object Oriented programming language?

Object Oriented Features. Inheritance. Inheritance. CS257 Computer Science I Kevin Sahr, PhD. Lecture 10: Inheritance

CHAPTER 5 GENERAL OOP CONCEPTS

Object oriented programming Concepts

Object-Oriented Programming

Advanced Programming Using Visual Basic 2008

Object-Oriented Design

OOPS Viva Questions. Object is termed as an instance of a class, and it has its own state, behavior and identity.

9/21/2010. Based on Chapter 2 in Advanced Programming Using Visual Basic.NET by Bradley and Millspaugh

Chapter 12. OOP: Creating Object- Oriented Programs. McGraw-Hill. Copyright 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved.

QUESTIONS FOR AVERAGE BLOOMERS

Object Orientated Analysis and Design. Benjamin Kenwright

More On inheritance. What you can do in subclass regarding methods:

CPS 506 Comparative Programming Languages. Programming Language

JAVA MOCK TEST JAVA MOCK TEST II

Data Structures (list, dictionary, tuples, sets, strings)

Data Structures and Algorithms Design Goals Implementation Goals Design Principles Design Techniques. Version 03.s 2-1

Building Multitier Programs with Classes

Introduction to ActionScript 3.0 programming Object Oriented Programming pt. 1 & 2

Overview of OOP. Dr. Zhang COSC 1436 Summer, /18/2017

Understanding Inheritance and Interfaces

ITI Introduction to Computing II

OBJECT ORIENTED PROGRAMMING USING C++ CSCI Object Oriented Analysis and Design By Manali Torpe

Object Oriented Programming

Design Pattern: Composite

Chapter 11. Categories of languages that support OOP: 1. OOP support is added to an existing language

ITI Introduction to Computing II

CREATED BY: Muhammad Bilal Arslan Ahmad Shaad. JAVA Chapter No 5. Instructor: Muhammad Naveed

Object Oriented Programming in Java. Jaanus Pöial, PhD Tallinn, Estonia

Programming II (CS300)

Introduction to Object- Oriented Programming

Inheritance, and Polymorphism.

Example: Fibonacci Numbers

Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson

Programming II (CS300)

CS200: Advanced OO in Java

1. Write two major differences between Object-oriented programming and procedural programming?

CMSC 132: Object-Oriented Programming II

ECE 122. Engineering Problem Solving with Java

PROGRAMMING LANGUAGE 2

Object-oriented perspective

CS-202 Introduction to Object Oriented Programming

C++ Important Questions with Answers

Unit3: Java in the large. Prepared by: Dr. Abdallah Mohamed, AOU-KW

Lecture Contents CS313D: ADVANCED PROGRAMMING LANGUAGE. What is Inheritance?

Inheritance and Encapsulation. Amit Gupta

OOP Design Conclusions and Variations

ENCAPSULATION. private, public, scope and visibility rules. packages and package level access.

Microsoft Visual Basic 2005: Reloaded

Understanding the Object Paradigm

Object- Oriented Design with UML and Java Part I: Fundamentals

CS111: PROGRAMMING LANGUAGE II

Contents. I. Classes, Superclasses, and Subclasses. Topic 04 - Inheritance

Polymorphism 2/12/2018. Which statement is correct about overriding private methods in the super class?

CS260 Intro to Java & Android 02.Java Technology

CS313D: ADVANCED PROGRAMMING LANGUAGE

Inheritance and Substitution (Budd chapter 8, 10)

Java OOP (SE Tutorials: Learning the Java Language Trail : Object-Oriented Programming Concepts Lesson )

The Essence of Object Oriented Programming with Java and UML. Chapter 2. The Essence of Objects. What Is an Object-Oriented System?

Introduction to OOP. Procedural Programming sequence of statements to solve a problem.

Classes. Classes. Classes. Class Circle with methods. Class Circle with fields. Classes and Objects in Java. Introduce to classes and objects in Java.

Client Code - the code that uses the classes under discussion. Coupling - code in one module depends on code in another module

Chapter 1: Object-Oriented Programming Using C++

OVERRIDING. 7/11/2015 Budditha Hettige 82

Logistics. Final Exam on Friday at 3pm in CHEM 102

And Even More and More C++ Fundamentals of Computer Science

9/10/2018 Programming Data Structures Inheritance

Chapter 2. Building Multitier Programs with Classes The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill

Module 10 Inheritance, Virtual Functions, and Polymorphism

Sahaj Computer Solutions OOPS WITH C++

CS1150 Principles of Computer Science Objects and Classes

Comp 249 Programming Methodology

Programming Languages and Program Development

OBJECT ORİENTATİON ENCAPSULATİON

I Wish I Knew How To. Begin Object Oriented Programming With Xojo. By Eugene Dakin. July 2015 Edition (1.0)

Programming overview

Software Paradigms (Lesson 3) Object-Oriented Paradigm (2)

2.4 Structuring programs

How to be a Good Bean

Oops known as object-oriented programming language system is the main feature of C# which further support the major features of oops including:

Data Abstraction. Hwansoo Han

What is Inheritance?

Objectives. Architectural Design. Software architecture. Topics covered. Architectural design. Advantages of explicit architecture

IS-A is a way of saying: This object is a type of that object. Let us see how the extends keyword is used to achieve inheritance.

CHAPTER 4 HEURISTICS BASED ON OBJECT ORIENTED METRICS

CS111: PROGRAMMING LANGUAGE II

C++ Inheritance and Encapsulation

Object oriented programming. Encapsulation. Polymorphism. Inheritance OOP

Objects and Classes. 1 Creating Classes and Objects. CSCI-UA 101 Objects and Classes

G Programming Languages - Fall 2012

Inheritance -- Introduction

Inheritance (Outsource: )


Transcription:

Software Development Modular Design and Algorithm Analysis

Data Encapsulation Encapsulation is the packing of data and functions into a single component. The features of encapsulation are supported using classes in most object-oriented programming languages, although other alternatives also exist. It allows selective hiding of properties and methods in an object by building an impenetrable wall to protect the code from accidental corruption. In programming languages, encapsulation is used to refer to one of two related but distinct notions, and sometimes to the combination thereof:

1. A language mechanism for restricting access to some of the object's components. 2. A language construct that facilitates the bundling of data with the methods (or other functions) operating on that data.

General definition In general, encapsulation is one of the four fundamentals of OOP (object-oriented programming). Encapsulation refers to the bundling of data with the methods that operate on that data. Encapsulation is used to hide the values or state of a structured data object inside a class, preventing unauthorized parties' direct access to them. Publicly accessible methods are generally provided in the class (so-called getters and setters) to access the values, and other client classes call these methods to retrieve and modify the values within the object.

Encapsulation is one of the most important and most advantageous concepts provided in object-oriented programming. By taking proper care when designing your objects to hide their internal details from the rest of the system, you gain the ability to simplify the remainder of the system while isolating it from problems caused by changes to the internal structure of your objects. These concepts are absolutely critical when working with a team.

Designing Strategy Most of us have learned through bitter experience to make class members private by default unless we really need to expose them. That's just good encapsulation. This wisdom is applied most frequently to data members, but it applies equally to all members, including virtual functions.

Reusability (Inheritance) In computer science and software engineering, reusability is the use of existing assets in some form within the software product development process. More than just code, assets are products and by-products of the software development life cycle and include software components, test suites, designs and documentation. Leverage is modifying existing assets as needed to meet specific system requirements.

Because reuse implies the creation of a separately maintained version of the assets, it is preferred over leverage. Subroutines or functions are the simplest form of reuse. A chunk of code is regularly organized using modules or namespaces into layers. Proponents claim that objects and software components offer a more advanced form of reusability, although it has been tough to objectively measure and define levels or scores of reusability.

The ability to reuse relies in an essential way on the ability to build larger things from smaller parts, and being able to identify commonalities among those parts. Reusability is often a required characteristic of platform software. Reusability brings several aspects to software development that do not need to be considered when reusability is not required.

Reusability implies some explicit management of build, packaging, distribution, installation, configuration, deployment, maintenance and upgrade issues. If these issues are not considered, software may appear to be reusable from design point of view, but will not be reused in practice. Software reusability more specifically refers to design features of a software element (or collection of software elements) that enhance its suitability for reuse.

Some design features for software reuse include: Adaptable Brief: small size Consistency Correctness Fast Flexible Generic Modularity Simple: low complexity Stability under changing requirements

Inheritance enables new classes to receive or inherit the properties and methods of existing classes. Using two concepts of inheritance, subclassing (making a new class based on a previous one) and overriding (changing how a previous class works), you can organize your objects into a hierarchy. Using inheritance to make this hierarchy often creates easier to understand code, but most importantly it allows you to reuse and organize code more effectively.

In object-oriented programming, inheritance enables new objects to take on the properties of existing objects. A class that is used as the basis for inheritance is called a superclass or base class. A class that inherits from a superclass is called a subclass or derived class. The terms parent class and child class are also acceptable terms to use respectively. A child inherits visible properties and methods from its parent while adding additional properties and methods of its own.

Inheritance and controlling access The access level of a declared element is the extent of the ability to access it, that is, what code has permission to read it or write to it. This is determined not only by how you declare the element itself, but also by the access level of the element's container. Code that cannot access a containing element cannot access any of its contained elements, even those declared as Public.

For example, a Public variable in a Private structure can be accessed from inside the class that contains the structure, but not from outside that class. The Public keyword in the declaration statement specifies that the elements can be accessed from code anywhere in the same project, from other projects that reference the project, and from any assembly built from the project. You can use Public only at module, interface, or namespace level. This means you can declare a public element at the level of a source file or namespace, or inside an interface, module, class, or structure, but not in a procedure.

The Protected keyword in the declaration statement specifies that the elements can be accessed only from within the same class, or from a class derived from this class. You can use Protected only at class level, and only when you declare a member of a class. This means you can declare a protected element in a class, but not at the level of a source file or namespace, or inside an interface, module, structure, or procedure.

The Friend keyword in the declaration statement specifies that the elements can be accessed from within the same assembly, but not from outside the assembly. You can use Friend only at module, interface, or namespace level. This means you can declare a friend element at the level of a source file or namespace, or inside an interface, module, class, or structure, but not in a procedure.

The Protected and Friend keywords together in the declaration statement specify that the elements can be accessed either from derived classes or from within the same assembly, or both. You can use Protected Friend only at class level, and only when you declare a member of a class. This means you can declare a protected friend element in a class, but not at the level of a source file or namespace, or inside an interface, module, structure, or procedure.

The Private keyword in the declaration statement specifies that the elements can be accessed only from within the same module, class, or structure. You can use Private only at module level. This means you can declare a private element inside a module, class, or structure, but not at the level of a source file or namespace, inside an interface, or in a procedure. At the module level, the Dim statement without any access level keywords is equivalent to a Private declaration. However, you might want to use the Private keyword to make your code easier to read and interpret.

Activity 3.5 Using the information in the presentation, apply reusability, inheritance and encapsulation when designing new classes and modules. Copy examples of these three principles with a brief description on how you attained them into a document. You may need to wait until you have more of your culminating activity completed before you have the code you need. Save your work as john_s_3_5_peri under the appropriate folder for your class in the DropOff folder on the X: drive