This document discusses abstract data types (ADTs) and their implementation in various programming languages. It covers the key concepts of ADTs including data abstraction, encapsulation, information hiding, and defining the public interface separately from the private implementation. It provides examples of ADTs implemented using modules in Modula-2, packages in Ada, classes in C++, generics in Java and C#, and classes in Ruby. Parameterized and encapsulation constructs are also discussed as techniques for implementing and organizing ADTs.
This document discusses the key concepts of object-oriented programming including abstraction, encapsulation, classes and objects. It defines abstraction as focusing on the essential characteristics of an object and hiding unnecessary details. Encapsulation hides the implementation of an object within a class. A class defines both the data and operations of an object through its interface and implementation. Objects are instantiations of classes that come to life through constructors and die through destructors, ensuring proper initialization and resource cleanup.
The document discusses abstract data types and their implementation in various programming languages. It covers the concepts of abstraction, encapsulation, and information hiding. Some key points include:
- Abstract data types define a user-created data type that encapsulates its representation and allows access only through specified operations. This hides implementation details and allows flexible changes.
- Many languages support abstract data types through mechanisms like modules/packages that group related code and types, and specify public interfaces separately from private implementations.
- Languages discussed include Simula 67, Ada, C++, and Java, and how each supports defining and using abstract data types through features like packages, classes, visibility modifiers, and generics.
1. The document discusses separating a class interface from its implementation by defining the class in a header file and defining member functions in a source code file.
2. It shows a Time class defined in the time1.h header file and member functions defined in the time1.cpp source file.
3. A driver program includes the header file, creates a Time object, and calls member functions to demonstrate the separation of interface and implementation.
1. A structure is a collection of variables under a single name. Variables within a structure can be of different data types like int, float, etc.
2. To declare a structure, the keyword struct is used followed by the structure name in braces. To define a structure variable, the data type is the structure name followed by the variable name.
3. Structure members are accessed using the dot operator between the structure variable name and member name.
The document discusses key concepts in C++ classes including encapsulation, information hiding, access specifiers, and constructors. It defines a class as a way to combine attributes and behaviors of real-world objects into a single unit. A class uses encapsulation to associate code and data, and information hiding to secure data from direct access. Access specifiers like public, private, and protected determine member visibility. Constructors are special member functions that initialize objects upon instantiation.
The document discusses object-oriented programming and class-based design. It explains that object-oriented programming focuses on modeling real-world objects as software objects with both data fields (attributes) and methods to operate on that data. A class defines a blueprint for objects, describing their attributes and methods. Objects are instances of classes that package both data and behaviors together. The document outlines key concepts like encapsulation, inheritance, polymorphism, and UML class diagrams.
Object oriented programming concepts such as abstraction, encapsulation, inheritance and polymorphism are supported in .NET languages like C# and Visual Basic. Encapsulation groups related properties and methods into a single object. Inheritance allows new classes to be created from an existing class. Polymorphism allows multiple classes to be used interchangeably even if they implement properties or methods differently.
The document discusses several key concepts in Visual Basic.NET including language fundamentals like statements, functions, and subroutines. It also covers forms, components, events, controls like buttons, text boxes, labels, timers, and picture boxes. The document discusses reserved words in VB.NET, data types, variables, operators, and guidelines for declaring variables.
This document discusses the key concepts of object-oriented programming including abstraction, encapsulation, classes and objects. It defines abstraction as focusing on the essential characteristics of an object and hiding unnecessary details. Encapsulation hides the implementation of an object within a class. A class defines both the data and operations of an object through its interface and implementation. Objects are instantiations of classes that come to life through constructors and die through destructors, ensuring proper initialization and resource cleanup.
The document discusses abstract data types and their implementation in various programming languages. It covers the concepts of abstraction, encapsulation, and information hiding. Some key points include:
- Abstract data types define a user-created data type that encapsulates its representation and allows access only through specified operations. This hides implementation details and allows flexible changes.
- Many languages support abstract data types through mechanisms like modules/packages that group related code and types, and specify public interfaces separately from private implementations.
- Languages discussed include Simula 67, Ada, C++, and Java, and how each supports defining and using abstract data types through features like packages, classes, visibility modifiers, and generics.
1. The document discusses separating a class interface from its implementation by defining the class in a header file and defining member functions in a source code file.
2. It shows a Time class defined in the time1.h header file and member functions defined in the time1.cpp source file.
3. A driver program includes the header file, creates a Time object, and calls member functions to demonstrate the separation of interface and implementation.
1. A structure is a collection of variables under a single name. Variables within a structure can be of different data types like int, float, etc.
2. To declare a structure, the keyword struct is used followed by the structure name in braces. To define a structure variable, the data type is the structure name followed by the variable name.
3. Structure members are accessed using the dot operator between the structure variable name and member name.
The document discusses key concepts in C++ classes including encapsulation, information hiding, access specifiers, and constructors. It defines a class as a way to combine attributes and behaviors of real-world objects into a single unit. A class uses encapsulation to associate code and data, and information hiding to secure data from direct access. Access specifiers like public, private, and protected determine member visibility. Constructors are special member functions that initialize objects upon instantiation.
The document discusses object-oriented programming and class-based design. It explains that object-oriented programming focuses on modeling real-world objects as software objects with both data fields (attributes) and methods to operate on that data. A class defines a blueprint for objects, describing their attributes and methods. Objects are instances of classes that package both data and behaviors together. The document outlines key concepts like encapsulation, inheritance, polymorphism, and UML class diagrams.
Object oriented programming concepts such as abstraction, encapsulation, inheritance and polymorphism are supported in .NET languages like C# and Visual Basic. Encapsulation groups related properties and methods into a single object. Inheritance allows new classes to be created from an existing class. Polymorphism allows multiple classes to be used interchangeably even if they implement properties or methods differently.
The document discusses several key concepts in Visual Basic.NET including language fundamentals like statements, functions, and subroutines. It also covers forms, components, events, controls like buttons, text boxes, labels, timers, and picture boxes. The document discusses reserved words in VB.NET, data types, variables, operators, and guidelines for declaring variables.
VHDL is a hardware description language used to model electronic systems. A VHDL design unit consists of an entity declaration defining inputs and outputs, and one or more architecture bodies implementing the design. Architectures can model designs at different levels of abstraction such as behavioral, dataflow, or structural. Packages allow reusable code to be organized and shared between designs through declarations and bodies.
Data abstraction and object orientationHoang Nguyen
This document discusses object-oriented programming concepts like abstraction, encapsulation, inheritance, and polymorphism. It provides historical context on the development of these concepts over time in languages like Simula67, Smalltalk, C++, Java, and others. Key aspects covered include data abstraction, abstract data types, classes, inheritance hierarchies, visibility rules, constructors and destructors, virtual functions, and multiple inheritance.
Object-oriented programming uses abstraction and encapsulation through abstract data types (ADTs). An ADT defines a data type and its interface independently of its implementation. This allows information hiding and modular program design. Common languages like C++, Java, and Ruby support ADTs through classes or modules, which package data with methods, support inheritance and polymorphism, and provide visibility control through private/public access specifiers. Parameterized ADTs allow a data type to work with different element types. Namespaces and packages provide separate scopes to avoid naming conflicts.
This document provides an introduction to Entity-Relationship (ER) data modeling. It describes the basic concepts of entities, attributes, relationships, and keys. It explains how ER diagrams can be used to graphically represent these concepts and the structure of a database. The document also covers entity types, relationship types, participation constraints, mapping cardinalities, weak entities, and how to represent these concepts in an ER diagram.
This document discusses file handling in C++. It introduces three classes - ofstream, ifstream, and fstream - that allow performing output and input of characters to and from files. The ofstream class is used to write to files, ifstream is used to read from files, and fstream can both read and write. The open() method is used to open a file, specifying the file name and optional file mode. Writing to a file uses the << operator and reading uses the >> operator. Operator overloading allows user-defined types like classes to define the meaning of operators like + when used on their objects.
The document discusses classes and objects in object-oriented programming. It defines what a class is, how classes are declared with public and private members, and how objects are instantiated from classes. It also describes defining member functions inside and outside of classes, and the use of static class members and friend functions.
Object-oriented programming focuses on data. An object is a basic run-time entity. A class is also known as a user-defined data type. Inheritance provides the idea of reusability. Objects can communicate with each other through message passing. Polymorphism is achieved through operator overloading and function overloading.
C++ is an object-oriented programming language that is an incremented version of C with classes added. Some key differences between C and C++ are that C++ uses object-oriented programming with classes that can contain both data and functions, while C focuses more on procedures/functions and allows any function to access data. The document then discusses the basic concepts of object-oriented programming in C++ including classes, objects, polymorphism, inheritance, encapsulation, and data abstraction. It provides examples of classes, objects, reference variables, default arguments, and dynamic memory allocation in C++.
The document discusses C structures. It defines a structure as a user-defined data type that allows combining different data types under a single name. Structures are used to represent records, with examples given of book and employee records. It then covers defining and creating structure variables, accessing structure members, arrays of structures, and passing structures to functions by value and by reference.
The document discusses key concepts of object-oriented programming in C++ including classes, objects, access modifiers, inheritance, polymorphism, and function overloading. It provides examples of defining classes with data members and member functions, as well as inheriting from base classes and overriding methods in derived classes. The document is intended as an introduction to important OOP concepts in C++.
1. The document discusses different ways of creating custom data types in C++, including classes, structures, unions, enumerations, and typedef. Structures are collections of variables that can be referenced under one name.
2. Technically, there is no difference between a structure and a class in C++ - structures are classes with members that are public by default, while classes have private members by default.
3. Structures allow logically related elements to be treated as a single unit, for example to store student information. Arrays can contain elements of a structure type.
In this article we will learn classes and objects in C# programming.
Till now in the past two articles we have seen all the labs which was using functional programming. From now in coming all the articles we will do the programming using classes and objects. As this is professional approach of doing the programming. With classes and objects approach, code it reduces code reading complexity and it improves readability and also offers re-usability.
The document discusses key concepts in object-oriented programming including classes, objects, data encapsulation, inheritance, and polymorphism. It defines a class as a blueprint for objects that describes their properties and behaviors. An object is an instance of a class. Classes contain data members and member functions. Data hiding is achieved through declaring data members as private while member functions can be public or private. The document also discusses constructors, destructors, operator overloading, inheritance and polymorphism.
The document discusses the different primitive and reference data types in Java, including their sizes, value ranges, and default values. It explains that variables are reserved memory locations used to store values and that reference variables are used to access objects of a specific class. The key Java primitive data types are byte, short, int, long, float, double, boolean, and char, each with their own characteristics for storing integer, floating point, boolean, or character values.
This document discusses generics and collections in .NET. It introduces generics as a way to write reusable code for different data types. Generic methods and classes are covered, allowing a single definition to work with multiple types. The document also discusses collection classes like ArrayList, HashTable, Stack and Queue, which provide common data structures. It notes the benefits of generic collections over non-generic ones in terms of type safety and efficiency.
Abstract data types (ADTs) define a data type in terms of its possible values and operations, independent of implementation details. An ADT consists of a logical form defining the data items and operations, and a physical form comprising the data structures and algorithms that implement it. Simple data types like integers and characters are ADTs with basic storage structures like memory locations and operations implemented by hardware/software. More complex ADTs require user-defined data structures to organize data in memory or files along with subroutines implementing each operation.
Collections fornece classes para estruturas de dados como listas, conjuntos e mapas. Listas mantêm uma ordem e permitem elementos duplicados. Conjuntos não permitem duplicados e não garantem ordem. Mapas mapeiam chaves para valores.
This document provides concepts to memorize for the Oracle Certificate Associate Java 7 exam. It includes summaries of topics like default constructors, legal vs illegal class declarations, interfaces, methods, numbers, floating point numbers, boxing and unboxing, literals, operators, strings, arrays, collections, loops, and common mistakes. The document is from a personal note and is not an official Java course, but rather concepts to commit to memory for the exam. It cites three books as references for additional study material.
The document contains 4 code snippets demonstrating different ways to take input in Java programs:
1) Using command line arguments and the args array to print a greeting with a passed in name
2) Swapping two integers entered from the keyboard using only two variables
3) Reading input from the keyboard using InputStreamReader and BufferedReader classes
4) Taking input using the Scanner class to read an integer, string, and double from console input
VHDL is a hardware description language used to model electronic systems. A VHDL design unit consists of an entity declaration defining inputs and outputs, and one or more architecture bodies implementing the design. Architectures can model designs at different levels of abstraction such as behavioral, dataflow, or structural. Packages allow reusable code to be organized and shared between designs through declarations and bodies.
Data abstraction and object orientationHoang Nguyen
This document discusses object-oriented programming concepts like abstraction, encapsulation, inheritance, and polymorphism. It provides historical context on the development of these concepts over time in languages like Simula67, Smalltalk, C++, Java, and others. Key aspects covered include data abstraction, abstract data types, classes, inheritance hierarchies, visibility rules, constructors and destructors, virtual functions, and multiple inheritance.
Object-oriented programming uses abstraction and encapsulation through abstract data types (ADTs). An ADT defines a data type and its interface independently of its implementation. This allows information hiding and modular program design. Common languages like C++, Java, and Ruby support ADTs through classes or modules, which package data with methods, support inheritance and polymorphism, and provide visibility control through private/public access specifiers. Parameterized ADTs allow a data type to work with different element types. Namespaces and packages provide separate scopes to avoid naming conflicts.
This document provides an introduction to Entity-Relationship (ER) data modeling. It describes the basic concepts of entities, attributes, relationships, and keys. It explains how ER diagrams can be used to graphically represent these concepts and the structure of a database. The document also covers entity types, relationship types, participation constraints, mapping cardinalities, weak entities, and how to represent these concepts in an ER diagram.
This document discusses file handling in C++. It introduces three classes - ofstream, ifstream, and fstream - that allow performing output and input of characters to and from files. The ofstream class is used to write to files, ifstream is used to read from files, and fstream can both read and write. The open() method is used to open a file, specifying the file name and optional file mode. Writing to a file uses the << operator and reading uses the >> operator. Operator overloading allows user-defined types like classes to define the meaning of operators like + when used on their objects.
The document discusses classes and objects in object-oriented programming. It defines what a class is, how classes are declared with public and private members, and how objects are instantiated from classes. It also describes defining member functions inside and outside of classes, and the use of static class members and friend functions.
Object-oriented programming focuses on data. An object is a basic run-time entity. A class is also known as a user-defined data type. Inheritance provides the idea of reusability. Objects can communicate with each other through message passing. Polymorphism is achieved through operator overloading and function overloading.
C++ is an object-oriented programming language that is an incremented version of C with classes added. Some key differences between C and C++ are that C++ uses object-oriented programming with classes that can contain both data and functions, while C focuses more on procedures/functions and allows any function to access data. The document then discusses the basic concepts of object-oriented programming in C++ including classes, objects, polymorphism, inheritance, encapsulation, and data abstraction. It provides examples of classes, objects, reference variables, default arguments, and dynamic memory allocation in C++.
The document discusses C structures. It defines a structure as a user-defined data type that allows combining different data types under a single name. Structures are used to represent records, with examples given of book and employee records. It then covers defining and creating structure variables, accessing structure members, arrays of structures, and passing structures to functions by value and by reference.
The document discusses key concepts of object-oriented programming in C++ including classes, objects, access modifiers, inheritance, polymorphism, and function overloading. It provides examples of defining classes with data members and member functions, as well as inheriting from base classes and overriding methods in derived classes. The document is intended as an introduction to important OOP concepts in C++.
1. The document discusses different ways of creating custom data types in C++, including classes, structures, unions, enumerations, and typedef. Structures are collections of variables that can be referenced under one name.
2. Technically, there is no difference between a structure and a class in C++ - structures are classes with members that are public by default, while classes have private members by default.
3. Structures allow logically related elements to be treated as a single unit, for example to store student information. Arrays can contain elements of a structure type.
In this article we will learn classes and objects in C# programming.
Till now in the past two articles we have seen all the labs which was using functional programming. From now in coming all the articles we will do the programming using classes and objects. As this is professional approach of doing the programming. With classes and objects approach, code it reduces code reading complexity and it improves readability and also offers re-usability.
The document discusses key concepts in object-oriented programming including classes, objects, data encapsulation, inheritance, and polymorphism. It defines a class as a blueprint for objects that describes their properties and behaviors. An object is an instance of a class. Classes contain data members and member functions. Data hiding is achieved through declaring data members as private while member functions can be public or private. The document also discusses constructors, destructors, operator overloading, inheritance and polymorphism.
The document discusses the different primitive and reference data types in Java, including their sizes, value ranges, and default values. It explains that variables are reserved memory locations used to store values and that reference variables are used to access objects of a specific class. The key Java primitive data types are byte, short, int, long, float, double, boolean, and char, each with their own characteristics for storing integer, floating point, boolean, or character values.
This document discusses generics and collections in .NET. It introduces generics as a way to write reusable code for different data types. Generic methods and classes are covered, allowing a single definition to work with multiple types. The document also discusses collection classes like ArrayList, HashTable, Stack and Queue, which provide common data structures. It notes the benefits of generic collections over non-generic ones in terms of type safety and efficiency.
Abstract data types (ADTs) define a data type in terms of its possible values and operations, independent of implementation details. An ADT consists of a logical form defining the data items and operations, and a physical form comprising the data structures and algorithms that implement it. Simple data types like integers and characters are ADTs with basic storage structures like memory locations and operations implemented by hardware/software. More complex ADTs require user-defined data structures to organize data in memory or files along with subroutines implementing each operation.
Collections fornece classes para estruturas de dados como listas, conjuntos e mapas. Listas mantêm uma ordem e permitem elementos duplicados. Conjuntos não permitem duplicados e não garantem ordem. Mapas mapeiam chaves para valores.
This document provides concepts to memorize for the Oracle Certificate Associate Java 7 exam. It includes summaries of topics like default constructors, legal vs illegal class declarations, interfaces, methods, numbers, floating point numbers, boxing and unboxing, literals, operators, strings, arrays, collections, loops, and common mistakes. The document is from a personal note and is not an official Java course, but rather concepts to commit to memory for the exam. It cites three books as references for additional study material.
The document contains 4 code snippets demonstrating different ways to take input in Java programs:
1) Using command line arguments and the args array to print a greeting with a passed in name
2) Swapping two integers entered from the keyboard using only two variables
3) Reading input from the keyboard using InputStreamReader and BufferedReader classes
4) Taking input using the Scanner class to read an integer, string, and double from console input
The Java Collections Framework provides a unified architecture for representing and manipulating collections of objects. The framework includes collection interfaces like Set, List, Queue, and Map that define common operations on collections. It also includes general-purpose implementations of these interfaces like HashSet, ArrayList, LinkedList, HashMap, and TreeMap that are backed by common data structures like arrays, linked lists, and trees. The framework aims to allow collections to be manipulated independently of their specific representation.
The document contains code snippets from 3 weekly coding assignments:
1) A Java program to check if a string is a palindrome. It compares characters at the beginning and end of the string.
2) A Java program to sort a list of names in ascending order using string comparison and swapping.
3) A Java program to count the frequency of words in a given text by tokenizing, sorting, and printing the words.
The Java Collections Framework provides interfaces and implementations for commonly used data structures like lists, sets, maps and queues. The core interfaces like Collection, List, Set, Queue and Map define the common operations for each type of data structure. General purpose implementations provided for these interfaces include ArrayList, LinkedList, HashSet, TreeSet, HashMap and TreeMap. Additional wrapper and convenience implementations add functionality like synchronization or provide optimized versions for specific use cases.
This document provides an overview of Java collections including common implementations like lists, maps, and queues. It discusses how collections allow storing and accessing multiple objects, the benefits of generics for type safety, and useful methods in the Collections class for sorting, shuffling, and copying collections. Code examples are provided for creating parameterized lists and maps, sorting lists using Comparator, and exercises for working with collections in practice.
This Presentation is the intro. to java programming.
This presentation contain the basics of Java with example in simple language.
This presentation clear your all concept about programming in java and then you can easily make programs in java.
This document provides an introduction to Java programming concepts such as data types, variables, operators, input/output, control flow, methods, and classes. It explains what computer science and programming are, gives examples of basic Java programs using print statements, and discusses programming fundamentals like program structure, naming conventions, comments, and static methods. Methods are introduced as a way to organize code and eliminate redundancy. Overall, the document orients the reader to fundamental Java programming concepts.
Abstract data types (ADTs) specify operations on data without defining implementation. Common ADTs include sets, lists, stacks, queues, maps, trees and graphs. Sets contain unique elements; lists are ordered; stacks use last-in first-out access; queues use first-in first-out access; maps store key-value pairs; trees link parent nodes to children; and graphs link vertices with edges. Core operations for collections include adding, removing and accessing elements.
This document provides biographies and credentials for several Java experts: Branko Mihaljević, Tihomir Smuđ, and Aleksander Radovan. It also discusses Java certification pathways including Oracle Certified Associate (OCA), Oracle Certified Professional (OCP), Oracle Certified Expert (OCE), and Oracle Certified Master (OCM) certifications. Details are given on certification exams, objectives, prerequisites, and example questions. Overall the document serves as an introduction to Java certification for developers.
The document provides code examples for several basic Java programs, including:
1) A program that compares two numbers and prints which is greater.
2) A program that takes a number as input and prints all even numbers between 1 and the input.
3) Programs that calculate the area and perimeter of shapes like circles and rectangles.
4) Programs that calculate the factorial of a number and construct a triangle shape using asterisks.
5) A program that finds and lists all leap years between two given years.
TOPS Technologies Leading IT Training Institute offer training in Php, .Net, Java, iPhone, Android, Software testing and SEO. By TOPS Technologies. http://www.tops-int.com
This document provides an overview of the Java Collections Framework. It begins by explaining key concepts like sets, maps, and collections from a mathematical perspective. It then details the six main interfaces of the Collections Framework - List, Set, Queue, Deque, Map and SortedMap. The document provides examples of different collection implementations and discusses how to apply sorting and searching algorithms to collections. It also covers using thread-safe and immutable collections. Overall, the document gives a comprehensive introduction to the Collections Framework in Java.
The document discusses different ways to implement threading in Java programs. It provides code examples to demonstrate creating threads by extending the Thread class and implementing the Runnable interface. The code examples show printing output from both the main thread and child threads to illustrate threading concepts. Socket programming and RMI examples are also provided with code to implement client-server applications using threads.
This document discusses abstract data types (ADTs) and their implementation in various programming languages. The key points are:
- ADTs define both a data structure and the operations that can manipulate it, hiding implementation details.
- Languages provide mechanisms for encapsulation (grouping related code) and information hiding to support ADTs. These include modules, packages, classes and templates.
- Examples show how stacks can be defined as ADTs in languages like Ada, C++, Java and C#, using their respective encapsulation features.
- ADTs can be parameterized to make the data type and size variable, implemented via generics in Ada, C++, Java and C#.
it describes the main concepts of object oriented programming
For more posts : http://comsciguide.blogspot.com/
For full playlist of Interview puzzles videos : https://www.youtube.com/playlist?list=PL3v9ipJOEEPfI4zt4ExamGJwndkvg0SFc
24 standard interview puzzles: https://www.youtube.com/playlist?list=PL3v9ipJOEEPefIF4nscYOobim1iRBJTjw
Aptitude training playlist link : https://www.youtube.com/playlist?list=PL3v9ipJOEEPfumKHa02HWjCfPvGQiPZiG
for C and C++ questions, that are asked in the interviews, go through the posts in the link : http://comsciguide.blogspot.com/
for more videos, my youtube channel : https://www.youtube.com/channel/UCvMy2V7gYW7VR2WgyvLj3-A
The document outlines the syllabus for the II Year / III Semester 20IT302 - C++ AND DATA STRUCTURES course. It covers 5 units - (1) Object Oriented Programming Fundamentals, (2) Object Oriented Programming Concepts, (3) C++ Programming Advanced Features, (4) Advanced Non-Linear Data Structures, and (5) Graphs. Some key concepts covered include classes, objects, encapsulation, inheritance, polymorphism, templates, containers, iterators, trees, and graph algorithms.
This chapter provides a brief overview of some core aspects of the C# programming language, including namespaces, classes, attributes, interfaces, enums, structs, and methods. It explains how namespaces organize related classes and avoid name collisions. It describes the structure of classes, their members, modifiers, and inheritance. It also covers attributes, interfaces, enums, structs, and how methods can be defined as virtual or overridden.
The document discusses the benefits of object-oriented programming (OOP). It states that OOP offers several benefits to programmers and users, including greater productivity, higher quality software, and lower maintenance costs. It then lists 25 specific advantages of OOP such as code reusability through inheritance, modularity through pre-defined classes, data hiding for security, and easier mapping of real-world problems to code.
The document provides an overview of developing iOS applications including the required language (Objective-C), frameworks (Cocoa Touch), tools, and development process. It discusses setting up a Mac development environment, learning Objective-C syntax and concepts like classes, methods, properties, protocols, and the iOS application layers including Cocoa Touch.
C++ classes and objects are the central feature that supports object-oriented programming in C++. A class defines a blueprint for a data type, and classes can inherit members from base classes, allowing code reuse. Polymorphism means a function call will cause different code to execute depending on the object type. Abstraction and encapsulation bind data and functions together and hide implementation details. C++ supports exception handling, dynamic memory allocation using new/delete, and file input/output streams.
This document provides an overview of the C programming language. It discusses the basics of C programming including data types, variables, constants, keywords, operators, input/output statements, decision-making statements, and looping statements. It also covers basic C program structure, storage classes, and introduces different programming paradigms like procedural, structured, object-oriented and monolithic programming.
Python uses modules, packages, and libraries to organize code. A module is a .py file containing functions, classes, and variables. Related modules are grouped into packages, which are directories containing an __init__.py file. Libraries are collections of packages that provide specific functionality. The Python standard library includes common modules like math and random. Modules can be imported and used to reuse code in other files or packages.
This document provides an introduction to C++ and covers 10 topics: 1) Object-oriented programming principles, 2) Classes and objects, 3) Functions, 4) Constructors and destructors, 5) Operator overloading and type conversion, 6) Inheritance, 7) Pointers, virtual functions and polymorphism, 8) Working with files, 9) Templates, and 10) Exception handling. Each topic is briefly described in 1-2 paragraphs with examples provided for some concepts like encapsulation, inheritance, polymorphism, and exception handling. The document serves as a high-level overview of key C++ concepts and features.
The document discusses several programming paradigms including structured programming, procedural programming, abstract data types (ADTs), and object-oriented programming (OOP). It provides details on key concepts for each paradigm such as encapsulation, inheritance, and polymorphism. C++ and C# are presented as examples of languages that support the OOP paradigm.
This document provides release notes and supplementary information for Delphi 7. It notes that some components have been deprecated and recommends newer alternatives. It also describes changes made to string handling functions, warnings added by the compiler, and issues fixed in streaming of subcomponents. Finally, it provides notes on various other topics like Apache, UDDI, Windows XP input, and databases.
(4) c sharp introduction_object_orientation_part_iNico Ludwig
This document provides an introduction to object-oriented programming concepts in C#, including:
- Simulating reality through modeling real-world entities as classes with data fields and behavior methods.
- Relationships between classes like aggregation ("has-a") and generalization ("is-a") hierarchies.
- Defining classes with fields to represent an object's state, and methods to represent its behavior.
- Inheritance and specialization, where derived classes extend base classes while maintaining the substitution principle.
- Other concepts like encapsulation, properties, and class diagrams using UML notation.
The document discusses building Odoo modules. It outlines module structure, the manifest file, and XML usage. Key points include:
- Modules are split into separate directories for models, views, controllers, and more.
- The manifest file declares a module and specifies metadata. It configures installation settings.
- XML data files populate the database using <record> elements and follow naming conventions.
- Views define how records are displayed. Common types are tree, form, and search views composed of fields.
This document discusses object-oriented programming (OOP) concepts like classes, objects, inheritance, encapsulation, abstraction, and polymorphism in C++. It provides examples of how each concept is implemented in C++. It explains that classes are user-defined data types that contain data fields and methods. Objects are instances of classes. Inheritance allows classes to inherit attributes from other classes. Encapsulation binds data to the methods that operate on it. Abstraction hides unnecessary details and displays only essential information. Polymorphism allows one message to have multiple implementations.
The document discusses object-oriented programming concepts in C++ including classes, objects, encapsulation, inheritance, polymorphism, and more. It provides examples of class definitions and accessing class members. Key points covered include:
- Classes are templates that define objects, while objects are instances of classes.
- Encapsulation involves wrapping data and functions together in a class. Inheritance allows classes to acquire properties from other classes.
- Polymorphism allows a method to perform different actions based on parameters. Message passing involves communication between objects.
- Structured programming divides a program into functions and data, while object-oriented programming divides it into objects that contain data and functions.
Here is the Cuboid class with private instance variables, public volume() method, setter and getter methods as specified in the question:
public class Cuboid {
private double length;
private double breadth;
private double height;
public double volume() {
return length * breadth * height;
}
public boolean setLength(double len) {
if(len > 0) {
this.length = len;
return true;
}
return false;
}
public boolean setBreadth(double bre) {
if(bre > 0) {
this.breadth = bre;
return true;
}
return false;
}
public boolean setHeight(double hei
The document discusses object-oriented programming and C++. It begins with an introduction to OOP compared to procedural programming. Key concepts of OOP like classes, objects, inheritance and polymorphism are explained. The document then discusses C++ programming, including the structure of C++ programs, basic input/output functions, data types in C++, variables and constants. Pointers in C++ and how computer memory works with pointers are also summarized.
This document discusses object-oriented programming concepts in Objective-C such as classes, inheritance, polymorphism, and exceptions. It covers creating interface and implementation files, using properties and methods, inheritance hierarchies with subclasses, overriding methods, abstract classes, polymorphism through dynamic binding, and exceptions. Key topics include creating .h and .m files to define a class, using self to reference the current object, returning objects from methods, and extending classes through inheritance while allowing method overriding.
This document discusses Easyrec, an open source recommender engine that provides recommendations based on user actions like views, purchases, and ratings of products. It has an API that allows integrating recommendations into a website by passing a user ID and token. The API can take in user data and return recommendations based on what other similar users viewed, purchased, or rated highly. While Easyrec is easy to use, it has limitations in flexibility and only supports collaborative filtering recommendations.
This document outlines an agenda to introduce REST and building APIs with ASP.NET Web API. It begins with a quick demo, then discusses what REST is as an architectural style based on HTTP using resources and verbs. It covers HTTP concepts like requests, responses and status codes. Finally, it demonstrates building a REST API with ASP.NET Web API and discusses advantages of REST like using the well-defined HTTP protocol and enabling caching.
This document provides an overview of APIs, including what they are, why they are useful, common data formats like JSON and XML, RESTful API design principles, and how to consume and create APIs. It discusses API concepts like resources, HTTP verbs, caching, authentication, and error handling. It also provides examples of consuming APIs with tools like Postman and creating a simple API in Node.js.
This document discusses caching and the SMRR mechanism introduced by Intel to prevent cache poisoning attacks on SMRAM. It explains that:
1) Memory caching types like write-back can allow data in CPU caches to be modified without writing to physical memory.
2) Early researchers exploited this to poison SMRAM caches and gain unauthorized access to protected memory.
3) Intel addressed this with the System Management Range Register (SMRR) that defines a restricted memory range for SMRAM and prevents caching of that memory when not in SMM.
Optimizing shared caches in chip multiprocessorsHoang Nguyen
Chip multiprocessors, which place multiple processors on a single chip, have become common in modern processors. There are various approaches to managing caches in chip multiprocessors, including private caches for each processor core or shared caches that all cores can access. The optimal approach balances factors like minimizing traffic between cores, avoiding duplication of cached data, and reducing latency.
This document discusses how Analysis Services caching works and provides strategies for warming the Storage Engine cache and Formula Engine cache. It explains that the Storage Engine handles data retrieval from disk while the Formula Engine determines which data is needed for queries. Caching can improve performance but requires understanding when Analysis Services is unable to cache data. The document recommends using the CREATE CACHE statement and running regular queries to pre-populate the caches with commonly used data. Memory usage must also be considered when warming the caches.
The document proposes optimizing DRAM caches for latency rather than hit rate. It summarizes previous work on DRAM caches like Loh-Hill Cache that treated DRAM cache similarly to SRAM cache. This led to high latency and low bandwidth utilization.
The document introduces the Alloy Cache design which avoids tag serialization and keeps tags and data in the same DRAM row for lower latency. It also proposes a Memory Access Predictor to selectively use parallel or serial access models for the lowest latency. Simulation results show Alloy Cache with a predictor outperforms previous designs like SRAM-Tags. The design achieves most of the potential latency benefits with a simple approach.
The document discusses non-uniform cache architectures (NUCA), cache coherence, and different implementations of directories in multicore systems. It describes NUCA designs that map data to banks based on distance from the controller to exploit non-uniform access times. Cache coherence is maintained using directory-based protocols that track copies of cache blocks. Directories can be implemented off-chip in DRAM or on-chip using duplicate tag stores or distributing the directory among cache banks. Examples of systems like SGI Origin2000 and Tilera Tile64 that use these techniques are also outlined.
The document discusses memory hierarchy and caching techniques. It begins by explaining the need for a memory hierarchy due to differing access times of memory technologies like SRAM, DRAM, and disk. It then covers concepts like cache hits, misses, block size, direct mapping, set associativity, compulsory misses, capacity misses, and conflict misses. Finally, it discusses using a second-level cache to reduce memory access times by capturing misses from the first-level cache.
This document provides an introduction to Python programming for astronomers. It discusses:
- Setting up the Python environment and selecting the correct version (2.6/2.7 vs 3.x)
- Why Python is popular for astronomy (free, packages like CASA are in Python)
- Getting started with Python scripts and the Python interpreter
- Important syntax aspects like indentation, importing modules, and creating functions
- Examples of useful Python modules for astronomy like NumPy, SciPy, Matplotlib, and Astropy
This document provides an introduction to the Python language and discusses Python data types. It covers how to install Python, interact with the Python interpreter through command line and IDLE modes, and learn basic Python parts like data types, operators, functions, and control structures. The document discusses numeric, string, and other data types in Python and how to manipulate them using built-in functions and operators. It also introduces Python library modules and the arcpy package for geoprocessing in ArcGIS.
A program is a sequence of instructions that are run by the processor. To run a program, it must be compiled into binary code and given to the operating system. The OS then gives the code to the processor to execute. Functions allow code to be reused by defining operations and optionally returning values. Strings are sequences of characters that can be manipulated using indexes and methods. Common string methods include upper() and concatenation using +.
This document provides an agenda and notes for a programming lecture. The lecture covers sample problems, hash functions and dictionaries, simulating a car, functions as arguments, checking Fermat's Last Theorem, cumulative sums, estimating e and pi through Taylor expansions, finding words with triple double letters, PyGame for game development, and developing a single-player and two-player car game in PyGame. The document includes code examples and references to further resources.
Python is a multi-paradigm programming language that is object-oriented, imperative and functional. It is dynamically typed, with support for complex data types like lists and strings. Python code is commonly written and executed using the interactive development environment IDLE.
1. Burp extensions can overcome web application hurdles through the Burp API. Interfaces like IMessageEditorTab and ITab allow creating new views of requests and responses, while processHTTPMessage and doPassiveScan can automate tasks by catching and rewriting traffic.
2. Examples include decoding custom encodings, signing requests, viewing unique response headers, and passively scanning for encoded values in cookies. Common problems are solved with minimal Python coding against the Burp API.
The document provides information on three programming languages: COBOL, LISP, and Python. COBOL was released in 1959 and was used for 80% of business transactions due to its reliability. LISP was the second high-level language created in 1958 and introduced innovations like garbage collection and recursion using linked lists. Python was developed in the 1990s and prioritizes readability through features like whitespace and a simple grammar.
Object-oriented analysis and design (OOAD) emphasizes investigating requirements rather than solutions, and conceptual solutions that fulfill requirements rather than implementations. OOAD focuses on identifying domain concepts and defining software objects and how they collaborate. The unified process model includes inception, elaboration, construction, and transition phases with iterations and milestones leading to final product releases. Main OO concepts are encapsulation, abstraction, inheritance, and polymorphism.
The document discusses the key elements of the object model, including abstraction, encapsulation, modularity, and hierarchy. It explains that abstraction is one of the fundamental ways to cope with complexity in software design. Abstraction focuses on the essential characteristics of an object that distinguish it from other objects, from the perspective of the viewer. The object model provides a conceptual framework for object-oriented programming that is based on these elements.
The document discusses abstract data types (ADTs), specifically queues. It defines a queue as a linear collection where elements are added to one end and removed from the other end, following a first-in, first-out (FIFO) approach. The key queue operations are enqueue, which adds an element, and dequeue, which removes the element that has been in the queue longest. Queues can be implemented using arrays or linked lists.
The document discusses abstract data types (ADTs) and their implementation in C++. It describes how ADTs use encapsulation, inheritance and polymorphism to separate a data structure from its implementation. This allows operations on a data type to be defined independently of how its data is stored. The document also covers how C++ classes can be used to implement ADTs by bundling related data and functions into objects that hide their underlying representations. Exceptions are discussed as a mechanism for handling errors during program execution.
In the rapidly evolving landscape of technologies, XML continues to play a vital role in structuring, storing, and transporting data across diverse systems. The recent advancements in artificial intelligence (AI) present new methodologies for enhancing XML development workflows, introducing efficiency, automation, and intelligent capabilities. This presentation will outline the scope and perspective of utilizing AI in XML development. The potential benefits and the possible pitfalls will be highlighted, providing a balanced view of the subject.
We will explore the capabilities of AI in understanding XML markup languages and autonomously creating structured XML content. Additionally, we will examine the capacity of AI to enrich plain text with appropriate XML markup. Practical examples and methodological guidelines will be provided to elucidate how AI can be effectively prompted to interpret and generate accurate XML markup.
Further emphasis will be placed on the role of AI in developing XSLT, or schemas such as XSD and Schematron. We will address the techniques and strategies adopted to create prompts for generating code, explaining code, or refactoring the code, and the results achieved.
The discussion will extend to how AI can be used to transform XML content. In particular, the focus will be on the use of AI XPath extension functions in XSLT, Schematron, Schematron Quick Fixes, or for XML content refactoring.
The presentation aims to deliver a comprehensive overview of AI usage in XML development, providing attendees with the necessary knowledge to make informed decisions. Whether you’re at the early stages of adopting AI or considering integrating it in advanced XML development, this presentation will cover all levels of expertise.
By highlighting the potential advantages and challenges of integrating AI with XML development tools and languages, the presentation seeks to inspire thoughtful conversation around the future of XML development. We’ll not only delve into the technical aspects of AI-powered XML development but also discuss practical implications and possible future directions.
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceIndexBug
Imagine a world where machines not only perform tasks but also learn, adapt, and make decisions. This is the promise of Artificial Intelligence (AI), a technology that's not just enhancing our lives but revolutionizing entire industries.
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.
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
Your One-Stop Shop for Python Success: Top 10 US Python Development Providersakankshawande
Simplify your search for a reliable Python development partner! This list presents the top 10 trusted US providers offering comprehensive Python development services, ensuring your project's success from conception to completion.
Skybuffer SAM4U tool for SAP license adoptionTatiana Kojar
Manage and optimize your license adoption and consumption with SAM4U, an SAP free customer software asset management tool.
SAM4U, an SAP complimentary software asset management tool for customers, delivers a detailed and well-structured overview of license inventory and usage with a user-friendly interface. We offer a hosted, cost-effective, and performance-optimized SAM4U setup in the Skybuffer Cloud environment. You retain ownership of the system and data, while we manage the ABAP 7.58 infrastructure, ensuring fixed Total Cost of Ownership (TCO) and exceptional services through the SAP Fiori interface.
Project Management Semester Long Project - Acuityjpupo2018
Acuity is an innovative learning app designed to transform the way you engage with knowledge. Powered by AI technology, Acuity takes complex topics and distills them into concise, interactive summaries that are easy to read & understand. Whether you're exploring the depths of quantum mechanics or seeking insight into historical events, Acuity provides the key information you need without the burden of lengthy texts.
Have you ever been confused by the myriad of choices offered by AWS for hosting a website or an API?
Lambda, Elastic Beanstalk, Lightsail, Amplify, S3 (and more!) can each host websites + APIs. But which one should we choose?
Which one is cheapest? Which one is fastest? Which one will scale to meet our needs?
Join me in this session as we dive into each AWS hosting service to determine which one is best for your scenario and explain why!
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
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!
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.
Fueling AI with Great Data with Airbyte WebinarZilliz
This talk will focus on how to collect data from a variety of sources, leveraging this data for RAG and other GenAI use cases, and finally charting your course to productionalization.
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
Generating privacy-protected synthetic data using Secludy and MilvusZilliz
During this demo, the founders of Secludy will demonstrate how their system utilizes Milvus to store and manipulate embeddings for generating privacy-protected synthetic data. Their approach not only maintains the confidentiality of the original data but also enhances the utility and scalability of LLMs under privacy constraints. Attendees, including machine learning engineers, data scientists, and data managers, will witness first-hand how Secludy's integration with Milvus empowers organizations to harness the power of LLMs securely and efficiently.
Programming Foundation Models with DSPy - Meetup SlidesZilliz
Prompting language models is hard, while programming language models is easy. In this talk, I will discuss the state-of-the-art framework DSPy for programming foundation models with its powerful optimizers and runtime constraint system.
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.
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Abstract data types
1. Abstract Data Types
• Data abstraction, or abstract data types, is a programming
methodology where one defines not only the data
structure to be used, but the processes to manipulate the
structure
– like process abstraction, ADTs can be supported directly by
programming languages
• To support it, there needs to be mechanisms for
– defining data structures
– encapsulation of data structures and their routines to manipulate
the structures into one unit
• by placing all definitions in one unit, it can be compiled at one time
– information hiding to protect the data structure from outside
interference or manipulation
• the data structure should only be accessible from code encapsulated with
it so that the structure is hidden and protected from the outside
• objects are one way to implement ADTs, but because objects have
additional properties, we defer discussion of them until the next chapter
2. ADT Design Issues
• Encapsulation: it must be possible to define a unit that
contains a data structure and the subprograms that
access (manipulate) it
– design issues:
• will ADT access be restricted through pointers?
• can ADTs be parameterized (size and/or type)?
• Information hiding: controlling access to the data
structure through some form of interface so that it
cannot be directly manipulated by external code
– this is often done by using two sections of an ADT definition
• public part (interface) constitutes those elements that can be accessed
externally (often the interface permits only access to subprograms and
constants)
• the private part, which remains secure because it is only accessible by
subprograms of the ADT itself
3. Modula-2 ADTs
• Unit for encapsulation called a module
– modules can be combined to form libraries of ADTs
• To define a module:
– definition module: the interface containing a partial or
complete type definition (data structure) and the subprogram
headers and parameters
– implementation module: the portion of the data structure that
is to be hidden, along with all operation subprograms
• If the complete type declaration is given in the definition
module, the type is “transparent” otherwise it is
“opaque”
– opaque types represent true ADTs and must be accessed
through pointers
• this restriction allows the ADT to be entirely hidden from user
programs since the user program need only define a pointer
4. ADTs in Ada
• The encapsulation construct is the package
• Packages consist of two parts:
– specification package (the public or interface part)
– body package (the hidden or private part)
• The two packages can be compiled separately
– but only if specification package is compiled first
• The specification package must include details of the data
structure itself
– to preserve information hiding, the data structure’s definition can follow
the word private denoting that the following is hidden
• Ada offers three forms of ADTs
– those without information hiding, and thus are not true ADTs
– those that preserve information hiding by specifying that the data structure
is private
– those that specify that the data structure is limited private
• all ADTs have built-in operations for assignment and equality except for
limited private ADTs which have no built-in operations at all
5. Example Part I
package Stack_Pack is
type Stack_Type is limited private;
Max_Size : constant := 100;
function Empty(Stk : in Stack_Type) return Boolean;
procedure Push(Stk : in out Stack_Type; Element : in Integer);
procedure Pop(Stk : in out Stack_Type);
function Top(Stk : in Stack_Type) return Integer;
private
type List_Type is array (1..Max_Size) of Integer;
type Stack_Type is
record
List : List_Type;
Topsub : Integer range 0..Max_Size := 0;
end record;
end Stack_Pack;
The specification package
for a stack ADT – see the next
slide for the body package
The actual ADT
definition must either
appear in the open
section (e.g., the public
part) or in the private
section
An alternative implementation to this approach is to
define a pointer in the private section of this package and
define the actual Stack_Type ADT in the body package.
This is discussed in more detail in the notes section of this
slide.
6. Example Part II
with Ada.Text_IO; use Ada.Text_IO;
package body Stack_Pack is
function Empty(Stk : in Stack_Type) return Boolean is
begin
return Stk.Topsub = 0;
end Empty;
procedure Push(Stk : in out Stack_Type; Element : in Integer) is
begin
if Stk.Topsub >= Max_Size then
Put_Line(“ERROR – Stack overflow”);
else
Stk.Topsub := Stk.Topsub +1; Stk.List(Topsub):=Element;
end if;
end Push;
procedure Pop(Stk : in out Stack_Type) is
begin … end Pop;
function Top(Stk : in Stack_Type) return Integer is
begin … end Top;
end Stack_Pack;
The rest of the implementation
can be found on page 481
7. C++ ADTs
• C++ offers two mechanisms for building data structures:
the struct and the class
– because the struct does not have a mechanism for information
hiding, it can only offer encapsulation, so for a true ADT, we
must use C++s object
– C++ classes contain both visible (public) and hidden (private)
components (as well as protected)
– C++ instances can be static, heap-dynamic and stack-dynamic
• the lifetime of an instance ends when it reaches the end of the scope of
where it was declared
• a stack-dynamic object may have heap-dynamic data so that parts of the
object may continue even though the instant is deallocated
– we defer most of our discussion of objects in C++ to the next
chapter, but we will see an example next
8. C++ Example
#include <iostream.h>
class stack {
private:
int *stackPtr;
int max;
int topPtr;
public:
stack( ) { // constructor
stackPtr = new int [100];
max = 99;
topPtr = -1;
}
~stack( ) {delete [ ] stackPtr;} // destructor
void push(int number) {…} // details omitted
void pop( ) {…}
int top( ) {…}
int empty( ) {…}
Unlike the Ada example, in C++, the
entire definition is encapsulated in one
location
Information hiding is preserved through
the use of a private part with the interface
being defined in the public part
Any methods that are to be defined in this
class but not accessible outside of the
class would also be defined in the private
section
9. Java, C# and Ruby ADTs
• All three languages support ADTs through classes
– Java permits no stand-alone functions, only methods defined
in class definitions and unlike C++, referenced through
reference variables (pointers), therefore, in Java, every data
structure is an ADT
• it is up to the programmer as to whether information hiding is enforced
or not
– C# borrows from both C++ and Java but primarily from Java,
where all objects are heap dynamic, modifiers are private,
public, protected, but C# also offers
• internal and protected internal modifiers which are used for assemblies
(cross-platform objects), and methods that can serve as both accessors
and mutators (see the example on page 500-501)
– Ruby requires that all class variables be private, and all
methods default to being public (but the programmer can
change this)
• class variables do not have to be explicitly declared in Ruby, see the
example on page 502-04
• we look at Ruby in more detail in chapter 12
10. Parameterized ADTs
• The ability to define an ADT
where the type and/or size is
specified generically so that a
specific version can be
generated later
– a stack defined without
specifying the element type
(integer vs. string vs. float, etc)
– a stack defined without a
restriction on the size of the stack
– Ada, C++, Java and C# all have
this capability
• The approach is to replace the
type definition with a place
holder that is filled in later
In ADA:
generic
Max_Size : positive;
type Element_Type is private;
… rest of ADT as before except that
Element_Type replaces Integer
and Max_Size as a constant is
removed
now we instantiate our ADT:
package Integer_Stack is new
Generic_Stack(100, Integer);
11. Parameterized ADTs Continued
• In C++, parameterized ADTs are implemented as
templated classes
– to change the stack class’ size, only change the constructor to
receive the size as a parameter, which is used to establish the
size of the array
– to change the stack’s type, the class is now defined as a
template using template <class Type> where Type is the
place-holder to be filled in by a specific type at run-time
• In both Ada and C++, the parameterized ADT
definition is generated at compile-time
– the new statement signals that a new package should be
generated by the compiler
• in C++, if two definitions ask for the same type of ADT, only 1 set of
source code is generated, in Ada, the same source code is generated
twice!
• In Java and C#, parameterized ADTs are implemented
as generic classes (you should have covered this in 360
for Java, so we skip it here)
12. Encapsulation Constructs
• For large programs, to avoid having to recompile all code when
one section changes
– code can be grouped into logically related chunks called encapsulations
• one approach is the nested subprogram, place logically related subprograms
inside of the subprograms that commonly call them, although this approach is
not available in C-languages since nesting of subprograms is not possible
• use a header file (C, C++) and place logically related functions in the same
file, distributing the program across multiple files
– C++ goes beyond simple header files and includes the notation of a friend which
has access to private definitions
• Ada packages (which can be compiled separately) can include any number of
data and subprogram declarations so that they can contain interfaces for
multiple ADTs
• C# assemblies that can share code with other software written in the .NET
environment
• Each language has some technique for then using the named
encapsulation, sometimes called a namespace
– see the notes section of this slide for details in various languages
Editor's Notes
Programmers and computer science in general greatly improved on programming methodologies over time as they learned about good and bad programming habits, and what programming language constructs were needed to help support good habits. One major change in programming emphasis arose in the late 70s/early 80s as a response to programmers creating data structures as needed, rather than in a principled manner. The solution is known as abstract data types, to support the need of data abstraction.
Since you have already studied abstract data types in CSC 360, we will skip over the example illustrated in the textbook in section 11.2 and concentrate on how languages support them.
Early languages had no support for ADTs. Early FORTRAN had no structures other than arrays. COBOL allowed one to define a structure but had no mechanisms for encapsulation or information hiding. PL/I included all of the various data structures as part of the language so that, while you could declare a variable to be of a specific data structure type and access it through built-in processes, you could not define your own. Simula-67 was the first to offer the ability to define your own data structures, but this idea was not popularized until ALGOL-68. Its two primary successors, Pascal and C, popularized the notion of programmer defined structures, which has been provided in nearly every language since. However, neither of these languages has mechanisms for information hiding, and they only have weak support for encapsulation (encapsulation is not mandatory).
By restricting an ADT’s access to be via pointer, one can modify the ADT code and recompile that definition without having to recompile any user code. For instance, if I define an ADT in a file and compile it, and then you write a program to use my ADT, fine. Later, I modify the structure of my ADT (without modifying the interface) and recompile it and make the new object file available to you. You will not have to recompile your code if your code accesses the ADT through a pointer. However, if your code declares a variable of the ADT structure itself, then your code MUST be recompiled because I have changed the storage requirements for the ADT.
Simula 67 was the first language to provide a facility for user-defined classes. Objects were dynamically allocated, which was fairly unique at the time, and the class construct combined both data structure definition and the subprograms to operate on the variables, making Simula-67 the first language to offer encapsulation. However, Simula 67 did not offer a mechanism for information hiding, so the Simula 67 class fails as an ADT. ALGOL-68 would also permit the user to define data structures but had no encapsulation or information hiding.
The form of a class in Simula67 is
class class_name;
begin
variable declarations here
subprogram definitions of operators here
code section here
end class_name;
For most languages, ADTs are implemented by pointers and so assignment merely copies pointer values so that one pointer now points at the other ADT, rather than copying the data structure itself. In Ada, assignment means “copy the data structure into a new memory location”. Similarly, equality in most languages tests the two pointers to see if they point at the same memory location, but in Ada, equality tests to see if two data structures have the same data values. While assignment and equality may be less efficient in Ada than other languages, it provides more flexibility in that these operations are more meaningful.
NOTE: because we ar eusing List_Type in our Stack_Type definition, List_Type must be defined first, and therefore it is defined prior to our actual Stack ADT, which is a record with a List and a Topsub. The List_Type does not have to be defined in either the private section or in this package as long as it is defined somewhere, but it makes the most sense to define it where it is because it should also be hidden.
By making the ADT definition above a pointer to a stack record, and defining the actual data structure in the body package, it makes our definition a little cleaner – that is, we are not defining the data structure in one place and the code elsewhere, we are defining the interface in one place and the structure and code in the body package. The specification package would look like this instead:
private
type Stack_Type;
type Stack_Ptr is access Stack_Type;
And then define Stack_Type itself (along with List_Type) in the body package.
While this is cleaner, there is a drawback to this approach in that a user program can declare a Stack_Ptr and manipulate it without having it point at a Stack_Type and therefore lead to run-time errors. In addition, equality and assignment are now of pointers and therefore do not copy the data structure or compare the data structure as is planned in Ada.
Notice that the actual ADT definition is omitted in the body package because it had already been defined in the specification package
The author expresses concern regarding the use of pointers to ADTs. In this Ada example, the data structure is a record (like a struct), and not a pointer to a record (struct). There are advantages and disadvantages to this approach. The primary advantages are that we do not have to perform pointer dereferencing every time we want to access the data structure and that we don’t have typical pointer concerns (aliases, dangling pointers, lost objects). However, we also have disadvantages – assignment requires copying items between two data structures, and equality means testing items between two data structures.
The main advantage of using a pointer to a data structure however is to get away from the need to recompile code as discussed on the first slide’s notes for this chapter. The Modula-2 approach where all data structures are pointed to is cleaner than the Ada approach where the programmer has a choice. The author really seems to like the Ada approach better.
Note that C/C++ structs do not support encapsulation at all, however you can use structs and build your own encapsulation through the use of a header file.
We explore classes in chapter 12, so we won’t cover the above example in any detail here.
Note about Java and generics:
Prior to Java 1.5, generics were not available. You could however simulate this through the use of polymorphism. Recall that if you had some class Parent and subclass Child, and a method called foo in Parent, then an object of either class could call upon foo, so foo becomes a generic method. If you could extend this concept by making the ADT store data of type Objects, then since all object types descend from Object, the ADT can then implement methods that operate on the type Object but still permit you to store a specific type in the ADT (for instance, if the ADT is a stack, you could store Strings or Colors there). If you were to store a primitive type, you would use the appropriate wrapper classes (such as Integer to store int values). So you could make a generic ADT in Java through this technique. The only problem with this is to obtain a specific item from the ADT would require casting the Object to its right type. You can see a brief example of this on page 507-8 where the ADT is used to store Integers.
Java 1.5 cleans this up by permitting true generic objects for parameterized ADTs.
The idea of a namespace is that it allows units of a program (e.g., function names) to have the same name but be different sets of code – a namespace is a container (encapsulation) in which a given name can be recognized. Here, we look at how namespaces are specified in some of the more common languages.
C++ uses namespace to specify a namespace. To access elements of a namespace, you use the :: operator. The :: is known as the scope resolution operator. The :: notation is needed when two libraries have different definitions but share the same named item. An example might be having a namespace for MyStack and referencing a variable of that encapsulation using MyStack::topPtr.
Java uses packages which combine one or more class definitions. Without a package, special access can be granted between classes (we cover this in chapter 12). We use import to import an entire package or a specific class from a package:
import java.io.*; imports all classes in the package
import java.io.JOptionPane; imports only the selected class
Since Java is OO, the use of the namespace is governed by interaction with objects. Therefore, Java does not permit imported classes to share names, but names of different class’ methods, variables and constants can be shared. You would address a shared item by referencing the class, as in aStack.topPtr or aStack.pop();
Ada also uses packages. In Ada, the with statement is used to include a package, and the uses statement is used to specify the specific definition (ADT) desired from that package. For example:
with Ada.Text_IO;
uses Ada.Text_IO;
oruses Ada.Text_IO.Put;
Ruby uses modules, which are collections of methods and constants. Modules are unlike classes though as in that a Module is not a definition that can be instantiated or extended.