Software Design provides options for structural relationships, such as composition vs. inheritance. Each such option defines malleable and stable characteristics of class dependencies and interface provisions. Software designers must evaluate the short- and long-term costs and benefits of design decisions, such as the simulation of inheritance with composition.
Object-oriented Design: Polymorphism via Inheritance (vs. Delegation)Adair Dingle
This document discusses object-oriented design principles regarding inheritance versus delegation for polymorphism. It covers key observations on how inheritance and delegation can both provide polymorphism. It also discusses different types of polymorphism including overloading, generics, and subtyping. The document provides examples of overloaded functions and how static versus dynamic binding works. It concludes with discussions on binding design choices in different programming languages.
Software Design
Design for software longevity, security, and efficiency can be intricate—as is the design of large-scale systems. How can a software developer prepare to manage such complexity? By understanding the essential building blocks of software design and construction, such as the differences in impact between inheritance and composition.
Software Design: Impact of Memory Usage (Copying, Cloning and Aliases)Adair Dingle
Software design requires a solid understanding of memory, especially as it pertains to type relationships, and dynamic behavior, in object-oriented design. An understanding of the overhead of copying and cloning supports an evaluation of short- and long-term costs and benefits of various design choices as they impact performance and maintainability.
This document provides an overview of an Objective-C lesson for Java developers. It discusses why Objective-C is important as the main language for developing Mac and iOS software. It also covers some key differences between Objective-C and Java like memory management, syntax involving properties and memory ownership. The document outlines concepts like classes, headers, imports and memory management in Objective-C.
Object-oriented programming (OOP) uses classes and objects to organize code and data. One key feature of OOP is inheritance, which allows a child class to inherit attributes and behaviors from a parent class. The paper discusses inheritance and its types, including single, multiple, multilevel, hierarchical, and hybrid inheritance. It explains that inheritance allows code reuse and makes programs more reliable, efficient, and easier to develop by reducing duplicate code.
This document provides an overview and introduction to a 3-day Perl development course. It discusses the goals of the course which are to familiarize students with the Perl language, different styles of Perl development, and commonly used Perl modules. It also provides a brief history of Perl and compares it to other programming languages like Python and Ruby.
This document provides an overview of object-oriented programming (OOP) concepts including classes, objects, encapsulation, inheritance, polymorphism, and relationships between objects. It compares OOP to structured programming and outlines the benefits of OOP such as reusability, extensibility, and maintainability. Key OOP features like encapsulation, inheritance, polymorphism, and relationships are explained in detail. The document also introduces the Unified Modeling Language (UML) as a standard language for visualizing and modeling software systems using OOP concepts.
Object-oriented Design: Polymorphism via Inheritance (vs. Delegation)Adair Dingle
This document discusses object-oriented design principles regarding inheritance versus delegation for polymorphism. It covers key observations on how inheritance and delegation can both provide polymorphism. It also discusses different types of polymorphism including overloading, generics, and subtyping. The document provides examples of overloaded functions and how static versus dynamic binding works. It concludes with discussions on binding design choices in different programming languages.
Software Design
Design for software longevity, security, and efficiency can be intricate—as is the design of large-scale systems. How can a software developer prepare to manage such complexity? By understanding the essential building blocks of software design and construction, such as the differences in impact between inheritance and composition.
Software Design: Impact of Memory Usage (Copying, Cloning and Aliases)Adair Dingle
Software design requires a solid understanding of memory, especially as it pertains to type relationships, and dynamic behavior, in object-oriented design. An understanding of the overhead of copying and cloning supports an evaluation of short- and long-term costs and benefits of various design choices as they impact performance and maintainability.
This document provides an overview of an Objective-C lesson for Java developers. It discusses why Objective-C is important as the main language for developing Mac and iOS software. It also covers some key differences between Objective-C and Java like memory management, syntax involving properties and memory ownership. The document outlines concepts like classes, headers, imports and memory management in Objective-C.
Object-oriented programming (OOP) uses classes and objects to organize code and data. One key feature of OOP is inheritance, which allows a child class to inherit attributes and behaviors from a parent class. The paper discusses inheritance and its types, including single, multiple, multilevel, hierarchical, and hybrid inheritance. It explains that inheritance allows code reuse and makes programs more reliable, efficient, and easier to develop by reducing duplicate code.
This document provides an overview and introduction to a 3-day Perl development course. It discusses the goals of the course which are to familiarize students with the Perl language, different styles of Perl development, and commonly used Perl modules. It also provides a brief history of Perl and compares it to other programming languages like Python and Ruby.
This document provides an overview of object-oriented programming (OOP) concepts including classes, objects, encapsulation, inheritance, polymorphism, and relationships between objects. It compares OOP to structured programming and outlines the benefits of OOP such as reusability, extensibility, and maintainability. Key OOP features like encapsulation, inheritance, polymorphism, and relationships are explained in detail. The document also introduces the Unified Modeling Language (UML) as a standard language for visualizing and modeling software systems using OOP concepts.
Introducing Domain Driven Design - codemashSteven Smith
DDD provides a set of patterns and practices for tackling complex business problems with software models. Learn the basics of DDD in this session, including several principles and patterns you can start using immediately even if your project hasn't otherwise embraced DDD. Examples will primarily use C#/.NET.
Here are some common applications of object-oriented programming and C++:
- Desktop applications like word processors, spreadsheets, etc. The document is an object and formatting, editing operations are methods.
- Game development. Characters, weapons, levels etc. are modeled as objects with behaviors and properties.
- GUI (Graphical User Interface) toolkits like MFC, Qt. Windows, buttons etc. are predefined object classes.
- Web applications and frameworks. Objects represent pages, forms, database entities etc.
- Database connectivity libraries. Objects used to represent rows, columns, connections etc.
- Operating system design. Processes, files, devices modeled as objects.
- Scientific and engineering
This document provides an overview of an Object Oriented Programming course taught by Rajasekaran S. The course covers 5 units: introduction to OOP and Java fundamentals, inheritance and interfaces, exception handling and I/O, multithreading and generic programming, and event driven programming. It defines key OOP concepts like objects, classes, abstraction, encapsulation, inheritance, and polymorphism using examples like cars. The document also lists the prerequisites for the course as a computer with Java installed, internet access, a text editor or IDE like Eclipse, and a reference book.
Refactoring Applications using SOLID PrinciplesSteven Smith
We’ve all heard about well-designed software projects, where things aren’t (yet) a big ball of mud that’s painful to work with, but many of us aren’t lucky enough to work on these. Nor is it an option for us to get to start a brand new “greenfield” project, where we can leave behind the legacy of spaghetti code and technical debt our current project might have.
But there is hope! By applying refactoring steps based on SOLID principles of object oriented design, we can reduce the technical debt of our existing application, improve our code quality, and hopefully make our application more enjoyable and productive to work with.
In this session, we’ll briefly introduce the SOLID principles and several design patterns, and then we’ll apply these principles and patterns by improving the design of an existing application through several refactoring steps.
OOP Unit 1 - Foundation of Object- Oriented Programmingdkpawar
Foundation of object oriented programing-
Introduction to procedural, modular, object-oriented and generic programming techniques
Limitations of procedural programming
Need of object-oriented programming
fundamentals of object-oriented programming:
objects, classes, data members, methods, messages, data encapsulation, data abstraction and information hiding, inheritance, polymorphism.
Inline functions
Function overloading
call by value and call by reference, return by reference,
This document provides an overview of object-oriented programming (OOP) concepts including objects, classes, encapsulation, inheritance, polymorphism, and abstraction. It explains that OOP allows decomposition of programs into objects that contain both data and functions. Classes act as blueprints for objects and define their properties and behaviors.
The document discusses key concepts of object oriented programming in C#, including classes, objects, encapsulation, inheritance, polymorphism, and methods. It provides definitions and examples of each concept, explaining that OOP languages support classes with properties and behaviors, as well as encapsulation, inheritance, and polymorphism. Methods are defined as blocks of code that perform processes and return outputs. Access modifiers like public, private, and protected are also overviewed in the context of C#.
The document provides a biography and background information on Daniel N. Egan, including his roles as a Microsoft Regional Director, Microsoft MVP for ASP.Net, author, and speaker. It then outlines the topics to be covered in the presentation, including object relational mappers, language enhancements in C# and VB.Net, LINQ goals, fundamentals and usage.
This document outlines the syllabus for the CSE 219 Object Oriented Paradigm and Programming course taught by G.SasiKumar at VIT University. The course will use the textbook "Mastering C++" and will include homework, CAT exams, quizzes, presentations, and a final exam. Key topics will include an introduction to programming languages, object oriented programming concepts, advantages and applications of OOP.
This document provides a guide to class member and local variable declarations in Java, including access modifiers like public, private, protected, and default, as well as other declarations like static, final, transient, synchronized, abstract, and volatile. It explains how and when to use each declaration type for class members versus local variables, and how anonymous objects and lambda expressions can access variables. The goal is to help programmers create scalable and loosely coupled Java programs by properly identifying declaration types. Suggestions and feedback are welcome in the comments.
This document provides an introduction to the Java programming language. It discusses Java buzzwords like simple, object-oriented, robust, platform independent. It also covers Java concepts like classes and objects, keywords, identifiers, datatypes, arrays, and the main method. It provides examples of arithmetic, increment/decrement, relational, equality, logical, and assignment operators in Java.
Abstract: This PDSG workshop covers the basics of OOP programming in Python. Concepts covered are class, object, scope, method overloading and inheritance.
Level: Fundamental
Requirements: One should have some knowledge of programming.
C# introduction document covers the following topics:
- Hello World demo shows a basic C# console application.
- The .NET Framework overview describes its common language runtime, base class library and language interoperability.
- Design goals of C# emphasize it being the first component-oriented C-family language and unifying all data types as objects.
- Language features covered include program structure, type system, predefined types, classes, structs, interfaces, enums and delegates.
The document provides an overview of core Java concepts including:
- Java is an object-oriented programming language and platform that runs on a virtual machine. It is used to create desktop, web, enterprise, mobile and other applications.
- Core Java concepts include objects, classes, inheritance, polymorphism, abstraction and encapsulation. The document also discusses variables and data types, OOP principles, object creation, method overloading and constructors.
- It provides examples of Hello World programs and explains Java memory areas like stack and heap. Key topics like static keyword, method vs constructor and method overloading are also summarized.
This document provides an introduction to object oriented programming concepts in Java. It discusses key topics like what a computer is, developer skills, memory management, and an introduction to Java. Object oriented programming principles like inheritance, abstraction, encapsulation, and polymorphism are defined. The document also covers exceptions in Java like defining exceptions, reasons they occur, and handling exceptions.
Introduction to object oriented languagefarhan amjad
This document discusses object-oriented programming (OOP) and its advantages over procedural programming. It defines some key OOP concepts like objects, classes, encapsulation, and inheritance. It explains that in OOP, programs are designed as collections of these discrete objects that combine data and behaviors. This reduces complexity and promotes reusability, flexibility, and maintainability. OOP also gives data more importance and provides mechanisms to hide data that procedural languages lack.
The presentation was given to Rivier Scala / Clojure User Group meeting on 10.6.2013. It is half-baked presentation. Will upload the final version when ready.
The first part is about DSLs in general, complexities in software engineering and abstraction. The seconds part presents an quick overview about DSLs in Scala and touches some of the technologies used for deep embedding.
This document provides an overview of how to use I2C communication with AVR microcontrollers. It describes the basic I2C protocol using SCL and SDA lines. It explains that one microcontroller must act as the master that can send data to multiple slave devices using their individual addresses. Example code is provided to initialize I2C on an Arduino Uno and send data from a master to light an LED connected to a slave device. Registers for I2C communication on the ATmega168 microcontroller are also outlined.
Protocol layers are a hierarchical model of network or communication functions. The divisions of the hierarchy are referred to as layers or levels, with each layer performing a specific task. In addition, each protocol layer obtains services from the protocol layer below it and performs services for the protocol layer above it. The Bluetooth system divides communication functions into protocol layers.
The Bluetooth system consists of many existing protocols that are directly used or have been adapted to the specific use of the Bluetooth system. Protocols are often divided into groups that are used for different levels of communication (a protocol stack). Lower level protocols (such as protocols that are used to manage a radio link between specific points) are only used to create, manage, and disconnect transmission between specific points. Mid-level protocols (such as transmission control protocols) are used to create, manage, and disconnect a logical connection between endpoints that may have multiple link connections between them. High level protocols (application layer protocols) are used to launch, control, and close end-user applications.
Some of the layers associated with the Bluetooth system include the baseband layer (physical layer), link layer, host controller interface (HCI), logical link control applications protocol (L2CAP), RF Communications protocol (RFCOMM), Object Exchange (OBEX), and service discovery.
Introducing Domain Driven Design - codemashSteven Smith
DDD provides a set of patterns and practices for tackling complex business problems with software models. Learn the basics of DDD in this session, including several principles and patterns you can start using immediately even if your project hasn't otherwise embraced DDD. Examples will primarily use C#/.NET.
Here are some common applications of object-oriented programming and C++:
- Desktop applications like word processors, spreadsheets, etc. The document is an object and formatting, editing operations are methods.
- Game development. Characters, weapons, levels etc. are modeled as objects with behaviors and properties.
- GUI (Graphical User Interface) toolkits like MFC, Qt. Windows, buttons etc. are predefined object classes.
- Web applications and frameworks. Objects represent pages, forms, database entities etc.
- Database connectivity libraries. Objects used to represent rows, columns, connections etc.
- Operating system design. Processes, files, devices modeled as objects.
- Scientific and engineering
This document provides an overview of an Object Oriented Programming course taught by Rajasekaran S. The course covers 5 units: introduction to OOP and Java fundamentals, inheritance and interfaces, exception handling and I/O, multithreading and generic programming, and event driven programming. It defines key OOP concepts like objects, classes, abstraction, encapsulation, inheritance, and polymorphism using examples like cars. The document also lists the prerequisites for the course as a computer with Java installed, internet access, a text editor or IDE like Eclipse, and a reference book.
Refactoring Applications using SOLID PrinciplesSteven Smith
We’ve all heard about well-designed software projects, where things aren’t (yet) a big ball of mud that’s painful to work with, but many of us aren’t lucky enough to work on these. Nor is it an option for us to get to start a brand new “greenfield” project, where we can leave behind the legacy of spaghetti code and technical debt our current project might have.
But there is hope! By applying refactoring steps based on SOLID principles of object oriented design, we can reduce the technical debt of our existing application, improve our code quality, and hopefully make our application more enjoyable and productive to work with.
In this session, we’ll briefly introduce the SOLID principles and several design patterns, and then we’ll apply these principles and patterns by improving the design of an existing application through several refactoring steps.
OOP Unit 1 - Foundation of Object- Oriented Programmingdkpawar
Foundation of object oriented programing-
Introduction to procedural, modular, object-oriented and generic programming techniques
Limitations of procedural programming
Need of object-oriented programming
fundamentals of object-oriented programming:
objects, classes, data members, methods, messages, data encapsulation, data abstraction and information hiding, inheritance, polymorphism.
Inline functions
Function overloading
call by value and call by reference, return by reference,
This document provides an overview of object-oriented programming (OOP) concepts including objects, classes, encapsulation, inheritance, polymorphism, and abstraction. It explains that OOP allows decomposition of programs into objects that contain both data and functions. Classes act as blueprints for objects and define their properties and behaviors.
The document discusses key concepts of object oriented programming in C#, including classes, objects, encapsulation, inheritance, polymorphism, and methods. It provides definitions and examples of each concept, explaining that OOP languages support classes with properties and behaviors, as well as encapsulation, inheritance, and polymorphism. Methods are defined as blocks of code that perform processes and return outputs. Access modifiers like public, private, and protected are also overviewed in the context of C#.
The document provides a biography and background information on Daniel N. Egan, including his roles as a Microsoft Regional Director, Microsoft MVP for ASP.Net, author, and speaker. It then outlines the topics to be covered in the presentation, including object relational mappers, language enhancements in C# and VB.Net, LINQ goals, fundamentals and usage.
This document outlines the syllabus for the CSE 219 Object Oriented Paradigm and Programming course taught by G.SasiKumar at VIT University. The course will use the textbook "Mastering C++" and will include homework, CAT exams, quizzes, presentations, and a final exam. Key topics will include an introduction to programming languages, object oriented programming concepts, advantages and applications of OOP.
This document provides a guide to class member and local variable declarations in Java, including access modifiers like public, private, protected, and default, as well as other declarations like static, final, transient, synchronized, abstract, and volatile. It explains how and when to use each declaration type for class members versus local variables, and how anonymous objects and lambda expressions can access variables. The goal is to help programmers create scalable and loosely coupled Java programs by properly identifying declaration types. Suggestions and feedback are welcome in the comments.
This document provides an introduction to the Java programming language. It discusses Java buzzwords like simple, object-oriented, robust, platform independent. It also covers Java concepts like classes and objects, keywords, identifiers, datatypes, arrays, and the main method. It provides examples of arithmetic, increment/decrement, relational, equality, logical, and assignment operators in Java.
Abstract: This PDSG workshop covers the basics of OOP programming in Python. Concepts covered are class, object, scope, method overloading and inheritance.
Level: Fundamental
Requirements: One should have some knowledge of programming.
C# introduction document covers the following topics:
- Hello World demo shows a basic C# console application.
- The .NET Framework overview describes its common language runtime, base class library and language interoperability.
- Design goals of C# emphasize it being the first component-oriented C-family language and unifying all data types as objects.
- Language features covered include program structure, type system, predefined types, classes, structs, interfaces, enums and delegates.
The document provides an overview of core Java concepts including:
- Java is an object-oriented programming language and platform that runs on a virtual machine. It is used to create desktop, web, enterprise, mobile and other applications.
- Core Java concepts include objects, classes, inheritance, polymorphism, abstraction and encapsulation. The document also discusses variables and data types, OOP principles, object creation, method overloading and constructors.
- It provides examples of Hello World programs and explains Java memory areas like stack and heap. Key topics like static keyword, method vs constructor and method overloading are also summarized.
This document provides an introduction to object oriented programming concepts in Java. It discusses key topics like what a computer is, developer skills, memory management, and an introduction to Java. Object oriented programming principles like inheritance, abstraction, encapsulation, and polymorphism are defined. The document also covers exceptions in Java like defining exceptions, reasons they occur, and handling exceptions.
Introduction to object oriented languagefarhan amjad
This document discusses object-oriented programming (OOP) and its advantages over procedural programming. It defines some key OOP concepts like objects, classes, encapsulation, and inheritance. It explains that in OOP, programs are designed as collections of these discrete objects that combine data and behaviors. This reduces complexity and promotes reusability, flexibility, and maintainability. OOP also gives data more importance and provides mechanisms to hide data that procedural languages lack.
The presentation was given to Rivier Scala / Clojure User Group meeting on 10.6.2013. It is half-baked presentation. Will upload the final version when ready.
The first part is about DSLs in general, complexities in software engineering and abstraction. The seconds part presents an quick overview about DSLs in Scala and touches some of the technologies used for deep embedding.
This document provides an overview of how to use I2C communication with AVR microcontrollers. It describes the basic I2C protocol using SCL and SDA lines. It explains that one microcontroller must act as the master that can send data to multiple slave devices using their individual addresses. Example code is provided to initialize I2C on an Arduino Uno and send data from a master to light an LED connected to a slave device. Registers for I2C communication on the ATmega168 microcontroller are also outlined.
Protocol layers are a hierarchical model of network or communication functions. The divisions of the hierarchy are referred to as layers or levels, with each layer performing a specific task. In addition, each protocol layer obtains services from the protocol layer below it and performs services for the protocol layer above it. The Bluetooth system divides communication functions into protocol layers.
The Bluetooth system consists of many existing protocols that are directly used or have been adapted to the specific use of the Bluetooth system. Protocols are often divided into groups that are used for different levels of communication (a protocol stack). Lower level protocols (such as protocols that are used to manage a radio link between specific points) are only used to create, manage, and disconnect transmission between specific points. Mid-level protocols (such as transmission control protocols) are used to create, manage, and disconnect a logical connection between endpoints that may have multiple link connections between them. High level protocols (application layer protocols) are used to launch, control, and close end-user applications.
Some of the layers associated with the Bluetooth system include the baseband layer (physical layer), link layer, host controller interface (HCI), logical link control applications protocol (L2CAP), RF Communications protocol (RFCOMM), Object Exchange (OBEX), and service discovery.
This document discusses some of the problems that can arise with multiple inheritance in object-oriented programming, including name ambiguity when classes have methods with the same name, issues with inheritance from common ancestors, and how inner classes can provide an alternative to multiple inheritance without the same semantic problems. It provides examples and potential solutions to demonstrate these problems.
Coming up with optimized C program for Embedded Systems consist of multiple challenges. This presentation talks about various methods about optimizing C programs in Embedded environment. It also has some interesting tips, Do's and Dont's that will offer practical help for an Embedded programmer.
This ppt explains in brief what actually is arm processor and it covers the first 3 chapters of book "ARM SYSTEM DEVELOPERS GUIDE". The 3 chapters include the history,architecture,instruction set etc.
Inheritance allows a derived class to inherit properties from a base or parent class. A derived class inherits attributes and behaviors of the base class and can add its own attributes and behaviors. There are different types of inheritance including single, multilevel, multiple, hierarchical, and hybrid inheritance. Inheritance promotes code reuse and reduces development time.
This document discusses various techniques for optimizing code on ARM processors, including using conditional instructions, benchmarking with cycle counts, utilizing hardware features like multiplication and DMA, choosing optimal data structures and algorithms, and using mutexes and exclusive monitors for thread synchronization. Some key points covered are using bitwise operations instead of shifts/masks when possible, structs for packing data efficiently in memory, and preferring to reuse existing libraries over reimplementing functionality.
SPI is a serial bus standard established by Motorola and supported in silicon products from various manufacturers.
It is a synchronous serial data link that operates in full duplex (signals carrying data go in both directions simultaneously).
Devices communicate using a master/slave relationship, in which the master initiates the data frame. When the master generates a clock and selects a slave device, data may be transferred in either or both directions simultaneously.
The document describes the Serial Peripheral Interface (SPI) protocol which allows for full duplex synchronous serial communication between a master and slave device using 4 pins - MOSI, MISO, SCK, and an optional SS pin. It details the SPI registers for control, status, and data and provides examples of SPI communication with peripherals like digital pots and shift registers. Common issues like conflicts with programming interfaces and ensuring proper chip select signaling are also covered.
The document discusses the Inter-Integrated Circuit (I2C) protocol. It was developed by Philips in the 1980s as a simpler way to connect peripherals in devices like TVs that previously used separate wiring for each component. I2C uses just two bidirectional lines (SCL for clock and SDA for data) and allows for multiple master and slave devices to communicate at speeds up to 3.4 Mbps using 7- or 10-bit addressing. Devices operate on a master-slave model where the master controls the bus by generating the clock signal and addressing slave devices to send or receive data.
The document provides an introduction to the C programming language and algorithms. It begins with an overview of C and its history. It then defines key concepts like keywords, data types, qualifiers, loops, storage classes, decision statements, and jumps. Examples of algorithms are provided for common problems like adding two numbers. Pattern printing algorithms are given as homework exercises. The document discusses where C is used and explains what a programming language and algorithms are. It emphasizes the importance of understanding requirements before implementation.
* What are Embedded Systems?
* C for Embedded Systems vs. Embedded C.
* Code Compilation process.
* Error types.
* Code Compilation using command line.
The document discusses the I2C communication bus protocol. It describes the I2C bus concept of using two bi-directional lines (SDA and SCL) to allow devices with unique addresses to communicate as masters or slaves. The document outlines the I2C communication protocol including START/STOP conditions, byte format, acknowledgment, synchronization, arbitration, and 7-bit and 10-bit addressing schemes. Key aspects of the I2C bus such as typical transfer rates, hardware connections, and terminology are also summarized.
Serial Peripheral Interface (SPI) is a communication protocol developed by Motorola for serial communication. It uses a master-slave architecture with 4 connection wires - MOSI, MISO, SCLK, and SS. The master device controls the clock signal and initiates data transfer to and from the slave devices. SPI allows for full duplex communication at high speeds and is commonly used with peripherals like converters, memories, sensors, and displays. While it provides high throughput, SPI requires more pins than alternatives like I2C and does not have hardware flow control or slave acknowledgement.
The SPI (Serial Peripheral Interface) is a synchronous serial communication protocol used for communication between devices. It uses a master-slave architecture with a single master device initiating data transfer. Key features include using separate clock and data lines, operating in full duplex mode, and allowing multiple slave devices through individual chip selects. It provides a lower pin count solution than parallel buses at the cost of slower communication speeds.
This document discusses various techniques for code optimization at the compiler level. It begins by defining code optimization and explaining that it aims to make a program more efficient by reducing resources like time and memory usage. Several common optimization techniques are then described, including common subexpression elimination, dead code elimination, and loop optimization. Common subexpression elimination removes redundant computations. Dead code elimination removes code that does not affect program output. Loop optimization techniques like removing loop invariants and induction variables can improve loop performance. The document provides examples to illustrate how each technique works.
The document discusses various protocols used in Internet of Things (IoT). It begins with defining IoT and how it works. It then discusses the current status and future of IoT. The major sections of the document are on IoT data link protocols like IEEE 802.15.4, WirelessHART, Z-Wave, and Bluetooth Low Energy. It also covers network layer routing protocols such as RPL and CORPL, and network layer encapsulation protocols.
This document provides an overview of the C# programming language. It discusses key features of C# such as being object-oriented, type-safe, and developed by Microsoft. It also covers .NET Framework, generics, delegates, events, exceptions, and asynchronous programming. The document lists additional resources for learning more about C# programming.
- Classes are blueprints for objects in C#. Objects are instances of classes. Classes contain data fields, methods, and other members.
- There are different access modifiers like public, private, and protected that control access to class members. Constructors initialize new objects, and destructors perform cleanup when objects are destroyed.
- Inheritance allows classes to inherit members from base classes. Polymorphism allows classes to share common interfaces while providing different implementations. Interfaces define contracts without implementation, while abstract classes can contain partial implementations.
- Encapsulation hides implementation details within a class. Abstraction exposes only necessary details to users through public interfaces. Extension methods can add methods to existing types without creating new derived types.
This document discusses object-oriented programming concepts like classes, inheritance, and polymorphism.
It begins with an overview of classes, explaining that classes contain instance variables and methods. Classes can extend other classes through inheritance, allowing subclasses to override or add new functionality. References can point to objects of a class or any superclass.
The document then discusses polymorphism, where the decision of which method to call is determined at runtime based on the actual object type. This allows subclasses to be used through their parent class references. The summary cautions that direct concrete inheritance can cause issues if not used carefully, such as violating the Liskov substitution principle.
It has been said that one should code as if the person maintaining the code is a violent psychopath who knows where you live. But why do we work with psychopaths? That question unfortunately cannot be answered in this presentation. However, we can shed some light on how to code for readability hopefully avoiding the problem altogether.
Readable code is about a lot more than producing beautiful code. In fact, it has nothing really to do with the beauty of the code and everything to do with the ability to quickly understand what the code does.
In this presentation we will discuss why readable code is so important. We will cover six commonly reoccurring patterns that made code hard to read, why they occur, and how they can easily be avoided:
* Deep Nesting
* Unnecessary Generalization
* Ambiguous Naming
* Hard to Follow Flow of Execution
* Code Style vs. Individualism
* Code Comments
These concepts may be applied to any programming language.
ITKonekt 2023: The Busy Platform Engineers Guide to API GatewaysDaniel Bryant
API Gateways are certainly not a new technology, but the way in which they are being deployed, configured, and operated within modern platforms is forcing many of us to rethink our approach. Can we simply lift and shift our existing gateway into the cloud? Is our API gateway GitOps friendly (and does it need to be)? And what about service meshes, CNI, eBPF, and...
Join this talk for a whistle stop tour of modern API gateways, which a focus on deploying and managing this technology within Kubernetes (on which many modern platforms are built):
- Understand why platform engineers should care about API Gateways today
- Learn about API gateways, options, and requirements for modern platforms
- Identify key considerations for migrating to the cloud or building a new platform on Kubernetes
- Understand how cloud native workflows impact the user/developer experience (UX/DX) of an API gateway
- Explore the components of a complete "edge stack" that supports end-to-end development flows
This document summarizes key points from Chapter 4 of Effective Java on classes and interfaces. It discusses 19 items on best practices such as minimizing accessibility of classes and members, using accessor methods over public fields, favoring immutable classes, composition over inheritance, interfaces over abstract classes, and function objects to represent strategies. The document provides examples and explanations for each item.
Some Cool Design Patterns, Practices, and Principlesitsarsalan
Design patterns are reusable code solutions to common programming problems. They create a common vocabulary that allows designers and developers to communicate effectively. Some key design patterns include the Command pattern, which encapsulates executing operations as objects, and the Decorator pattern, which allows adding new functionality to objects without modifying them. Using patterns like Lazy Load avoids unnecessary processing until needed.
9 crucial Java Design Principles you cannot missMark Papis
Encapsulation, Polymorphism, Agreggation / Composition, Overloading, Inheritance vs Composition, DRY, Dependency Injection, Delagation, Law of demeter, Principle of leas knowledge,
What is Interface in Java | How to implement Multiple Inheritance Using Inter...Edureka!
YouTube Link: https://youtu.be/jJ8L3SeFy_E
**Java, J2EE & SOA Certification Training - https://www.edureka.co/java-j2ee-training-course **
This Edureka PPT on "Interface on Java" will provide you with detailed knowledge about Java Interface and also cover some real-time examples in order to provide you a better understanding of the functionality of Java Interface. This PPT will cover the following topics:
What is an Interface?
Why do we need an Interface?
Practical examples on Interface
Interface Nesting
Difference between Class and Interface
Advantages and Disadvantages of Interface
Key Points on Interface.
Practical Examples of Interface on Key Points
Follow us to never miss an update in the future.
YouTube: https://www.youtube.com/user/edurekaIN
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
Castbox: https://castbox.fm/networks/505?country=in
The document discusses design patterns, which are reusable solutions to common software design problems. It provides examples of different types of patterns, including creational (Factory Method, Abstract Factory, Builder, Prototype, Singleton), structural (Adapter, Bridge, Composite, Decorator, Facade, Flyweight, Proxy), and behavioral (Chain of Responsibility, Command, Interpreter, Iterator, Mediator, Memento, Observer, State, Strategy, Template Method, Visitor) patterns. Each pattern is defined and an example problem and solution using the pattern is described.
This document discusses the components of a successful ePortfolio project, with a focus on the role of technology. It notes that there are many parts to an ePortfolio project, and that technology is one important aspect. It then discusses goals, tools, support/training, budgeting, and implementation considerations. The document also outlines different types of ePortfolio platforms, including proprietary, open source, and combined models. It proposes three approaches to comparing platforms: comparing specs, assessing needs, and seeing platforms in action.
The document discusses building sustainable large Android apps. It recommends establishing project conventions for naming, dependencies, resources and more. It also recommends structuring the app based on features and using fragments to separate UI from logic. The document discusses architectural patterns like MVP and implementing MVP with a passive view to make the code testable, reusable and maintainable.
Domain Driven Design (DDD) is a software development approach that focuses on modeling a complex domain into code. The document discusses key DDD concepts like entities, value objects, aggregates, repositories, bounded contexts, and validation. It provides examples of how these concepts are implemented in code and outlines challenges and situations where DDD may not be appropriate, such as for non-complex domains without behavior/logic or where the data model maps directly to a relational database schema.
Responsive eLearning for Multi-Devices is growing rapidly. Presentation gives you behind the scenes look at FRED, our Framework for Responsive eLearning Development.
Traits offer an alternative solution to inheritance that is particularly suited to class-less languages like Javascript. With this approach, the aspects of instance generation and units of reuse are clearly separated while providing methods of composition that are functionally similar to multiple inheritance. Troublesome multiple inheritance issues like the diamond problems are avoided by keeping traits stateless. Any state must be stored in the instance that inherits from the trait.
The document discusses design patterns used in object-oriented programming. It describes common design patterns like factory method, singleton, observer, and adapter patterns. It also discusses principles for assigning responsibilities to objects like high cohesion and low coupling. The document provides examples of applying these patterns and principles to design software objects and systems.
Software Design Patterns. Part I :: Structural PatternsSergey Aganezov
In a nutshell, software design patterns are generally reusable solutions to a commonly occurring problems. And this says it all! We are going to learn when it is completely unnecessary for you to reinvent the wheel, and what are the best ways to approach each particular problem during software development process.
This document contains 15 technical interview questions and answers about various programming concepts in C/C++. The questions cover topics such as the differences between String, StringBuffer and StringBuilder classes, access modifiers like public, private and protected, pointers, friend functions, constructors, operator overloading, function overloading, inline functions, inheritance, abstraction, encapsulation, recursion, structures, nested structures, and pointers to pointers.
This document provides an overview of key concepts in Drupal 7 related to entities, bundles, and fields. It discusses how entities act as containers for bundles, and bundles define groups of fields. Examples of entities include nodes, users, files. Fields define the type of data that can be attached to entities. The document recommends the Examples module for learning about implementing these concepts and provides code snippets for hook_install() to set up a content type with fields as part of installation.
Similar to Object-Oriented Design: Multiple inheritance (C++ and C#) (20)
Ivanti’s Patch Tuesday breakdown goes beyond patching your applications and brings you the intelligence and guidance needed to prioritize where to focus your attention first. Catch early analysis on our Ivanti blog, then join industry expert Chris Goettl for the Patch Tuesday Webinar Event. There we’ll do a deep dive into each of the bulletins and give guidance on the risks associated with the newly-identified vulnerabilities.
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc
How does your privacy program stack up against your peers? What challenges are privacy teams tackling and prioritizing in 2024?
In the fifth annual Global Privacy Benchmarks Survey, we asked over 1,800 global privacy professionals and business executives to share their perspectives on the current state of privacy inside and outside of their organizations. This year’s report focused on emerging areas of importance for privacy and compliance professionals, including considerations and implications of Artificial Intelligence (AI) technologies, building brand trust, and different approaches for achieving higher privacy competence scores.
See how organizational priorities and strategic approaches to data security and privacy are evolving around the globe.
This webinar will review:
- The top 10 privacy insights from the fifth annual Global Privacy Benchmarks Survey
- The top challenges for privacy leaders, practitioners, and organizations in 2024
- Key themes to consider in developing and maintaining your privacy program
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfChart Kalyan
A Mix Chart displays historical data of numbers in a graphical or tabular form. The Kalyan Rajdhani Mix Chart specifically shows the results of a sequence of numbers over different periods.
Driving Business Innovation: Latest Generative AI Advancements & Success StorySafe Software
Are you ready to revolutionize how you handle data? Join us for a webinar where we’ll bring you up to speed with the latest advancements in Generative AI technology and discover how leveraging FME with tools from giants like Google Gemini, Amazon, and Microsoft OpenAI can supercharge your workflow efficiency.
During the hour, we’ll take you through:
Guest Speaker Segment with Hannah Barrington: Dive into the world of dynamic real estate marketing with Hannah, the Marketing Manager at Workspace Group. Hear firsthand how their team generates engaging descriptions for thousands of office units by integrating diverse data sources—from PDF floorplans to web pages—using FME transformers, like OpenAIVisionConnector and AnthropicVisionConnector. This use case will show you how GenAI can streamline content creation for marketing across the board.
Ollama Use Case: Learn how Scenario Specialist Dmitri Bagh has utilized Ollama within FME to input data, create custom models, and enhance security protocols. This segment will include demos to illustrate the full capabilities of FME in AI-driven processes.
Custom AI Models: Discover how to leverage FME to build personalized AI models using your data. Whether it’s populating a model with local data for added security or integrating public AI tools, find out how FME facilitates a versatile and secure approach to AI.
We’ll wrap up with a live Q&A session where you can engage with our experts on your specific use cases, and learn more about optimizing your data workflows with AI.
This webinar is ideal for professionals seeking to harness the power of AI within their data management systems while ensuring high levels of customization and security. Whether you're a novice or an expert, gain actionable insights and strategies to elevate your data processes. Join us to see how FME and AI can revolutionize how you work with data!
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Jeffrey Haguewood
Sidekick Solutions uses Bonterra Impact Management (fka Social Solutions Apricot) and automation solutions to integrate data for business workflows.
We believe integration and automation are essential to user experience and the promise of efficient work through technology. Automation is the critical ingredient to realizing that full vision. We develop integration products and services for Bonterra Case Management software to support the deployment of automations for a variety of use cases.
This video focuses on integration of Salesforce with Bonterra Impact Management.
Interested in deploying an integration with Salesforce for Bonterra Impact Management? Contact us at sales@sidekicksolutionsllc.com to discuss next steps.
HCL Notes and Domino License Cost Reduction in the World of DLAUpanagenda
Webinar Recording: https://www.panagenda.com/webinars/hcl-notes-and-domino-license-cost-reduction-in-the-world-of-dlau/
The introduction of DLAU and the CCB & CCX licensing model caused quite a stir in the HCL community. As a Notes and Domino customer, you may have faced challenges with unexpected user counts and license costs. You probably have questions on how this new licensing approach works and how to benefit from it. Most importantly, you likely have budget constraints and want to save money where possible. Don’t worry, we can help with all of this!
We’ll show you how to fix common misconfigurations that cause higher-than-expected user counts, and how to identify accounts which you can deactivate to save money. There are also frequent patterns that can cause unnecessary cost, like using a person document instead of a mail-in for shared mailboxes. We’ll provide examples and solutions for those as well. And naturally we’ll explain the new licensing model.
Join HCL Ambassador Marc Thomas in this webinar with a special guest appearance from Franz Walder. It will give you the tools and know-how to stay on top of what is going on with Domino licensing. You will be able lower your cost through an optimized configuration and keep it low going forward.
These topics will be covered
- Reducing license cost by finding and fixing misconfigurations and superfluous accounts
- How do CCB and CCX licenses really work?
- Understanding the DLAU tool and how to best utilize it
- Tips for common problem areas, like team mailboxes, functional/test users, etc
- Practical examples and best practices to implement right away
Taking AI to the Next Level in Manufacturing.pdfssuserfac0301
Read Taking AI to the Next Level in Manufacturing to gain insights on AI adoption in the manufacturing industry, such as:
1. How quickly AI is being implemented in manufacturing.
2. Which barriers stand in the way of AI adoption.
3. How data quality and governance form the backbone of AI.
4. Organizational processes and structures that may inhibit effective AI adoption.
6. Ideas and approaches to help build your organization's AI strategy.
5th LF Energy Power Grid Model Meet-up SlidesDanBrown980551
5th Power Grid Model Meet-up
It is with great pleasure that we extend to you an invitation to the 5th Power Grid Model Meet-up, scheduled for 6th June 2024. This event will adopt a hybrid format, allowing participants to join us either through an online Mircosoft Teams session or in person at TU/e located at Den Dolech 2, Eindhoven, Netherlands. The meet-up will be hosted by Eindhoven University of Technology (TU/e), a research university specializing in engineering science & technology.
Power Grid Model
The global energy transition is placing new and unprecedented demands on Distribution System Operators (DSOs). Alongside upgrades to grid capacity, processes such as digitization, capacity optimization, and congestion management are becoming vital for delivering reliable services.
Power Grid Model is an open source project from Linux Foundation Energy and provides a calculation engine that is increasingly essential for DSOs. It offers a standards-based foundation enabling real-time power systems analysis, simulations of electrical power grids, and sophisticated what-if analysis. In addition, it enables in-depth studies and analysis of the electrical power grid’s behavior and performance. This comprehensive model incorporates essential factors such as power generation capacity, electrical losses, voltage levels, power flows, and system stability.
Power Grid Model is currently being applied in a wide variety of use cases, including grid planning, expansion, reliability, and congestion studies. It can also help in analyzing the impact of renewable energy integration, assessing the effects of disturbances or faults, and developing strategies for grid control and optimization.
What to expect
For the upcoming meetup we are organizing, we have an exciting lineup of activities planned:
-Insightful presentations covering two practical applications of the Power Grid Model.
-An update on the latest advancements in Power Grid -Model technology during the first and second quarters of 2024.
-An interactive brainstorming session to discuss and propose new feature requests.
-An opportunity to connect with fellow Power Grid Model enthusiasts and users.
Building Production Ready Search Pipelines with Spark and MilvusZilliz
Spark is the widely used ETL tool for processing, indexing and ingesting data to serving stack for search. Milvus is the production-ready open-source vector database. In this talk we will show how to use Spark to process unstructured data to extract vector representations, and push the vectors to Milvus vector database for search serving.
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfMalak Abu Hammad
Discover how MongoDB Atlas and vector search technology can revolutionize your application's search capabilities. This comprehensive presentation covers:
* What is Vector Search?
* Importance and benefits of vector search
* Practical use cases across various industries
* Step-by-step implementation guide
* Live demos with code snippets
* Enhancing LLM capabilities with vector search
* Best practices and optimization strategies
Perfect for developers, AI enthusiasts, and tech leaders. Learn how to leverage MongoDB Atlas to deliver highly relevant, context-aware search results, transforming your data retrieval process. Stay ahead in tech innovation and maximize the potential of your applications.
#MongoDB #VectorSearch #AI #SemanticSearch #TechInnovation #DataScience #LLM #MachineLearning #SearchTechnology
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Speck&Tech
ABSTRACT: A prima vista, un mattoncino Lego e la backdoor XZ potrebbero avere in comune il fatto di essere entrambi blocchi di costruzione, o dipendenze di progetti creativi e software. La realtà è che un mattoncino Lego e il caso della backdoor XZ hanno molto di più di tutto ciò in comune.
Partecipate alla presentazione per immergervi in una storia di interoperabilità, standard e formati aperti, per poi discutere del ruolo importante che i contributori hanno in una comunità open source sostenibile.
BIO: Sostenitrice del software libero e dei formati standard e aperti. È stata un membro attivo dei progetti Fedora e openSUSE e ha co-fondato l'Associazione LibreItalia dove è stata coinvolta in diversi eventi, migrazioni e formazione relativi a LibreOffice. In precedenza ha lavorato a migrazioni e corsi di formazione su LibreOffice per diverse amministrazioni pubbliche e privati. Da gennaio 2020 lavora in SUSE come Software Release Engineer per Uyuni e SUSE Manager e quando non segue la sua passione per i computer e per Geeko coltiva la sua curiosità per l'astronomia (da cui deriva il suo nickname deneb_alpha).
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUpanagenda
Webinar Recording: https://www.panagenda.com/webinars/hcl-notes-und-domino-lizenzkostenreduzierung-in-der-welt-von-dlau/
DLAU und die Lizenzen nach dem CCB- und CCX-Modell sind für viele in der HCL-Community seit letztem Jahr ein heißes Thema. Als Notes- oder Domino-Kunde haben Sie vielleicht mit unerwartet hohen Benutzerzahlen und Lizenzgebühren zu kämpfen. Sie fragen sich vielleicht, wie diese neue Art der Lizenzierung funktioniert und welchen Nutzen sie Ihnen bringt. Vor allem wollen Sie sicherlich Ihr Budget einhalten und Kosten sparen, wo immer möglich. Das verstehen wir und wir möchten Ihnen dabei helfen!
Wir erklären Ihnen, wie Sie häufige Konfigurationsprobleme lösen können, die dazu führen können, dass mehr Benutzer gezählt werden als nötig, und wie Sie überflüssige oder ungenutzte Konten identifizieren und entfernen können, um Geld zu sparen. Es gibt auch einige Ansätze, die zu unnötigen Ausgaben führen können, z. B. wenn ein Personendokument anstelle eines Mail-Ins für geteilte Mailboxen verwendet wird. Wir zeigen Ihnen solche Fälle und deren Lösungen. Und natürlich erklären wir Ihnen das neue Lizenzmodell.
Nehmen Sie an diesem Webinar teil, bei dem HCL-Ambassador Marc Thomas und Gastredner Franz Walder Ihnen diese neue Welt näherbringen. Es vermittelt Ihnen die Tools und das Know-how, um den Überblick zu bewahren. Sie werden in der Lage sein, Ihre Kosten durch eine optimierte Domino-Konfiguration zu reduzieren und auch in Zukunft gering zu halten.
Diese Themen werden behandelt
- Reduzierung der Lizenzkosten durch Auffinden und Beheben von Fehlkonfigurationen und überflüssigen Konten
- Wie funktionieren CCB- und CCX-Lizenzen wirklich?
- Verstehen des DLAU-Tools und wie man es am besten nutzt
- Tipps für häufige Problembereiche, wie z. B. Team-Postfächer, Funktions-/Testbenutzer usw.
- Praxisbeispiele und Best Practices zum sofortigen Umsetzen
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
Object-Oriented Design: Multiple inheritance (C++ and C#)
1. Copyright@2014
Taylor
&
Francis
Adair
Dingle
All
Rights
Reserved
Object-‐Oriented
Design
Inheritance
vs.
ComposiAon:
Part
II
Inheritance for Interface: Multiple Inheritance
2. Design
QuesAons
• How
to
implement
mulAple
inheritance?
• What
type
is
most
important?
– DisAnguish
between
potenAal
base
classes
– Decide
which
type(s)
to
subordinate
Copyright@2015
Adair
Dingle
3. Key
ObservaAons
• Inheritance
and
composiAon
BOTH
provide
reuse
• Interface
inheritance
is
not
true
inheritance
– but
can
serve
to
fulfill
client
needs
• Design
impacts
soSware
maintainability
Copyright@2015
Adair
Dingle
4. Chapter
8:
Design
AlternaAves
&
PerspecAves
ComparaAve
Design
Design
types
and
alterna/ves
for
client
use
• Class
design
types
• Design
for
Inheritance
• Inheritance
vs.
ComposiAon
• MulAple
Inheritance
• Design
Principles
Copyright@2014
Taylor
&
Francis
Adair
Dingle
All
Rights
Reserved
5. Why
consider
SoSware
Design?
• Design
impacts
soSware
use
– Efficiency,
OpAmizaAon
(Inlining),
Maintainability,
…
– Ease
of
subtype
manipulaAon,
heterogeneous
collecAons,
...
– Interface
adaptaAon,
type
subordinaAon,
…
• Design
impacts
soSware
reuse
– Type
extensibility
– Type
checking,
type
extracAon
• Class
designers
should
carefully
consider
design
alternaAves
• Different
costs
and
benefits
– Inheritance
vs
composiAon
– Exposed/echoed/wrapped
interfaces
– Type
definiAon/idenAficaAon/extracAon
Copyright@2014
Taylor
&
Francis
Adair
Dingle
All
Rights
Reserved
6. Class
Design
Types
• Concrete
–
immediately
usable
– Simple,
efficient,
standalone
type
– Inheritance
NOT
intended
• Abstract
–
not
instanAable
– Defines
common
interface
for
class
hierarchy
– Inheritance
REQUIRED
• Node
-‐-‐
Intermediate
class
in
class
hierarchy
– Inherits
interface
– provides
resoluAon
or
refined
behavior
– Inheritance
anAcipated
Copyright@2014
Taylor
&
Francis
Adair
Dingle
All
Rights
Reserved
7. Class
Design
Types
-‐-‐
conAnued
• Wrapper
– Isolates
client
from
instable
or
proprietary
interface
– May
echo
porAon
of
wrapped
interface
– May
augment/coalesce/modified
wrapped
behavior
– Wrapped
object
replaceable
without
impact
• Delegate
– Wrapped
subObject
– Replaceable,
possibly
polymorphic
– ResponsibiliAes
delegated
to
wrapped
subObject
• Handle
– Transparent
resource
manager
– Tracks
wrapped
subObject
– No
alteraAon
in
wrapped
behavior
Copyright@2014
Taylor
&
Francis
Adair
Dingle
All
Rights
Reserved
8. Encapsulated
SubObjects
• Wrappers
encapsulate
exisAng
types
– reusing
(and
possibly
augmenAng
or
modifying)
funcAonality
– frequently
isolate
applicaAon
programmer
from
unstable
interfaces
– wrapped
subObject
may
be
replaced
without
any
impact
– subObject’s
interface,
if
echoed,
oSen
echoed
in
a
modified
fashion.
• Delegate
is
(wrapped)
subObject
– provides
key
funcAonality
to
the
wrapper
class
– may
be
exchanged,
replaced,
stubbed
out,
and/or
polymorphic.
• Handle
promotes
transparency
– provides
external
access
to
internal
funcAonality
of
wrapped
subObject
– e.g.
smart
pointer
– Unlike
wrappers,
handles
do
not
augment
or
modify
subObject
funcAonality.
Copyright@2014
Taylor
&
Francis
Adair
Dingle
All
Rights
Reserved
9. Abstract
Classes
• Define
interface
for
class
hierarchy
– Determine
funcAonality
accessible
via
heterogeneous
collecAon
• May
or
may
not
provide
default
behavior
• Require
inheritance
• EffecAve
design
with
polymorphism
– May
dilute
cohesion
if
designed
but
unnecessary
Copyright@2014
Taylor
&
Francis
Adair
Dingle
All
Rights
Reserved
10. Abstract
Classes
• A
class
is
DESIGNED
as
abstract
when
• At
least
one
method
is
undefined
• only
protected
constructors
provided
=>
Client
cannot
instanAate
instance
of
class
• C#/Java
provide
keyword
abstract
• code
more
readable
and
thus
maintainable
• C++
does
not
provide
keyword
abstract
• UAlity
of
abstract
classes
remains
the
same
– regardless
of
syntacAcal
differences
across
languages
Copyright@2014
Taylor
&
Francis
Adair
Dingle
All
Rights
Reserved
11. Example
8.4
Abstract
Classes
//C++: no keyword abstract C#/Java: just use keyword abstract
// C++ => at least one method must be pure virtual
class Toy
{ public:
virtual bool safe() = 0;
…
};
//Abstract BY DESIGN (C++, C#, Java,…)
// => protected constructor, no public constructor
class Vehicle
{ protected:
Vehicle();
public:
…
};
Copyright@2014
Taylor
&
Francis
Adair
Dingle
All
Rights
Reserved
12. Example
8.5
Delegate
Use
class seminarAttendee // delegate could be object or pointer
{ // indirection supports postponed instantiation
idVerifier delegate;
…
void replaceDelegate(…)
{ idVerifier newImproved(…);
delegate = newImproved;
}
public:
…
// pass requests to delegate
bool registerD() { return delegate.isSet() }
bool isValid() { return delegate.verify(); }
bool renew()
{ if (!registerD() || !isValid()) return false;
return (delegate.getAge() > 18)
}
};
Copyright@2014
Taylor
&
Francis
Adair
Dingle
All
Rights
Reserved
13. Example
8.6
Polymorpic
Delegate
class HasADelegate
{ idVerifier delegate;
BaseType* polyD;
void replaceDelegate()
{ delete polyD;
if (…) polyD = new MinType(…);
else if (…) polyD = new MaxType(…);
else if (…) polyD = new MeanType(…);
}
public:
// simple echo
int getAge() [ return delegate.getAge(); }
// additional layer of indirection supports polymorphism
void dynamicProcess()
{ return polyD->process(); }
…
};
Copyright@2014
Taylor
&
Francis
Adair
Dingle
All
Rights
Reserved
14. Table
8.4
Inheritance
Effects
Copyright@2014
Taylor
&
Francis
Adair
Dingle
All
Rights
Reserved
Motivation Characteristics Benefits Costs
Code reuse
Inheritance of
Implementation
Reuse existing class
May suppress/NOP
interface
Reduce :
--development time
--cut & paste design
--maintenance
Code complexity
Increased coupling
Decreased cohesion
Unavoidable overhead
Fixed cardinality
Dependency on parent
Lifetime association
Type extension
Inheritance of
Interface
Is-a relationship
Subtype relevant
Type familiarity
Substitutability
Polymorphism
Heterogeneity
Extensibility
15. Inheritance
vs.
ComposiAon
Both
support
Code
Reuse
Inheritance
supports
type
extensibility
polymorphism
heterogeneous
collecAons
Inheritance
provides
built-‐in
and
efficient
mechanism
for
type-‐checking
promotes
design
clarity
and
maintainability
Copyright@2014
Taylor
&
Francis
Adair
Dingle
All
Rights
Reserved
16. Inheritance
vs.
ComposiAon
ComposiAon
affords
the
class
designer
more
control
• subObject
may
be
manipulated
in
ways
that
a
parent
cannot
• InstanAaAon
may
be
postponed
• subObjects
may
be
replaced
• Cardinality,
lifeAme,
associaAon
and
ownership
may
vary
– All
fixed
design
for
inheritance
• Interfaces
may
be
selecAvely
echoed
• Overhead
can
be
avoided
• Unstable
types
may
be
wrapped
Copyright@2014
Taylor
&
Francis
Adair
Dingle
All
Rights
Reserved
17. Example
8.8
Inheritance
vs
ComposiAon
class B
{ protected:
virtual void filter();
public:
…
virtual void store();
};
class QueenInheritB: public B
{ public:
// keyword used for documentation
// once virtual always virtual!!
virtual void store()
{ B::store();
filter();
…
}
…
};
Copyright@2014
Taylor
&
Francis
Adair
Dingle
All
Rights
Reserved
18. Example
8.8
conAnued
class QueenComposeB
{
B subObject;
public:
// cannot access protected B::filter()
// virtual nature of B::store() not relevant
void store()
{ subObject.store();
…
}
…
};
Copyright@2014
Taylor
&
Francis
Adair
Dingle
All
Rights
Reserved
19. Example
8.9
ComposiAon
with
Exposed
Interface
class Be: public B
{ public:
… // make inherited protected method public
void filter() { B::filter(); }
};
class QueenComposeB2
{ Be subObject;
public:
// can filter by using intermediary class
void store()
{ subObject.store();
subObject.filter();
}
};
Copyright@2014
Taylor
&
Francis
Adair
Dingle
All
Rights
Reserved
20. Example
8.10
Inheritance
vs
Polymorphic
Subobjects
class flexQueen
{ B* subObjP;
public:
// constructor can instantiate any B (sub)type object
// subObjP = 0 or subObjP = new Be or subObjP = Bee …
flexQueen()
{ subObjP = new B;
… // other choices
}
virtual void store()
{ subObjP->store(); // dynamic behavior }
void replaceB(B*& worker)
{ delete subObjP; subObjP = worker;
worker = 0;
}
…
};
Copyright@2014
Taylor
&
Francis
Adair
Dingle
All
Rights
Reserved
21. MulAple
Inheritance
• Like
single
inheritance,
mulAple
inheritance
– promotes
type
extensibility
– supports
polymorphism.
• MulAple
inheritance
increases
design
complexity
– two
divergent
ancestral
paths
needed
to
understand
class
– Two-‐degree
variance
may
compromise
maintainability
• Two
classic
design
difficulAes
– AMBUGUITY:
parental
interfaces
overlap
– REDUNDANCY:
common
grandparent
component
Copyright@2014
Taylor
&
Francis
Adair
Dingle
All
Rights
Reserved
22. MulAple
Inheritance
• Ambiguity
easily
resolved
– Two
parents
define
same
funcAon
signature
=>
COMPILER
ERROR
– Child
class
must
override
doubly
inherited
funcAon
• redefine
or
direct
call
to
specific
parent
=>
Descendant
class
definiAons
compile
• Redundancy
NOT
easily
resolved
– Two
parents
share
same
ancestor
– Child
class
inherits
two
copies
of
common
ancestor
– Duplicate
copy
cannot
be
suppressed
easily
Copyright@2014
Taylor
&
Francis
Adair
Dingle
All
Rights
Reserved
23. Example
8.12
Resolving
Ambiguity:
C++
MulAple
Inheritance
class StudentEmployee: public Employee, public Student
{ …
public:
…
int getAge()
{ return Student::getAge(); }
int getSeniority()
{ return Employee::getAge(); }
};
Copyright@2014
Taylor
&
Francis
Adair
Dingle
All
Rights
Reserved
24. Type
SubordinaAon
• Inheritance
simulated
via
ComposiAon
– One
(or
both)
parent
is
defined
as
a
subObject
– Necessary
when
mulAple
inheritance
NOT
supported
(C#/Java)
• Class
designer
selects
subObject
&
thus
subordinates
a
type
• subObject
does
not
have
visibility
of
a
parent
component
– its
interface
is
not
assumed
– Its
interface
must
be
echoed
if
needed
• No
is-‐a
relaAonship
to
support
type
interchange
in
client
code
– Design
changes
not
‘automaAcally’
passed
with
compilaAon
– No
external
subsAtutability
for
subObject
– No
heterogeneous
collecAons
typed
to
subObject
Copyright@2014
Taylor
&
Francis
Adair
Dingle
All
Rights
Reserved
25. Type
SubordinaAon
EffecAve
design
technique
• Permits
simulaAon
of
inheritance
• adds
flexibility
and
control
over
– InstanAaAon
– Cardinality
– AssociaAon
– LifeAme
– Ownership
– Interface
Copyright@2014
Taylor
&
Francis
Adair
Dingle
All
Rights
Reserved
26. Example
8.17
C#
StudentEmployee:
Student
parent
interface EmployeeI
{ … }
public class StudentEmployee3: Student, EmployeeI
{ // contain zero or more Employee components
private Employee e;
// interface forces echo of Employee functionality
…
}
// why ‘Employee’ subordinated to ‘Student’?
Copyright@2014
Taylor
&
Francis
Adair
Dingle
All
Rights
Reserved
27. Table
8.5
Simulate
MulAple
Inheritance
using
ComposiAon
Motivation Benefits Costs
No provision for multiple
inheritance in implementation
language
Clear subordinate parent type
Efficiency
Type depends on one parent
for utility not interface
Variable cardinality
Replaceable subobject
Insulating layer
Shield from parent
Polymorphic subobject
Inconvenient loss of:
-- Protected interface
Design constrained by
loss of:
--Type familiarity
--Substitutability
--Polymorphism
--Heterogeneity
--Extensibility
Copyright@2014
Taylor
&
Francis
Adair
Dingle
All
Rights
Reserved
28. Interface
SegregaAon
Principle
Interfaces
should
be
small
and
contain
only
a
few,
related
methods
• Exalts
interfaces
as
key
design
component
• Promotes
high
cohesion
and
low
coupling
• Confines
breadth
of
interface
– Narrow
interfaces
focus
design
and
imply
specific
uAlity.
– Wide
interfaces
undermine
cohesion
and
maintainability
• Targets
interacAng
class
design
– whether
for
inheritance
or
composiAon.
Copyright@2014
Taylor
&
Francis
Adair
Dingle
All
Rights
Reserved
29. Program
to
Interface
Not
to
ImplementaAon
Model
func/onality,
decoupled
from
implementa/on,
by
using
abstract
classes
and
interfaces.
=>
Implementa/on
can
then
vary
independently.
• Exalts
interfaces
as
key
design
component
• Upholds
OOD
abstracAon
and
encapsulaAon
– Isolate
client
from
volaAle/arbitrary
implementaAon
• Drives
complementary
class
design
– whether
for
inheritance
or
composiAon.
Copyright@2014
Taylor
&
Francis
Adair
Dingle
All
Rights
Reserved
30. Dependency
Inversion
Principle
High-‐level
abstrac/ons
are
more
stable.
If
dependencies
exist,
preferable
that
low-‐level
abstrac/ons
depend
on
high-‐level
abstrac/ons
• reinforces
value
of
an
extensible,
possibly
abstract,
interface
at
the
base
of
a
class
hierarchy.
• suggests
choice
when
determining
subordinate
class
– Client
should
be
isolated
from
the
least
abstract
type.
– if
any
lower-‐level
details
change,
client
code
is
shielded.
Copyright@2014
Taylor
&
Francis
Adair
Dingle
All
Rights
Reserved