The document provides an overview of the .NET Framework, which is Microsoft's platform for application development. It describes the key components of the .NET Framework architecture, including the Common Language Runtime (CLR) environment that executes managed code, the framework class library, and support for different programming languages. The CLR is similar to a virtual machine that controls execution of .NET code and provides services like memory management and security.
Lambda expressions, default methods in interfaces, and the new date/time API are among the major new features in Java 8. Lambda expressions allow for functional-style programming by treating functionality as a method argument or anonymous implementation. Default methods add new capabilities to interfaces while maintaining backwards compatibility. The date/time API improves on the old Calendar and Date APIs by providing immutable and easier to use classes like LocalDate.
This is a presentation I did for the Cedar Rapids .NET User Group (CRineta.org). It was intended to present object oriented concepts and their application in .NET and C#.
The document discusses key concepts of classes and objects in C# including defining classes, adding variables and methods, member access modifiers, creating objects, constructors, static members, private constructors, and indexers. It defines classes as user defined data types that can encapsulate data as fields and functions as methods. Objects are instances of classes that allow data and methods to be accessed. Constructors initialize objects, while static members are associated with the class rather than individual objects.
Inheritance allows one class to inherit properties and behaviors from another base class. There are two main types of inheritance: implementation inheritance, where a derived class takes on all members of the base class; and interface inheritance, where a derived class inherits only function signatures without implementations. Key aspects of inheritance in C# include defining virtual methods that can be overridden, using modifiers like sealed to restrict inheritance, and implementing interfaces that define common behaviors without implementations.
The document discusses object-oriented programming concepts in C#, including defining classes, constructors, properties, static members, interfaces, inheritance, and polymorphism. It provides examples of defining a simple Cat class with fields, a constructor, properties, and methods. It also demonstrates using the Dog class by creating dog objects, setting their properties, and calling their bark method.
The document provides an overview of the basics of C# 2008 .NET 3.0/3.5, including the basic structure of a C# program, namespaces, classes, methods, variables, data types, operators, flow control, arrays, namespaces, console input/output, and comments. It discusses key concepts such as object-oriented programming fundamentals, console applications in Visual Studio 2008, and more advanced topics such as checked and unchecked operators.
in this tutorial we will discuss about
exception handling in C#
Exception class
creating user-defined exception
throw keyword
finally keyword
with examples'
Java abstract class & abstract methods,Abstract class in java
Abstract classes are classes that contain one or more abstract methods. An abstract method is a method that is declared, but contains no implementation. Abstract classes may not be instantiated, and require subclasses to provide implementations for the abstract methods.
This slide is based on Object Oriented Programming Language. Here is some details about object and class. You can easily understand about object and class.
Interfaces define methods that classes can implement. Classes implementing interfaces must define all interface methods. Interfaces can extend other interfaces, requiring implementing classes to define inherited methods as well. Interface variables are implicitly public, static, and final. A class can implement multiple interfaces and override methods with the same name across interfaces. Partial interface implementation requires the class to be abstract.
Inheritance in java is a mechanism in which one object acquires all the properties and behaviors of parent object. The idea behind inheritance in java is that you can create new classes that are built upon existing classes.
Java Training | Java Tutorial for Beginners | Java Programming | Java Certifi...Edureka!
This Edureka Java Training tutorial will help you in understanding the core fundamentals of Java. It helps you to learn following topics:
1) Introduction to Java
2) Java Timeline
3) Features of Java
4) How does Java work?
5) Data Types in Java
6) Operators in Java
7) Functions in Java
8) Object Oriented Concepts in Java
Superclasses, and Subclasses, Overriding and Hiding Methods, Polymorphism, Inheritance Hierarchies, Super keyword, Final Classes and Methods, Abstract,
Classes and Methods, Nested classes & Inner Classes,
finalization and garbage collection.
This document discusses inheritance in Java. It defines inheritance as a mechanism where a subclass inherits the properties and behaviors of its parent class. It provides an example of single inheritance in Java where class B extends class A, inheriting its attributes and methods. The document also describes different types of inheritance like multilevel inheritance where a class inherits from another subclass, and hierarchical inheritance where a parent class has multiple subclasses. It provides an example of inheritance between different animal classes to demonstrate these concepts.
This document outlines a presentation on jQuery fundamentals. The presentation introduces jQuery as a lightweight JavaScript library for DOM manipulation, event handling, Ajax, and animation. It covers jQuery syntax, selectors, DOM traversal and manipulation methods. It also discusses jQuery's event system, Ajax support, and plugins. The presentation includes demos of common jQuery tasks to demonstrate its usage and capabilities.
This document discusses principles of clean code based on the book "Clean Code" by Robert C. Martin. It provides examples of good and bad practices for naming variables and functions, structuring functions, using comments, and other topics. Key points include using meaningful names, keeping functions small and focused on a single task, avoiding deeply nested code and long argument lists, commenting to explain intent rather than state the obvious, and other guidelines for writing clean, readable code.
The document discusses clean coding practices for Java developers. It covers topics such as choosing meaningful names for variables, methods, and classes; writing code that is easy for others to understand; breaking methods down into single logical steps; and using fluent APIs to make code more readable. The presentation provides examples of clean code and ways to refactor code to follow best practices.
This document provides an overview of object-oriented programming (OOP) concepts in C#, including classes, objects, inheritance, encapsulation, and polymorphism. It defines key terms like class and object, and explains how C# supports OOP principles such as defining classes with methods and properties, extending classes through inheritance, hiding implementation through encapsulation, and allowing polymorphic behavior through function overloading and overriding. Abstract classes and sealed modifiers are also covered. The document is intended to help explain basic OOP concepts in C# to readers.
Type casting involves assigning a value of one data type to a variable of another type. There are two types of casting: widening (implicit) and narrowing (explicit). Widening casting converts data to a broader type without needing explicit casting, like converting an int to a long. Narrowing casting converts to a narrower data type and requires explicit casting, such as converting a double to a long.
This ppt gives information about:
1. OOPs Theory
2. Defining a Class
3. Creating an Object
4. The $this Attribute
5. Creating Constructors
6. Creating Destructors
An interface in Java is a blueprint of a class that defines static constants and abstract methods. Interfaces are implemented by classes where they inherit the properties and must define the body of the abstract methods. Key points are:
- Interfaces can only contain abstract methods and static constants, not method bodies.
- Classes implement interfaces to inherit the properties and must define the abstract method bodies.
- An interface can extend other interfaces and a class can implement multiple interfaces.
The document discusses strings and StringBuffers in Java. Strings are immutable sequences of characters represented by the String class. StringBuffers allow modifying character sequences and are represented by the StringBuffer class. The summary provides an overview of common string and StringBuffer operations like concatenation, extraction, comparison, and modification.
Angular - Chapter 4 - Data and Event HandlingWebStackAcademy
The document provides information about Angular data binding and event handling. It discusses how interpolation can be used to connect data from a component class to its template. It also explains how property binding and event binding allow two-way communication between the component class and template. Finally, it introduces ngModel for setting up two-way data binding between an input element and a property.
The document discusses multithreading concepts like concurrency and threading, how to create and control threads including setting priorities and states, and how to safely share resources between threads using synchronization, locks, and wait/notify methods to avoid issues like deadlocks. It also covers deprecated thread methods and increased threading support in JDK 1.5.
Java is Object Oriented Programming. Java 8 is the latest version of the Java which is used by many companies for the development in many areas. Mobile, Web, Standalone applications.
The document provides information on object-oriented programming concepts in Java including classes, objects, encapsulation, inheritance, polymorphism, and abstraction. It defines classes like Shape, Rectangle, Circle and Triangle to demonstrate these concepts. It also discusses Java data types, constructors, access modifiers, interfaces and abstract classes.
This document provides an overview of an introductory C# programming course. The course covers C# fundamentals like setting up a development environment, data types, conditionals, loops, object-oriented programming concepts, and data structures. It includes topics like installing Visual Studio, writing a "Hello World" program, built-in data types like string, integer, boolean, and more. The document also outlines sample code solutions for exercises on command line arguments, integer operations, leap year finder, and powers of two.
Numeral Systems: Positional and Non-Positional
Conversions between Positional Numeral Systems: Binary, Decimal and Hexadecimal
Representation of Numbers in Computer Memory
Exercises: Conversion between Different Numeral Systems
Defining Simple Classes
Using Own Classes and Objects
Access Modifiers
Constructors and Initializers
Defining Fields
Defining Properties, Getters and Setters
Defining Methods
Exercises: Defining and Using Own Classes
Java abstract class & abstract methods,Abstract class in java
Abstract classes are classes that contain one or more abstract methods. An abstract method is a method that is declared, but contains no implementation. Abstract classes may not be instantiated, and require subclasses to provide implementations for the abstract methods.
This slide is based on Object Oriented Programming Language. Here is some details about object and class. You can easily understand about object and class.
Interfaces define methods that classes can implement. Classes implementing interfaces must define all interface methods. Interfaces can extend other interfaces, requiring implementing classes to define inherited methods as well. Interface variables are implicitly public, static, and final. A class can implement multiple interfaces and override methods with the same name across interfaces. Partial interface implementation requires the class to be abstract.
Inheritance in java is a mechanism in which one object acquires all the properties and behaviors of parent object. The idea behind inheritance in java is that you can create new classes that are built upon existing classes.
Java Training | Java Tutorial for Beginners | Java Programming | Java Certifi...Edureka!
This Edureka Java Training tutorial will help you in understanding the core fundamentals of Java. It helps you to learn following topics:
1) Introduction to Java
2) Java Timeline
3) Features of Java
4) How does Java work?
5) Data Types in Java
6) Operators in Java
7) Functions in Java
8) Object Oriented Concepts in Java
Superclasses, and Subclasses, Overriding and Hiding Methods, Polymorphism, Inheritance Hierarchies, Super keyword, Final Classes and Methods, Abstract,
Classes and Methods, Nested classes & Inner Classes,
finalization and garbage collection.
This document discusses inheritance in Java. It defines inheritance as a mechanism where a subclass inherits the properties and behaviors of its parent class. It provides an example of single inheritance in Java where class B extends class A, inheriting its attributes and methods. The document also describes different types of inheritance like multilevel inheritance where a class inherits from another subclass, and hierarchical inheritance where a parent class has multiple subclasses. It provides an example of inheritance between different animal classes to demonstrate these concepts.
This document outlines a presentation on jQuery fundamentals. The presentation introduces jQuery as a lightweight JavaScript library for DOM manipulation, event handling, Ajax, and animation. It covers jQuery syntax, selectors, DOM traversal and manipulation methods. It also discusses jQuery's event system, Ajax support, and plugins. The presentation includes demos of common jQuery tasks to demonstrate its usage and capabilities.
This document discusses principles of clean code based on the book "Clean Code" by Robert C. Martin. It provides examples of good and bad practices for naming variables and functions, structuring functions, using comments, and other topics. Key points include using meaningful names, keeping functions small and focused on a single task, avoiding deeply nested code and long argument lists, commenting to explain intent rather than state the obvious, and other guidelines for writing clean, readable code.
The document discusses clean coding practices for Java developers. It covers topics such as choosing meaningful names for variables, methods, and classes; writing code that is easy for others to understand; breaking methods down into single logical steps; and using fluent APIs to make code more readable. The presentation provides examples of clean code and ways to refactor code to follow best practices.
This document provides an overview of object-oriented programming (OOP) concepts in C#, including classes, objects, inheritance, encapsulation, and polymorphism. It defines key terms like class and object, and explains how C# supports OOP principles such as defining classes with methods and properties, extending classes through inheritance, hiding implementation through encapsulation, and allowing polymorphic behavior through function overloading and overriding. Abstract classes and sealed modifiers are also covered. The document is intended to help explain basic OOP concepts in C# to readers.
Type casting involves assigning a value of one data type to a variable of another type. There are two types of casting: widening (implicit) and narrowing (explicit). Widening casting converts data to a broader type without needing explicit casting, like converting an int to a long. Narrowing casting converts to a narrower data type and requires explicit casting, such as converting a double to a long.
This ppt gives information about:
1. OOPs Theory
2. Defining a Class
3. Creating an Object
4. The $this Attribute
5. Creating Constructors
6. Creating Destructors
An interface in Java is a blueprint of a class that defines static constants and abstract methods. Interfaces are implemented by classes where they inherit the properties and must define the body of the abstract methods. Key points are:
- Interfaces can only contain abstract methods and static constants, not method bodies.
- Classes implement interfaces to inherit the properties and must define the abstract method bodies.
- An interface can extend other interfaces and a class can implement multiple interfaces.
The document discusses strings and StringBuffers in Java. Strings are immutable sequences of characters represented by the String class. StringBuffers allow modifying character sequences and are represented by the StringBuffer class. The summary provides an overview of common string and StringBuffer operations like concatenation, extraction, comparison, and modification.
Angular - Chapter 4 - Data and Event HandlingWebStackAcademy
The document provides information about Angular data binding and event handling. It discusses how interpolation can be used to connect data from a component class to its template. It also explains how property binding and event binding allow two-way communication between the component class and template. Finally, it introduces ngModel for setting up two-way data binding between an input element and a property.
The document discusses multithreading concepts like concurrency and threading, how to create and control threads including setting priorities and states, and how to safely share resources between threads using synchronization, locks, and wait/notify methods to avoid issues like deadlocks. It also covers deprecated thread methods and increased threading support in JDK 1.5.
Java is Object Oriented Programming. Java 8 is the latest version of the Java which is used by many companies for the development in many areas. Mobile, Web, Standalone applications.
The document provides information on object-oriented programming concepts in Java including classes, objects, encapsulation, inheritance, polymorphism, and abstraction. It defines classes like Shape, Rectangle, Circle and Triangle to demonstrate these concepts. It also discusses Java data types, constructors, access modifiers, interfaces and abstract classes.
This document provides an overview of an introductory C# programming course. The course covers C# fundamentals like setting up a development environment, data types, conditionals, loops, object-oriented programming concepts, and data structures. It includes topics like installing Visual Studio, writing a "Hello World" program, built-in data types like string, integer, boolean, and more. The document also outlines sample code solutions for exercises on command line arguments, integer operations, leap year finder, and powers of two.
Numeral Systems: Positional and Non-Positional
Conversions between Positional Numeral Systems: Binary, Decimal and Hexadecimal
Representation of Numbers in Computer Memory
Exercises: Conversion between Different Numeral Systems
Defining Simple Classes
Using Own Classes and Objects
Access Modifiers
Constructors and Initializers
Defining Fields
Defining Properties, Getters and Setters
Defining Methods
Exercises: Defining and Using Own Classes
This document provides an introduction to the "Fundamentals of C# Programming" course offered by Telerik Academy. It outlines the course objectives, topics, schedule, trainers, exams, and requirements. The goal of the course is to teach fundamental computer programming concepts and skills using C# and prepare students to learn additional .NET technologies. It will cover topics like data types, operators, conditional statements, loops, arrays, methods, objects, exceptions handling, strings, classes, files and data structures over three months. Students will need to commit fully and have basic computer skills and English ability.
Trees. Defining, Creating and Traversing Trees. Traversing the File System
Binary Search Trees. Balanced Trees
Graphs and Graphs Traversal Algorithms
Exercises: Working with Trees and Graphs
The document discusses technical testing of trading systems. It outlines the key approaches to performance, stability, and operability testing. The main tasks involved are using test tools to emulate real loads and conditions, preparing test environments and load shapes based on production data, executing automated tests, and thoroughly analyzing results to validate findings. Technical testing helps validate systems' non-functional requirements around performance, stability, and handling high volumes of data and users.
Unified Modeling Language (UML), Object-Oriented Programming Concepts & Desig...Isuru Perera
Guest lecture at Informatics Institute of Technology (http://www.iit.ac.lk/) on 04th December 2015.
This lecture covered following UML 2.5 Diagrams: Use-Case, Activity, Class, Object, Sequence, State Machine.
I also showed some tools I have used: UMLet and Astah Community. Astah is the main tool I used when I was studying.
Then I focused on OOP Concepts, Software Design Principles and some Design Patterns.
I have included links to all related content in the 32nd slide.
This is how whatsapp scaled to handle a huge amount of concurrent traffic with erlang. This is extracted from - file:///home/udayakiran/Downloads/efsf2012-whatsapp-scaling.pdf
Whatsapp uses ejabberd and customized it to scale more.
WhatsApp uses an actor model architecture where each user is represented as an actor. If a user sends a message to an offline contact, the message is stored on WhatsApp servers until that contact comes online, at which point their actor will retrieve the message and deliver it. The backend is built using Erlang programming language on FreeBSD operating systems, with custom XMPP, Yaws web server, PHP, and the BEAM virtual machine. Messages are encrypted on transmission using a unique key for each user. Facebook acquired WhatsApp because of its high user engagement levels, potential to support Facebook's internet.org initiative, and because WhatsApp's efficient Erlang-based architecture could improve Facebook's own performance
The document discusses object-oriented programming concepts including inheritance, abstraction, encapsulation, and polymorphism. It covers fundamental OOP principles, defining inheritance between classes, using abstract classes and interfaces, encapsulating data within classes, and allowing polymorphism through inheritance. Specific examples are provided to demonstrate each concept.
Object oriented programming Fundamental ConceptsBharat Kalia
The document discusses four fundamental principles of object-oriented programming (OOP): inheritance, abstraction, encapsulation, and polymorphism. Inheritance allows classes to inherit attributes and behaviors from parent classes. Abstraction focuses on relevant properties and hides unnecessary details through techniques like abstract classes and interfaces. Encapsulation hides internal implementation details and exposes a public interface through properties and methods. Polymorphism enables classes to take on multiple forms through inheritance and method overriding.
Object-oriented programming uses objects and classes to organize code and data. The key principles are encapsulation, inheritance, abstraction, and polymorphism. Encapsulation hides unnecessary details within classes and provides a clear interface. Inheritance allows classes to inherit and extend functionality from parent classes. Abstraction deals with objects based on important characteristics while ignoring details. Polymorphism allows working with different objects in the same way by defining abstract behavior implementations.
Introduction to object oriented programming conceptsGanesh Karthik
OOPS concepts such as class, object, encapsulation, inheritance, polymorphism are introduced. A class is a collection of objects that defines common properties and behaviors. An object is an instance of a class. Encapsulation binds data and methods together, abstraction hides implementation details, and inheritance allows deriving new classes from existing classes. Polymorphism allows the same message to be processed in different ways. Constructors and destructors are special methods used for object initialization and cleanup.
- 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.
Inheritance allows a class to inherit properties from another class. Subclasses inherit attributes and methods from the base/parent class without redefining them. Subclasses can add their own unique attributes as well. Abstract classes provide a common definition for subclasses to share but cannot be instantiated directly. Interfaces define a contract that subclasses must implement but provide no implementation. Polymorphism allows classes to take different forms through method overloading and overriding.
C# classes allow for modularity, data encapsulation, inheritance, and polymorphism. They act as blueprints for generating object instances. The document discusses key object-oriented programming concepts in C# like encapsulation, inheritance, polymorphism, casting, exception handling, garbage collection, interfaces, collections, comparables, and delegates. It provides examples to illustrate concepts like shallow cloning using ICloneable, implementing IComparable, overloading operators, and using XML documentation comments.
Inheritance, interfaces, abstraction and polymorphism are key object-oriented programming concepts in C#. Inheritance allows a class to inherit characteristics from a parent class. Interfaces allow classes to implement common behaviors without inheritance. Abstract classes and methods define common behaviors for derived classes to implement. Polymorphism allows derived classes to override base class behaviors through method overriding.
The document discusses various object-oriented programming concepts in C#, including abstraction, encapsulation, inheritance, polymorphism, interfaces, abstract classes, virtual methods, classes, sealed classes, and provides code examples for foreach loops, switch statements, arrays, data types, boxing and unboxing, overloading and overriding, interfaces, classes vs. structures, access modifiers, abstract classes, and sealed classes.
This document discusses inheritance and polymorphism in C#. It defines inheritance as allowing a derived class to inherit characteristics from a parent class. Methods and data from the parent class can be accessed differently depending on visibility modifiers like public, private, and protected. Inheritance allows class hierarchies to be formed. Polymorphism is enabled through inheritance and overriding methods in derived classes. Examples are provided to demonstrate inheritance, overriding methods, and class hierarchies.
The document provides an overview of C++ vs C# by Shubhra Chauhan. It discusses the key object-oriented programming concepts like classes, objects, inheritance, polymorphism, and how they are implemented in C++ and C#. It includes code examples to demonstrate class usage and inheritance in both languages. The document also compares some similarities and differences between C++ and C# like support for pointers, preprocessors, structures, and goto statements.
Inheritance allows classes to inherit properties and methods from parent classes. This provides code reusability and abstraction. Polymorphism allows classes to have methods with the same name but different implementations. This includes method overloading and overriding. Encapsulation wraps data and methods into a single unit to hide internal details and secure data. Abstraction hides background details and only shows required functionality to the user. Interfaces only contain method declarations while abstract classes can contain both declarations and partial implementations.
The document provides definitions and explanations of various C# concepts including polymorphism, abstract methods, virtual methods, objects, classes, static methods, inheritance, virtual keyword, abstract classes, sealed modifiers, interfaces, pure virtual functions, access modifiers, reference types, overloading, overriding, encapsulation, arrays, array lists, hash tables, queues, stacks, early binding, late binding, sorted lists, and delegates. Key points covered include the differences between abstract and virtual methods, what defines a class versus an object, when to use static versus non-static methods, inheritance implementation in C#, and the purpose of interfaces.
This document discusses .NET classes and interfaces and principles of object-oriented programming (OOP). It covers key topics like:
- Classes model real-world objects and define attributes like properties and fields and behaviors like methods.
- Interfaces define a set of operations but do not provide implementation. Classes can implement interfaces.
- Inheritance allows child classes to inherit attributes and behaviors from a parent class. This is a fundamental principle of OOP.
- Other OOP principles like encapsulation, abstraction, and polymorphism are also discussed at a high level.
The document provides examples of defining classes with fields, properties, methods, constructors, and inheritance between classes. It explains concepts like access modifiers
CSharp presentation and software developementfrwebhelp
This document provides an overview of key concepts in C#, including similarities to Java, common C# language features, classes vs. structs, interfaces, abstract classes, and class internals like fields, properties, modifiers, and conversion operators. Some key points:
- C# and Java share similarities like all classes being objects, a similar compilation/runtime model using a virtual machine, and heap-based allocation using "new".
- C# supports common features like namespaces, classes, structs, enums, interfaces, and control statements. Classes are reference types while structs are value types.
- Interfaces define contracts without implementation, while abstract classes can contain some implementation but cannot be instantiated.
This document discusses inheritance, constructors, upcasting and downcasting, boxing and unboxing in C# classes and object-oriented programming. It explains access modifiers like public, private, and protected and how they achieve information hiding and encapsulation. Constructors are not inherited and must be explicitly defined in derived classes. Upcasting converts a derived class to a base class, while downcasting requires an explicit cast and can throw exceptions. Boxing converts value types like integers to object references, while unboxing performs the reverse conversion.
The document discusses various topics related to object-oriented programming and .NET Framework development. It introduces goals of the .NET Framework like support of industry standards, extensibility, unified programming models, and improved memory and security models. It also covers topics like assemblies, namespaces, inheritance, polymorphism, exceptions, collections, and data access using ADO.NET. The document discusses Windows Presentation Foundation (WPF) and web application development concepts like controls, data binding, templates, page and control events, and data-bound web controls.
The document discusses object-oriented programming concepts of inheritance, interfaces, and abstract classes. It defines inheritance as allowing hierarchical classifications by inheriting variables, methods, properties, and indexers from a base class. It describes different types of inheritance like single, hierarchical, multi-level, hybrid, and multiple. It then explains the differences between interfaces and abstract classes, such as interfaces defining functionality without implementation and abstract classes allowing partial implementation.
17. Java data structures trees representation and traversalIntro C# Book
In this chapter we will discuss tree data structures, like trees and graphs. The abilities of these data structures are really important for the modern programming. Each of this data structures is used for building a model of real life problems, which are efficiently solved using this model.
In this chapter we will discuss one recommended practice for efficiently solving computer programming problems and make a demonstration with appropriate examples. We will discuss the basic engineering principles of problem solving, why we should follow them when solving computer programming problems (the same principles can also be applied to find the solutions of many mathematical and scientific problems as well) and we will make an example of their use. We will describe the steps, in which we should go in order to solve some sample problems and show the mistakes that can occur when we do not follow these same steps. We will pay attention to some important steps from the methodology of problem solving, that we usually skip, e.g. the testing. We hope to be able to prove you, with proper examples, that the solving of computer programming problems has a "recipe" and it is very useful.
In this chapter we review the basic rules and recommendations for writing quality program code. We pay attention to naming the identifiers in the program (variables, methods, parameters, classes, etc.), formatting and code organization rules, good practices for composing methods, and principles for writing quality documentation.
This document discusses polymorphism, abstract classes, and abstract methods. It defines polymorphism as an object's ability to take on many forms and describes how it allows reference variables to refer to objects of child classes. It also distinguishes between method overloading and overriding, and explains the rules for each. Abstract classes are introduced as classes that cannot be instantiated directly but can be inherited from, and it is noted they may or may not contain abstract methods.
Here we are going to learn why is a good practice to use interfaces and how they are different from abstraction classes. Further more we are going to see how which one of them to use.
Encapsulation provides benefits such as reducing complexity, ensuring structural changes remain local, and allowing for validation and data binding. It works by hiding implementation details and wrapping code and data together. Objects use private fields and public getters/setters for access. Access modifiers like private, protected, and public control visibility. Validation occurs in setters through exceptions. Mutable objects can be modified after creation while immutable objects cannot. The final keyword prevents inheritance, method overriding, or variable reassignment.
Inheritance allows classes to extend and inherit properties from base classes. This creates class hierarchies where subclasses inherit and can override methods from superclasses. Inheritance promotes code reuse through extension when subclasses share the same role as the base class. Composition and delegation are alternative approaches to code reuse that may be preferable in some cases over inheritance.
The document discusses various concepts related to abstraction in software development including project architecture, code refactoring, enumerations, and the static keyword in Java. It describes how to split code into logical parts using methods and classes to improve readability, reuse code, and avoid repetition. Refactoring techniques like extracting methods and classes are presented to restructure code without changing behavior. Enumerations are covered as a way to represent numeric values from a fixed set as text. The static keyword is explained for use with classes, variables, methods, and blocks to belong to the class rather than object instances.
19. Java data structures algorithms and complexityIntro C# Book
In this chapter we will compare the data structures we have learned so far by the performance (execution speed) of the basic operations (addition, search, deletion, etc.). We will give specific tips in what situations what data structures to use.
This document discusses collections and queries in Java, including associative arrays (maps), lambda expressions, and the stream API. It provides examples of using maps like HashMap, LinkedHashMap and TreeMap to store key-value pairs. Lambda expressions are introduced as anonymous functions. The stream API is shown processing collections through methods like filter, map, sorted and collect. Examples demonstrate common tasks like finding minimum/maximum values, summing elements, and sorting lists.
In this chapter we will understand how to define custom classes and their elements. We will learn to declare fields, constructors and properties for the classes. We will revise what a method is and we will broaden our knowledge about access modifiers and methods.
In this chapter we will explore strings. We are going to explain how they are implemented in Java and in what way we can process text content. Additionally, we will go through different methods for manipulating a text: we will learn how to compare strings, how to search for substrings, how to extract substrings upon previously settled parameters and last but not least how to split a string by separator chars. We will demonstrate how to correctly build strings with the StringBuilder class. We will provide a short but very useful information for the most commonly used regular expressions.
In this chapter we will discuss exceptions in the object-oriented programming and in Java in particular. We will learn how to handle exceptions using the try-catch construct, how to pass them to the calling methods and how to throw standard or our own exceptions using the throw construct.
Here we are going to take a look how to use for loop, foreach loop and while loop. Also we are going to learn how to use and invoke methods and how to define classes in Java programming language.
This document provides an overview of Java collections basics, including arrays, lists, strings, sets, and maps. It defines each type of collection and provides examples of how to use them. Arrays allow storing fixed-length sequences of elements and can be accessed by index. Lists are like resizable arrays that allow adding, removing and inserting elements using the ArrayList class. Strings represent character sequences and provide various methods for manipulation and comparison. Sets store unique elements using HashSet or TreeSet. Maps store key-value pairs using HashMap or TreeMap.
03 and 04 .Operators, Expressions, working with the console and conditional s...Intro C# Book
The document discusses Java syntax and concepts including:
1. It introduces primitive data types in Java like int, float, boolean and String.
2. It covers variables, operators, and expressions - how they are used to store and manipulate data in Java.
3. It explains console input and output using Scanner and System.out methods for reading user input and printing output.
4. It provides examples of using conditional statements like if and if-else to control program flow based on conditions.
In this chapter we will get familiar with primitive types and variables in Java – what they are and how to work with them. First we will consider the data types – integer types, real types with floating-point, Boolean, character, string and object type. We will continue with the variables, with their characteristics, how to declare them, how they are assigned a value and what is variable initialization.
6th Power Grid Model Meetup
Join the Power Grid Model community for an exciting day of sharing experiences, learning from each other, planning, and collaborating.
This hybrid in-person/online event will include a full day agenda, with the opportunity to socialize afterwards for in-person attendees.
If you have a hackathon proposal, tell us when you register!
About 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.
GDG Cloud Southlake #43: Tommy Todd: The Quantum Apocalypse: A Looming Threat...James Anderson
The Quantum Apocalypse: A Looming Threat & The Need for Post-Quantum Encryption
We explore the imminent risks posed by quantum computing to modern encryption standards and the urgent need for post-quantum cryptography (PQC).
Bio: With 30 years in cybersecurity, including as a CISO, Tommy is a strategic leader driving security transformation, risk management, and program maturity. He has led high-performing teams, shaped industry policies, and advised organizations on complex cyber, compliance, and data protection challenges.
Adtran’s SDG 9000 Series brings high-performance, cloud-managed Wi-Fi 7 to homes, businesses and public spaces. Built on a unified SmartOS platform, the portfolio includes outdoor access points, ceiling-mount APs and a 10G PoE router. Intellifi and Mosaic One simplify deployment, deliver AI-driven insights and unlock powerful new revenue streams for service providers.
Co-Constructing Explanations for AI Systems using ProvenancePaul Groth
Explanation is not a one off - it's a process where people and systems work together to gain understanding. This idea of co-constructing explanations or explanation by exploration is powerful way to frame the problem of explanation. In this talk, I discuss our first experiments with this approach for explaining complex AI systems by using provenance. Importantly, I discuss the difficulty of evaluation and discuss some of our first approaches to evaluating these systems at scale. Finally, I touch on the importance of explanation to the comprehensive evaluation of AI systems.
Neural representations have shown the potential to accelerate ray casting in a conventional ray-tracing-based rendering pipeline. We introduce a novel approach called Locally-Subdivided Neural Intersection Function (LSNIF) that replaces bottom-level BVHs used as traditional geometric representations with a neural network. Our method introduces a sparse hash grid encoding scheme incorporating geometry voxelization, a scene-agnostic training data collection, and a tailored loss function. It enables the network to output not only visibility but also hit-point information and material indices. LSNIF can be trained offline for a single object, allowing us to use LSNIF as a replacement for its corresponding BVH. With these designs, the network can handle hit-point queries from any arbitrary viewpoint, supporting all types of rays in the rendering pipeline. We demonstrate that LSNIF can render a variety of scenes, including real-world scenes designed for other path tracers, while achieving a memory footprint reduction of up to 106.2x compared to a compressed BVH.
https://arxiv.org/abs/2504.21627
Multistream in SIP and NoSIP @ OpenSIPS Summit 2025Lorenzo Miniero
Slides for my "Multistream support in the Janus SIP and NoSIP plugins" presentation at the OpenSIPS Summit 2025 event.
They describe my efforts refactoring the Janus SIP and NoSIP plugins to allow for the gatewaying of an arbitrary number of audio/video streams per call (thus breaking the current 1-audio/1-video limitation), plus some additional considerations on what this could mean when dealing with application protocols negotiated via SIP as well.
Protecting Your Sensitive Data with Microsoft Purview - IRMS 2025Nikki Chapple
Session | Protecting Your Sensitive Data with Microsoft Purview: Practical Information Protection and DLP Strategies
Presenter | Nikki Chapple (MVP| Principal Cloud Architect CloudWay) & Ryan John Murphy (Microsoft)
Event | IRMS Conference 2025
Format | Birmingham UK
Date | 18-20 May 2025
In this closing keynote session from the IRMS Conference 2025, Nikki Chapple and Ryan John Murphy deliver a compelling and practical guide to data protection, compliance, and information governance using Microsoft Purview. As organizations generate over 2 billion pieces of content daily in Microsoft 365, the need for robust data classification, sensitivity labeling, and Data Loss Prevention (DLP) has never been more urgent.
This session addresses the growing challenge of managing unstructured data, with 73% of sensitive content remaining undiscovered and unclassified. Using a mountaineering metaphor, the speakers introduce the “Secure by Default” blueprint—a four-phase maturity model designed to help organizations scale their data security journey with confidence, clarity, and control.
🔐 Key Topics and Microsoft 365 Security Features Covered:
Microsoft Purview Information Protection and DLP
Sensitivity labels, auto-labeling, and adaptive protection
Data discovery, classification, and content labeling
DLP for both labeled and unlabeled content
SharePoint Advanced Management for workspace governance
Microsoft 365 compliance center best practices
Real-world case study: reducing 42 sensitivity labels to 4 parent labels
Empowering users through training, change management, and adoption strategies
🧭 The Secure by Default Path – Microsoft Purview Maturity Model:
Foundational – Apply default sensitivity labels at content creation; train users to manage exceptions; implement DLP for labeled content.
Managed – Focus on crown jewel data; use client-side auto-labeling; apply DLP to unlabeled content; enable adaptive protection.
Optimized – Auto-label historical content; simulate and test policies; use advanced classifiers to identify sensitive data at scale.
Strategic – Conduct operational reviews; identify new labeling scenarios; implement workspace governance using SharePoint Advanced Management.
🎒 Top Takeaways for Information Management Professionals:
Start secure. Stay protected. Expand with purpose.
Simplify your sensitivity label taxonomy for better adoption.
Train your users—they are your first line of defense.
Don’t wait for perfection—start small and iterate fast.
Align your data protection strategy with business goals and regulatory requirements.
💡 Who Should Watch This Presentation?
This session is ideal for compliance officers, IT administrators, records managers, data protection officers (DPOs), security architects, and Microsoft 365 governance leads. Whether you're in the public sector, financial services, healthcare, or education.
🔗 Read the blog: https://nikkichapple.com/irms-conference-2025/
Evaluation Challenges in Using Generative AI for Science & Technical ContentPaul Groth
Evaluation Challenges in Using Generative AI for Science & Technical Content.
Foundation Models show impressive results in a wide-range of tasks on scientific and legal content from information extraction to question answering and even literature synthesis. However, standard evaluation approaches (e.g. comparing to ground truth) often don't seem to work. Qualitatively the results look great but quantitive scores do not align with these observations. In this talk, I discuss the challenges we've face in our lab in evaluation. I then outline potential routes forward.
Securiport is a border security systems provider with a progressive team approach to its task. The company acknowledges the importance of specialized skills in creating the latest in innovative security tech. The company has offices throughout the world to serve clients, and its employees speak more than twenty languages at the Washington D.C. headquarters alone.
European Accessibility Act & Integrated Accessibility TestingJulia Undeutsch
Emma Dawson will guide you through two important topics in this session.
Firstly, she will prepare you for the European Accessibility Act (EAA), which comes into effect on 28 June 2025, and show you how development teams can prepare for it.
In the second part of the webinar, Emma Dawson will explore with you various integrated testing methods and tools that will help you improve accessibility during the development cycle, such as Linters, Storybook, Playwright, just to name a few.
Focus: European Accessibility Act, Integrated Testing tools and methods (e.g. Linters, Storybook, Playwright)
Target audience: Everyone, Developers, Testers
Create Your First AI Agent with UiPath Agent BuilderDianaGray10
Join us for an exciting virtual event where you'll learn how to create your first AI Agent using UiPath Agent Builder. This session will cover everything you need to know about what an agent is and how easy it is to create one using the powerful AI-driven UiPath platform. You'll also discover the steps to successfully publish your AI agent. This is a wonderful opportunity for beginners and enthusiasts to gain hands-on insights and kickstart their journey in AI-powered automation.
nnual (33 years) study of the Israeli Enterprise / public IT market. Covering sections on Israeli Economy, IT trends 2026-28, several surveys (AI, CDOs, OCIO, CTO, staffing cyber, operations and infra) plus rankings of 760 vendors on 160 markets (market sizes and trends) and comparison of products according to support and market penetration.
Droidal: AI Agents Revolutionizing HealthcareDroidal LLC
Droidal’s AI Agents are transforming healthcare by bringing intelligence, speed, and efficiency to key areas such as Revenue Cycle Management (RCM), clinical operations, and patient engagement. Built specifically for the needs of U.S. hospitals and clinics, Droidal's solutions are designed to improve outcomes and reduce administrative burden.
Through simple visuals and clear examples, the presentation explains how AI Agents can support medical coding, streamline claims processing, manage denials, ensure compliance, and enhance communication between providers and patients. By integrating seamlessly with existing systems, these agents act as digital coworkers that deliver faster reimbursements, reduce errors, and enable teams to focus more on patient care.
Droidal's AI technology is more than just automation — it's a shift toward intelligent healthcare operations that are scalable, secure, and cost-effective. The presentation also offers insights into future developments in AI-driven healthcare, including how continuous learning and agent autonomy will redefine daily workflows.
Whether you're a healthcare administrator, a tech leader, or a provider looking for smarter solutions, this presentation offers a compelling overview of how Droidal’s AI Agents can help your organization achieve operational excellence and better patient outcomes.
A free demo trial is available for those interested in experiencing Droidal’s AI Agents firsthand. Our team will walk you through a live demo tailored to your specific workflows, helping you understand the immediate value and long-term impact of adopting AI in your healthcare environment.
To request a free trial or learn more:
https://droidal.com/
4. Fundamental Principles of OOP Inheritance Inherit members from parent class Abstraction Define and execute abstract actions Encapsulation Hide the internals of a class Polymorphism Access a class through its parent interface
6. Classes and Interfaces Classes define attributes and behavior Fields, properties, methods, etc. Methods contain code for execution Interfaces define a set of operations Empty methods and properties, left to be implemented later public class Labyrinth { … } public interface IFigure { … }
7. Inheritance Inheritance allows child classes inherits the characteristics of existing parent class Attributes (fields and properties) Operations (methods) Child class can extend the parent class Add new fields and methods Redefine methods (modify existing behavior) A class can implement an interface by providing implementation for all its methods
8. Inheritance terminology derived class base class / parent class inherits derived interface base interface implements class interface implements
9. Inheritance – Benefits Inheritance has a lot of benefits Extensibility Reusability Provides abstraction Eliminates redundant code Use inheritance for buidling is-a relationships E.g. dog is-a animal (dogs are kind of animals) Don't use it to build has-a relationship E.g. dog has-a name (dog is not kind of name)
10. Inheritance – Example Person +Name: String +Address: String Employee +Company: String +Salary: double Student +School: String Base class Derived class Derived class
11. Class Hierarchies Inheritance leads to a hierarchy of classes and/or interfaces in an application: … Game MultiplePlayersGame BoardGame Chess Backgammon SinglePlayerGame Minesweeper Solitaire …
12. Inheritance in .NET A class can inherit only one base class E.g. IOException derives from SystemException and it derives from Exception A class can implement several interfaces This is .NET’s form of multiple inheritance E.g. List<T> implements IList<T> , ICollection<T> , IEnumerable<T> An interface can implement several interfaces E.g. IList<T> implements ICollection<T> and IEnumerable<T>
13. How to Define Inheritance ? We must specify the name of the base class after the name of the derived In the constructor of the derived class we use the keyword base to invoke the constructor of the base class public class Shape {...} public class Circle : Shape {...} public Circle (int x, int y) : base(x) {...}
14. Simple Inheritance Example public class Mammal { public int Age { get; set; } public Mammal(int age) { this.Age = age; } public void Sleep() { Console.WriteLine("Shhh! I'm sleeping!"); } }
15. Simple Inheritance Example (2) public class Dog : Mammal { public string Breed { get; set; } public Dog(int age, string breed) : base(age) { this.Breed = breed; } public void WagTail() { Console.WriteLine("Tail wagging..."); } }
17. Accessibility Levels Access modifiers in C# public – access is not restricted private – access is restricted to the containing type protected – access is limited to the containing type and types derived from it internal – access is limited to the current assembly protected internal – access is limited to the current assembly or types derived from the containing class
18. Inheritance and Accessibility class Creature { protected string Name { get; private set; } private void Talk() { Console.WriteLine("I am creature ..."); } protected void Walk() { Console.WriteLine("Walking ..."); } } class Mammal : Creature { // base.Talk() can be invoked here // this.Name can be read but cannot be modified here }
19. Inheritance and Accessibility (2) class Dog : Mammal { public string Breed { get; private set; } // base.Talk() cannot be invoked here (it is private) } class InheritanceAndAccessibility { static void Main() { Dog joe = new Dog(6, "Labrador"); Console.WriteLine(joe.Breed); // joe.Walk() is protected and can not be invoked // joe.Talk() is private and can not be invoked // joe.Name = "Rex"; // Name cannot be accessed here // joe.Breed = "Shih Tzu"; // Can't modify Breed } }
21. Inheritance: I mportant A spect s Structures cannot be inherited In C# there is no multiple inheritance Only multiple interfaces can be implemented Instance and static constructors are not inherited Inheritance is transitive relation If C is derived from B, and B is derived from A, then C inherits A as well
22. Inheritance: Important Features A derived class extends its base class It can add new members but cannot remove derived ones Declaring new members with the same name or signature hides the inherited ones A class can declare virtual methods and properties Derived classes can override the implementation of these members E.g. Object.Equals() is virtual method
24. Abstraction Abstraction means ignoring irrelevant features, properties, or functions and emphasizing the relevant ones ... ... relevant to the given project (with an eye to future reuse in similar projects) Abstraction = managing complexity "Relevant" to what?
25. Abstraction (2) Abstraction is something we do every day Looking at an object, we see those things about it that have meaning to us We abstract the properties of the object, and keep only what we need E.g. students get "name" but not "color of eyes" Allows us to represent a complex reality in terms of a simplified model Abstraction highlights the properties of an entity that we need and hides the others
26. In .NET abstraction is achieved in several ways: Abstract classes Interfaces Inheritance Abstraction in .NET +Color : long ButtonBase +click() Control Button RadioButton CheckBox
27. Abstraction in .NET – Example System.Object System.MarshalByRefObject System.ComponentModel.Component System.Windows.Forms.Control System.Windows.Forms.ButtonBase System.Windows.Forms.Button
28. Interfaces in C# An interface is a set of operations (methods) that given object can perform Also called "contract" for supplying a set of operations Defines abstract behavior Interfaces provide abstractions You shouldn't have to know anything about what is in the implementation in order to use it
29. Abstract Classes in C# Abstract classes are special classes defined with the keyword abstract Mix between class and interface Partially implemented or fully unimplemented Not implemented methods are declared abstract and are left empty Cannot be instantiated Child classes should implement abstract methods or declare them as abstract
30. Abstract Data Types Abstract Data Types (ADT) are data types defined by a set of operations (interface) Example: LinkedList<T> +Add(item : Object) +Remove(item : Object) +Clear() … «interface» IList<T> List<T>
31. Inheritance Hierarchies Using inheritance we can create inheritance hierarchies Easily represented by UML class diagrams UML class diagrams Classes are represented by rectangles containing their methods and data Relations between classes are shown as arrows Closed triangle arrow means inheritance Other arrows mean some kind of associations
32. UML Class Diagram – Example Shape #Position:Point struct Point +X:int +Y:int +Point interface ISurfaceCalculatable +CalculateSurface:float Rectangle -Width:float -Height:float +Rectangle +CalculateSurface:float Square -Size:float +Square +CalculateSurface:float FilledSquare -Color:Color +FilledSquare struct Color +RedValue:byte +GreenValue:byte +BlueValue:byte +Color FilledRectangle -Color:Color +FilledRectangle
35. Encapsulation Encapsulation hides the implementation details Class announces some operations (methods) available for its clients – its public interface All data members (fields) of a class should be hidden Accessed via properties (read-only and read-write) No interface members should be hidden
36. Encapsulation – Example Data fields are private Constructors and accessors are defined (getters and setters) Person -name : string -age : TimeSpan +Person(string name, int age) +Name : string { get; set; } +Age : TimeSpan { get; set; }
37. Encapsulation in .NET Fields are always declared private Accessed through properties in read-only or read-write mode Constructors are almost always declared public Interface methods are always public Not explicitly declared with public Non-interface methods are declared private / protected
38. Encapsulation – Benefits Ensures that structural changes remain local: Changing the class internals does not affect any code outside of the class Changing methods' implementation does not reflect the clients using them Encapsulation allows adding some logic when accessing client's data E.g. validation on modifying a property value Hiding implementation details reduces complexity easier maintenance
40. Polymorphism Polymorphism = ability to take more than one form (objects have more than one type) A class can be used through its parent interface A child class may override some of the behaviors of the parent class Polymorphism allows abstract operations to be defined and used Abstract operations are defined in the base class' interface and implemented in the child classes Declared as abstract or virtual
41. Polymorphism (2) Why handle an object of given type as object of its base type? To invoke abstract operations To mix different related types in the same collection E.g. List<object> can hold anything To pass more specific object to a method that expects a parameter of a more generic type To declare a more generic field which will be initialized and "specialized" later
42. Virtual M ethod s Virtual method is method that can be used in the same way on instances of base and derived classes but its implementation is different A method is said to be a virtual when it is declared as virtual Methods that are declared as virtual in a base class can be overridden using the keyword override in the derived class public virtual void CalculateSurface()
43. The override Modifier Using override we can modify a method or property An override method provides a new implementation of a member inherited from a base class You cannot override a non-virtual or static method The overridden base method must be virtual, abstract, or override
44. Polymorphism – How it Works? Polymorphism ensures that the appropriate method of the subclass is called through its base class' interface Polymorphism is implemented using a technique called late method binding Exact method to be called is determined at runtime , just before performing the call Applied for all abstract / virtual methods Note: Late binding is slower than normal (early) binding
45. Polymorphism – Example override CalcSurface() { return size * size; } override CalcSurface() { return PI * radius * raduis; } Abstract class Abstract action Concrete class Overriden action Overriden action Figure +CalcSurface() : double Square -x : int -y : int -size : int Circle -x : int -y : int -radius: int
46. Polymorphism – Example (2) abstract class Figure { public abstract double CalcSurface(); } abstract class Square { public override double CalcSurface() { return … } } Figure f1 = new Square(...); Figure f2 = new Circle(...); // This will call Square.CalcSurface() int surface = f1.CalcSurface(); // This will call Square.CalcSurface() int surface = f2.CalcSurface();
49. Real World Example: Calculator Creating an application like the Windows Calculator Typical scenario for applying the object-oriented approach
50. Real World Example: Calculator (2) The calculator consists of controls: Buttons, panels, text boxes, menus, check boxes, radio buttons, etc. Class Control – the root of our OO hierarchy All controls can be painted on the screen Should implement an interface IPaintable with a method Paint() Common properties: location, size, text, face color, font, background color, etc.
51. Real World Example: Calculator (3) Some controls could contain other (nested) controls inside (e. g. panels and toolbars) We should have class Container that extends Control holding a collection of child controls The Calculator itself is a Form Form is a special kind of Container Contains also border, title ( text derived from Control ), icon and system buttons How the Calculator paints itself? Invokes Paint() for all child controls inside it
52. Real World Example: Calculator (4) How a Container paints itself? Invokes Paint() for all controls inside it Each control knows how to visualize itself What is the common between buttons, check boxes and radio buttons? Can be pressed Can be selected We can define class AbstractButton and all buttons can derive from it
55. Cohesion Cohesion describes how closely all the routines in a class or all the code in a routine support a central purpose Cohesion must be strong Well-defined abstractions keep cohesion strong Classes must contain strongly related functionality and aim for single purpose Cohesion is a useful tool for managing complexity
56. Good and Bad Cohesion Good: hard disk, cdrom, floppy BAD: spaghetti code
58. Bad Cohesion Bad cohesion example Class Magic that has these methods: Another example: public void PrintDocument(Document d); public void SendEmail( string recipient, string subject, string text); public void CalculateDistanceBetweenPoints( int x1, int y1, int x2, int y2) MagicClass.MakePizza("Fat Pepperoni"); MagicClass.WithdrawMoney("999e6"); MagicClass.OpenDBConnection();
59. Coupling Coupling describes how tightly a class or routine is related to other classes or routines Coupling must be kept loose Modules must depend little on each other All classes and routines must have small, direct, visible, and flexible relations to other classes and routines One module must be easily used by other modules
60. Loose and Tight Coupling Loose Coupling: Easily replace old HDD Easily place this HDD to another motherboard Tight Coupling: Where is the video adapter? Can you change the video controller?
61. Loose Coupling – Example class Report { public bool LoadFromFile(string fileName) {…} public bool SaveToFile(string fileName) {…} } class Printer { public static int Print(Report report) {…} } class Program { static void Main() { Report myReport = new Report(); myReport.LoadFromFile("C:\\DailyReport.rep"); Printer.Print(myReport); } }
62. Tight Coupling – Example class MathParams { public static double operand; public static double result; } class MathUtil { public static void Sqrt() { MathParams.result = CalcSqrt(MathParams.operand); } } class MainClass { static void Main() { MathParams.operand = 64; MathUtil.Sqrt(); Console.WriteLine(MathParams.result); } }
63. Spaghetti Code Combination of bad cohesion and tight coupling: class Report { public void Print() {…} public void InitPrinter() {…} public void LoadPrinterDriver(string fileName) {…} public bool SaveReport(string fileName) {…} public void SetPrinter(string printer) {…} } class Printer { public void SetFileName() {…} public static bool LoadReport() {…} public static bool CheckReport() {…} }
64. Summary OOP fundamental principals are: inheritance, encapsulation, abstraction, polymorphism Inheritance allows inheriting members form another class Abstraction and encapsulation hide internal data and allow working through abstract interface Polymorphism allows working with objects through their parent interface and invoke abstract actions Strong cohesion and loose coupling avoid spaghetti code
66. Exercises We are given a school. In the school there are classes of students. Each class has a set of teachers. Each teacher teaches a set of disciplines. Students have name and unique class number. Classes have unique text identifier. Teachers have name. Disciplines have name, number of lectures and number of exercises. Both teachers and students are people. Your task is to identify the classes (in terms of OOP) and their attributes and operations, define the class hierarchy and create a class diagram with Visual Studio.
67. Exercises (2) Define class Human with first name and last name. Define new class Student which is derived from Human and has new field – grade . Define class Worker derived from Human with new field weekSalary and work-hours per day and method MoneyPerHour () that returns money earned by hour by the worker. Define the proper constructors and properties for this hierarchy. Initialize an array of 10 students and sort them by grade in ascending order. Initialize an array of 10 workers and sort them by money per hour in descending order.
68. Exercises (3) Define abstract class Shape with only one virtual method CalculateSurface() and fields width and height . Define two new classes Triangle and Rectangle that implement the virtual method and return the surface of the figure (height*width for rectangle and height*width/2 for triangle). Define class Circle and suitable constructor so that on initialization height must be kept equal to width and implement the CalculateSurface() method. Write a program that tests the behavior of the CalculateSurface( ) method for different shapes ( Circle , Rectangle , Triangle ) stored in an array.
69. Exercises (4) Create a hierarchy Dog , Frog , Cat , Kitten , Tomcat and define suitable constructors and methods according to the following rules: all of this are Animals. Kittens and tomcats are cats. All animals are described by age, name and sex. Kittens can be only female and tomcats can be only male. Each animal produce a sound. Create arrays of different kinds of animals and calculate the average age of each kind of animal using static methods. Create static method in the animal class that identifies the animal by its sound.
70. Exercises (5) A bank holds different types of accounts for its customers: deposit accounts, loan accounts and mortgage accounts. Customers could be individuals or companies. All accounts have customer, balance and interest rate (monthly based). Deposit accounts are allowed to deposit and with draw money. Loan and mortgage accounts can only deposit money.
71. Exercises (6) All accounts can calculate their interest amount for a given period (in months). In the common case its is calculated as follows: number_of_months * interest_rate. Loan accounts have no interest for the first 3 months if are held by individuals and for the first 2 months if are held by a company. Deposit accounts have no interest if their balance is positive and less than 1000. Mortgage accounts have ½ interest for the first 12 months for companies and no interest for the first 6 months for individuals.
72. Exercises (7) Your task is to write a program to model the bank system by classes and interfaces. You should identify the classes, interfaces, base classes and abstract actions and implement the calculation of the interest functionality.
Editor's Notes
#2: (c) 2005 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.(c) 2006 National Academy for Software Development - http://academy.devbg.org* ## * 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
#4: (c) 2005 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.(c) 2006 National Academy for Software Development - http://academy.devbg.org* ## * 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
#6: (c) 2005 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.(c) 2006 National Academy for Software Development - http://academy.devbg.org* ## * 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
#10: (c) 2005 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.(c) 2006 National Academy for Software Development - http://academy.devbg.org* ## Extensibility / Polymorphism: New functionality may be easily plugged in without changing existing classes as long the new plug-in classes extend given base classes. Reusability: For a set of similar applications a framework can be defined using a core set of classes that are to be extended by classes that fill in the application-dependent part. Information Hiding: If a more general class using a simpler contract is sufficient, details from extending classes may be hidden to some of the client classes. This allows them to be more independent from possible changes and diminishes the load of contracts that must be understood by a reader of these client classes. * 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
#24: (c) 2005 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.(c) 2006 National Academy for Software Development - http://academy.devbg.org* ## * 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
#35: (c) 2005 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.(c) 2006 National Academy for Software Development - http://academy.devbg.org* ## * 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
#40: (c) 2005 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.(c) 2006 National Academy for Software Development - http://academy.devbg.org* ## * 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
#48: (c) 2005 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.(c) 2006 National Academy for Software Development - http://academy.devbg.org* ## * 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
#49: (c) 2005 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.(c) 2006 National Academy for Software Development - http://academy.devbg.org* ## * 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##