SlideShare a Scribd company logo
Principles of Object Oriented ProgrammingDavid GiardMCTS, MCSE, MCDBA, MCSDDavidGiard.com
nPlus1.orgnPlus1.org is a site dedicated to helping Architects, aspiring Architects and Lead Developers learn, connect and contribute.http://nplus1.org
AgendaThe ChallengeThe BasicsBringing Order To ChaosGuiding Principles
The Challenge
The Complexity of software derives from 4 elements:Complexity of the problem domainDifficulty to manage the development processFlexibility possible through softwareSoftware problems often model discrete systems
?How do you write great software every time?
Good question… lots of answers!The customer–friendly programmer says:“Great software always does what the customer wants it to. So even if the customer thinks of new ways to use the software, it doesn’t break or give them unexpected results.”
Good question… lots of answers!The design–guru programmer says:“Great software is when you use tried-and-true design patterns and principles. You’ve kept your objects loosely coupled, and your code opens for extension but closed for modification. That also helps keep the code more usable, so you don’t have to rework everything to use parts of your application over and over again.”
Good question… lots of answers!The object-oriented programmer says:“Great software is code that is object-oriented. So there's not a bunch of duplicate code, and each object pretty much controls its own behavior. It’s also easy to extend because your design is really solid and flexible.”
Answer: Simplify ComplexityAnswer: Eschew Obfuscation
The Basics
The BasicsObjectsClassesMembersPropertiesMethodsEventsConstructorsInstancesMessage Passing
Defining Classesclass Name:BaseType{   // Members}class MyType{   public String SomeString;   public Int32 x;   public Int32 y;   public void DoSomething()	{	…	}}
Class MembersFieldsThe state of an objectPropertiesAlso maintain stateMethodsConstructorsFunctionsProperties (smart fields)Members come in two basic formsInstanceStatic
FieldsMaintain state of an objectAccessing a fieldclass Point{public Int32 X;  public Int32 Y;   private In32 _x;} Point p = new Point();p.X = 100;p.Y = 200;Console.WriteLine(p.X);
PropertiesMethods that look like fields (smart fields)Can have read-only or write-only propertiesclass Point{   Int32 _x;   Int32 _y;public Int32 X   {      get{return _x;}      set{_x = value;}}   public Int32 Y   {      get{return _y;}      set{_y = value;}}}
Methodsclass MyType{   public Int32 SomeMethod()   {     Int32 z = 0;      // Code omitted…return z;   }   public static void StaticMethod()   {      // Do something   }}MyType t = new MyType();t.SomeMethod();
Method Parametersclass MyType{   public Int32 AddNumbers(Int32 x, Int32 y)   {      Int32 z = x + y;return z;   }}MyType t = new MyType();t.AddNumbers(1,2);
Types and Instances
Instantiating an Objectpublic class MyType{  public string MyStringField;public void InstanceMethod()   {      // Do something   }}MyType o = new MyType();o.MyStringField = “Hello”;String x = o.MyStringField;o.InstanceMethod();
Static Typespublic static class MyType{	public static void StaticMethod(){		// Do something	}}MyType.StaticMethod();
ConstructorsConstructors are used to initialize fieldsclass Point{private Int32 _x;private Int32 _y;   public Point()   {	// Setup code   }   public Point(Int32 xCoordinate, Int32 yCoordinate)   {     _x = xCoordinate;_y = yCoordinate;   }}
Referencing an objectObjects are reference typesPointer to memoryMyType obj1 = new MyType();obj2 = obj1;obj2.Color = “Red”;Console.WriteLine(obj1.Color)
Event HandlingC# and VB have built in support for eventsGreat for dealing with objects in an event-driven operating systemMore than one type can register interest in a single eventA single type can register interest in any number of events
Event Handlingclass MyForm:Form{MyForm(){      Button button = new Button();button.Text = "Button";button.Click += new EventHandler(HandleClick);Controls.Add(button);   }   void HandleClick(Object sender, EventArgs e){MessageBox.Show("The Click event fired!");   }   public static void Main(){Application.Run(new MyForm());   }  }
Designing Types: Accessibilitiespublic – Accessible to allprivate – Accessible to containing classprotected – Accessible to containing or derived classesinternal – Accessible to code in same assembly
Demo
Bringing Order to the ChaosObject Oriented Programming
Bringing Order to the ChaosConcepts of Object OrientationEncapsulationAbstractionInheritancePolymorphismDecoupling
Bringing Order to the ChaosEncapsulationandAbstraction
Bringing Order to the ChaosThe Role of EncapsulationCarTransmissionEngineStop()Start()AxelAxelDrive()WheelWheelWheelWheel
Bringing Order to the ChaosThe Role of Abstraction
Demo
Bringing Order to the ChaosThe Role of Inheritance
InheritanceVehiclePlane+Start()+Stop()+Steer()+Fly()+Start()+Stop()+Steer()Train+Start()+Stop()+Steer()+BlowHorn()Automobile+Start()+Stop()+Steer()+Honk()
Polymorphism
Designing Types: PolymorphismUse the virtual keyword to make a method virtualIn derived class, override method is marked with the override keywordExampleToString() method in Object classExample derived class overriding ToString()public virtual string ToString(); class SomeClass:Object{   public override String ToString(){      return “Some String Representing State”;   }}
Demo
InterfacesDefine public membersNo ImplementationYour types can implement interfacesMust implement all methods in the interfaceinterface IName{   // Members}Class ClassName: IName{}
Interfacesusing System; class SomeType{}; class SortType:SomeType, IComparable{   Int32 val;   public SortType(Int32 val){      this.val = val;   }   public Int32 CompareTo(Object obj){      return this.val - ((SortType)obj).val;   }    public override string ToString(){      return val.ToString();   }} class App{   public static void Main(){SomeType[] objs = new SomeType[]{         new SortType(3), new SortType(1), new SortType(2)}; Array.Sort(objs);foreach(SomeType o in objs){Console.WriteLine(o.ToString());      }    }}
Bringing Order to the ChaosThe Role of Decoupling
Demo
Airplane speed: intgetSpeed(): intsetSpeed(int)UML and Class DiagramsClass DiagramNameMember Variables  name:typeMethods name(parameters the method uses): return type
Visual Studio Class Designer
Demo
Guiding Principles
SOLIDPrinciplesSingle responsibilityOpen CloseLiskov Substitution.Interface Segregation Dependency Injection
Intro to object oriented programming
Intro to object oriented programming
Intro to object oriented programming
Liskovsubstitutionpublic class Rectangle{  public virtual int Height { get; set; }  public virtual int Width { get; set; }  public int Area()  {    return Height * Width;  }}
Liskovsubstitutionrectangle.Height = 4;rectangle.Width = 5;int expectedArea = 20;int actualArea = rectangle.Area();Debug.Assert(expectedArea == actualArea);
Liskovsubstitutionpublic class Square : Rectangle {    public override int Height {    get { return base.Height; }    set { base.Height = value;          base.Width = value;    }  }  public override int Width {    get { return base.Width; }    set { base.Width = value;          base.Height = value;    }  }}
LiskovsubstitutionRectangle square = new Square();square.Width = 4;square.Height = 5;int expectedArea = 20;int actualArea = rectangle.Area();Debug.Assert(expectedArea == actualArea);
Intro to object oriented programming
Interfacesegregationprincipleinterface IWorker {	public void work();	public void eat();}
Intro to object oriented programming
Interfacesegregationprinciplepublic class Customer { private IFoo _foo; public Customer(IFoo foo)  {this._foo= foo;    }}

More Related Content

What's hot (16)

Data oriented design
Data oriented designData oriented design
Data oriented design
Max Klyga
 
A well-typed program never goes wrong
A well-typed program never goes wrongA well-typed program never goes wrong
A well-typed program never goes wrong
Julien Wetterwald
 
C++ Constructor destructor
C++ Constructor destructorC++ Constructor destructor
C++ Constructor destructor
Da Mystic Sadi
 
Concept of constructors
Concept of constructorsConcept of constructors
Concept of constructors
kunj desai
 
Constructor and destructor
Constructor and destructorConstructor and destructor
Constructor and destructor
Selvin Josy Bai Somu
 
Writing Node.js Bindings - General Principles - Gabriel Schulhof
Writing Node.js Bindings - General Principles - Gabriel SchulhofWriting Node.js Bindings - General Principles - Gabriel Schulhof
Writing Node.js Bindings - General Principles - Gabriel Schulhof
WithTheBest
 
Constructor & Destructor
Constructor & DestructorConstructor & Destructor
Constructor & Destructor
KV(AFS) Utarlai, Barmer (Rajasthan)
 
04. constructor & destructor
04. constructor & destructor04. constructor & destructor
04. constructor & destructor
Haresh Jaiswal
 
Structure in c
Structure in cStructure in c
Structure in c
Samsil Arefin
 
C++lecture9
C++lecture9C++lecture9
C++lecture9
FALLEE31188
 
Intake 38 5 1
Intake 38 5 1Intake 38 5 1
Intake 38 5 1
Mahmoud Ouf
 
Dotnet unit 4
Dotnet unit 4Dotnet unit 4
Dotnet unit 4
007laksh
 
Op ps
Op psOp ps
Op ps
Shehzad Rizwan
 
Java Concepts
Java ConceptsJava Concepts
Java Concepts
AbdulImrankhan7
 
Chapter 2
Chapter 2Chapter 2
Chapter 2
application developer
 
C#ppt
C#pptC#ppt
C#ppt
Sambasivarao Kurakula
 

Viewers also liked (20)

test
testtest
test
pvara_99
 
Transforming HR in an Uncertain Economy: Priorities and Processes That Delive...
Transforming HR in an Uncertain Economy: Priorities and Processes That Delive...Transforming HR in an Uncertain Economy: Priorities and Processes That Delive...
Transforming HR in an Uncertain Economy: Priorities and Processes That Delive...
welshms
 
Caching and Microsoft Distributed Cache (aka "Velocity")
Caching and Microsoft Distributed Cache (aka "Velocity")Caching and Microsoft Distributed Cache (aka "Velocity")
Caching and Microsoft Distributed Cache (aka "Velocity")
David Giard
 
GrouperEye Product Plan
GrouperEye Product PlanGrouperEye Product Plan
GrouperEye Product Plan
williamstj
 
2009 03 31 Healthstory Webinar Presentation
2009 03 31 Healthstory Webinar Presentation2009 03 31 Healthstory Webinar Presentation
2009 03 31 Healthstory Webinar Presentation
Nick van Terheyden
 
Reaching More Customers in 2015 With a Responsive Mobile Website Design
Reaching More Customers in 2015 With a Responsive Mobile Website DesignReaching More Customers in 2015 With a Responsive Mobile Website Design
Reaching More Customers in 2015 With a Responsive Mobile Website Design
Richard Sink
 
Venus
VenusVenus
Venus
ciclesuperiorelcim
 
Towers Perrin's Health Care 360 Performance Study - Value for Your Organization
Towers Perrin's Health Care 360 Performance Study - Value for Your OrganizationTowers Perrin's Health Care 360 Performance Study - Value for Your Organization
Towers Perrin's Health Care 360 Performance Study - Value for Your Organization
welshms
 
the great eight
the great eightthe great eight
the great eight
guestc9b457
 
J query
J queryJ query
J query
David Giard
 
Colorado Climate
Colorado ClimateColorado Climate
Colorado Climate
xtina44
 
Greenwich IATA Presentation 7 Oct 2008 Final Website
Greenwich IATA Presentation 7 Oct 2008 Final WebsiteGreenwich IATA Presentation 7 Oct 2008 Final Website
Greenwich IATA Presentation 7 Oct 2008 Final Website
rcsmuk
 
Brand Establisher
Brand EstablisherBrand Establisher
Brand Establisher
Richard Sink
 
The Business of Mobile Apps
The Business of Mobile AppsThe Business of Mobile Apps
The Business of Mobile Apps
Norman Liang
 
Gray Routes Full Time JDs
Gray Routes Full Time JDsGray Routes Full Time JDs
Gray Routes Full Time JDs
Soubhagya Sahoo
 
the great eight
the great eightthe great eight
the great eight
guestc9b457
 
Declarative analysis of noisy information networks
Declarative analysis of noisy information networksDeclarative analysis of noisy information networks
Declarative analysis of noisy information networks
University of New South Wales
 
Horario de examenes 1 er trimestre colegio 2010
Horario de examenes 1 er trimestre colegio 2010Horario de examenes 1 er trimestre colegio 2010
Horario de examenes 1 er trimestre colegio 2010
Stalyn Cruz
 
Transforming HR in an Uncertain Economy: Priorities and Processes That Delive...
Transforming HR in an Uncertain Economy: Priorities and Processes That Delive...Transforming HR in an Uncertain Economy: Priorities and Processes That Delive...
Transforming HR in an Uncertain Economy: Priorities and Processes That Delive...
welshms
 
Caching and Microsoft Distributed Cache (aka "Velocity")
Caching and Microsoft Distributed Cache (aka "Velocity")Caching and Microsoft Distributed Cache (aka "Velocity")
Caching and Microsoft Distributed Cache (aka "Velocity")
David Giard
 
GrouperEye Product Plan
GrouperEye Product PlanGrouperEye Product Plan
GrouperEye Product Plan
williamstj
 
2009 03 31 Healthstory Webinar Presentation
2009 03 31 Healthstory Webinar Presentation2009 03 31 Healthstory Webinar Presentation
2009 03 31 Healthstory Webinar Presentation
Nick van Terheyden
 
Reaching More Customers in 2015 With a Responsive Mobile Website Design
Reaching More Customers in 2015 With a Responsive Mobile Website DesignReaching More Customers in 2015 With a Responsive Mobile Website Design
Reaching More Customers in 2015 With a Responsive Mobile Website Design
Richard Sink
 
Towers Perrin's Health Care 360 Performance Study - Value for Your Organization
Towers Perrin's Health Care 360 Performance Study - Value for Your OrganizationTowers Perrin's Health Care 360 Performance Study - Value for Your Organization
Towers Perrin's Health Care 360 Performance Study - Value for Your Organization
welshms
 
Colorado Climate
Colorado ClimateColorado Climate
Colorado Climate
xtina44
 
Greenwich IATA Presentation 7 Oct 2008 Final Website
Greenwich IATA Presentation 7 Oct 2008 Final WebsiteGreenwich IATA Presentation 7 Oct 2008 Final Website
Greenwich IATA Presentation 7 Oct 2008 Final Website
rcsmuk
 
The Business of Mobile Apps
The Business of Mobile AppsThe Business of Mobile Apps
The Business of Mobile Apps
Norman Liang
 
Gray Routes Full Time JDs
Gray Routes Full Time JDsGray Routes Full Time JDs
Gray Routes Full Time JDs
Soubhagya Sahoo
 
Horario de examenes 1 er trimestre colegio 2010
Horario de examenes 1 er trimestre colegio 2010Horario de examenes 1 er trimestre colegio 2010
Horario de examenes 1 er trimestre colegio 2010
Stalyn Cruz
 
Ad

Similar to Intro to object oriented programming (20)

Object Oriented Programming In .Net
Object Oriented Programming In .NetObject Oriented Programming In .Net
Object Oriented Programming In .Net
Greg Sohl
 
1204csharp
1204csharp1204csharp
1204csharp
g_hemanth17
 
CSharp presentation and software developement
CSharp presentation and software developementCSharp presentation and software developement
CSharp presentation and software developement
frwebhelp
 
Advanced c#
Advanced c#Advanced c#
Advanced c#
saranuru
 
Mca 504 dotnet_unit3
Mca 504 dotnet_unit3Mca 504 dotnet_unit3
Mca 504 dotnet_unit3
Rai Saheb Bhanwar Singh College Nasrullaganj
 
CSharp_03_ClassesStructs_and_introduction
CSharp_03_ClassesStructs_and_introductionCSharp_03_ClassesStructs_and_introduction
CSharp_03_ClassesStructs_and_introduction
Ranjithsingh20
 
C# - Igor Ralić
C# - Igor RalićC# - Igor Ralić
C# - Igor Ralić
Software StartUp Academy Osijek
 
Better Understanding OOP using C#
Better Understanding OOP using C#Better Understanding OOP using C#
Better Understanding OOP using C#
Chandan Gupta Bhagat
 
Introduction-to-Csharpppppppppppppppp.ppt
Introduction-to-Csharpppppppppppppppp.pptIntroduction-to-Csharpppppppppppppppp.ppt
Introduction-to-Csharpppppppppppppppp.ppt
kamalsmail1
 
03 classes interfaces_principlesofoop
03 classes interfaces_principlesofoop03 classes interfaces_principlesofoop
03 classes interfaces_principlesofoop
Vladislav Hadzhiyski
 
Object-Oriented Programming with C#
Object-Oriented Programming with C#Object-Oriented Programming with C#
Object-Oriented Programming with C#
Svetlin Nakov
 
70 536
70 53670 536
70 536
Sankar Balasubramanian
 
Basic c#
Basic c#Basic c#
Basic c#
kishore4268
 
20. Object-Oriented Programming Fundamental Principles
20. Object-Oriented Programming Fundamental Principles20. Object-Oriented Programming Fundamental Principles
20. Object-Oriented Programming Fundamental Principles
Intro C# Book
 
Oops
OopsOops
Oops
Sankar Balasubramanian
 
Introduction to csharp
Introduction to csharpIntroduction to csharp
Introduction to csharp
voegtu
 
Introduction to csharp
Introduction to csharpIntroduction to csharp
Introduction to csharp
voegtu
 
Oops concept in c#
Oops concept in c#Oops concept in c#
Oops concept in c#
ANURAG SINGH
 
Introduction to c#
Introduction to c#Introduction to c#
Introduction to c#
singhadarsh
 
Csharp4 objects and_types
Csharp4 objects and_typesCsharp4 objects and_types
Csharp4 objects and_types
Abed Bukhari
 
Object Oriented Programming In .Net
Object Oriented Programming In .NetObject Oriented Programming In .Net
Object Oriented Programming In .Net
Greg Sohl
 
CSharp presentation and software developement
CSharp presentation and software developementCSharp presentation and software developement
CSharp presentation and software developement
frwebhelp
 
Advanced c#
Advanced c#Advanced c#
Advanced c#
saranuru
 
CSharp_03_ClassesStructs_and_introduction
CSharp_03_ClassesStructs_and_introductionCSharp_03_ClassesStructs_and_introduction
CSharp_03_ClassesStructs_and_introduction
Ranjithsingh20
 
Introduction-to-Csharpppppppppppppppp.ppt
Introduction-to-Csharpppppppppppppppp.pptIntroduction-to-Csharpppppppppppppppp.ppt
Introduction-to-Csharpppppppppppppppp.ppt
kamalsmail1
 
03 classes interfaces_principlesofoop
03 classes interfaces_principlesofoop03 classes interfaces_principlesofoop
03 classes interfaces_principlesofoop
Vladislav Hadzhiyski
 
Object-Oriented Programming with C#
Object-Oriented Programming with C#Object-Oriented Programming with C#
Object-Oriented Programming with C#
Svetlin Nakov
 
20. Object-Oriented Programming Fundamental Principles
20. Object-Oriented Programming Fundamental Principles20. Object-Oriented Programming Fundamental Principles
20. Object-Oriented Programming Fundamental Principles
Intro C# Book
 
Introduction to csharp
Introduction to csharpIntroduction to csharp
Introduction to csharp
voegtu
 
Introduction to csharp
Introduction to csharpIntroduction to csharp
Introduction to csharp
voegtu
 
Oops concept in c#
Oops concept in c#Oops concept in c#
Oops concept in c#
ANURAG SINGH
 
Introduction to c#
Introduction to c#Introduction to c#
Introduction to c#
singhadarsh
 
Csharp4 objects and_types
Csharp4 objects and_typesCsharp4 objects and_types
Csharp4 objects and_types
Abed Bukhari
 
Ad

More from David Giard (20)

Data Visualization - CodeMash 2022
Data Visualization - CodeMash 2022Data Visualization - CodeMash 2022
Data Visualization - CodeMash 2022
David Giard
 
Azure data factory
Azure data factoryAzure data factory
Azure data factory
David Giard
 
Azure functions
Azure functionsAzure functions
Azure functions
David Giard
 
University of Texas lecture: Data Science Tools in Microsoft Azure
University of Texas lecture: Data Science Tools in Microsoft AzureUniversity of Texas lecture: Data Science Tools in Microsoft Azure
University of Texas lecture: Data Science Tools in Microsoft Azure
David Giard
 
University of Texas, Data Science, March 29, 2018
University of Texas, Data Science, March 29, 2018University of Texas, Data Science, March 29, 2018
University of Texas, Data Science, March 29, 2018
David Giard
 
Intro to cloud and azure
Intro to cloud and azureIntro to cloud and azure
Intro to cloud and azure
David Giard
 
Azure and deep learning
Azure and deep learningAzure and deep learning
Azure and deep learning
David Giard
 
Azure and Deep Learning
Azure and Deep LearningAzure and Deep Learning
Azure and Deep Learning
David Giard
 
Custom vision
Custom visionCustom vision
Custom vision
David Giard
 
Cloud and azure and rock and roll
Cloud and azure and rock and rollCloud and azure and rock and roll
Cloud and azure and rock and roll
David Giard
 
Own your own career advice from a veteran consultant
Own your own career   advice from a veteran consultantOwn your own career   advice from a veteran consultant
Own your own career advice from a veteran consultant
David Giard
 
You and Your Tech Community
You and Your Tech CommunityYou and Your Tech Community
You and Your Tech Community
David Giard
 
Microsoft Azure IoT overview
Microsoft Azure IoT overviewMicrosoft Azure IoT overview
Microsoft Azure IoT overview
David Giard
 
Cloud and azure and rock and roll
Cloud and azure and rock and rollCloud and azure and rock and roll
Cloud and azure and rock and roll
David Giard
 
Big Data on azure
Big Data on azureBig Data on azure
Big Data on azure
David Giard
 
Microsoft azure without microsoft
Microsoft azure without microsoftMicrosoft azure without microsoft
Microsoft azure without microsoft
David Giard
 
Azure mobile apps
Azure mobile appsAzure mobile apps
Azure mobile apps
David Giard
 
Building a TV show with Angular, Bootstrap, and Web Services
Building a TV show with Angular, Bootstrap, and Web ServicesBuilding a TV show with Angular, Bootstrap, and Web Services
Building a TV show with Angular, Bootstrap, and Web Services
David Giard
 
Effective Data Visualization
Effective Data VisualizationEffective Data Visualization
Effective Data Visualization
David Giard
 
Angular2 and TypeScript
Angular2 and TypeScriptAngular2 and TypeScript
Angular2 and TypeScript
David Giard
 
Data Visualization - CodeMash 2022
Data Visualization - CodeMash 2022Data Visualization - CodeMash 2022
Data Visualization - CodeMash 2022
David Giard
 
Azure data factory
Azure data factoryAzure data factory
Azure data factory
David Giard
 
University of Texas lecture: Data Science Tools in Microsoft Azure
University of Texas lecture: Data Science Tools in Microsoft AzureUniversity of Texas lecture: Data Science Tools in Microsoft Azure
University of Texas lecture: Data Science Tools in Microsoft Azure
David Giard
 
University of Texas, Data Science, March 29, 2018
University of Texas, Data Science, March 29, 2018University of Texas, Data Science, March 29, 2018
University of Texas, Data Science, March 29, 2018
David Giard
 
Intro to cloud and azure
Intro to cloud and azureIntro to cloud and azure
Intro to cloud and azure
David Giard
 
Azure and deep learning
Azure and deep learningAzure and deep learning
Azure and deep learning
David Giard
 
Azure and Deep Learning
Azure and Deep LearningAzure and Deep Learning
Azure and Deep Learning
David Giard
 
Cloud and azure and rock and roll
Cloud and azure and rock and rollCloud and azure and rock and roll
Cloud and azure and rock and roll
David Giard
 
Own your own career advice from a veteran consultant
Own your own career   advice from a veteran consultantOwn your own career   advice from a veteran consultant
Own your own career advice from a veteran consultant
David Giard
 
You and Your Tech Community
You and Your Tech CommunityYou and Your Tech Community
You and Your Tech Community
David Giard
 
Microsoft Azure IoT overview
Microsoft Azure IoT overviewMicrosoft Azure IoT overview
Microsoft Azure IoT overview
David Giard
 
Cloud and azure and rock and roll
Cloud and azure and rock and rollCloud and azure and rock and roll
Cloud and azure and rock and roll
David Giard
 
Big Data on azure
Big Data on azureBig Data on azure
Big Data on azure
David Giard
 
Microsoft azure without microsoft
Microsoft azure without microsoftMicrosoft azure without microsoft
Microsoft azure without microsoft
David Giard
 
Azure mobile apps
Azure mobile appsAzure mobile apps
Azure mobile apps
David Giard
 
Building a TV show with Angular, Bootstrap, and Web Services
Building a TV show with Angular, Bootstrap, and Web ServicesBuilding a TV show with Angular, Bootstrap, and Web Services
Building a TV show with Angular, Bootstrap, and Web Services
David Giard
 
Effective Data Visualization
Effective Data VisualizationEffective Data Visualization
Effective Data Visualization
David Giard
 
Angular2 and TypeScript
Angular2 and TypeScriptAngular2 and TypeScript
Angular2 and TypeScript
David Giard
 

Recently uploaded (20)

If You Use Databricks, You Definitely Need FME
If You Use Databricks, You Definitely Need FMEIf You Use Databricks, You Definitely Need FME
If You Use Databricks, You Definitely Need FME
Safe Software
 
PyData - Graph Theory for Multi-Agent Integration
PyData - Graph Theory for Multi-Agent IntegrationPyData - Graph Theory for Multi-Agent Integration
PyData - Graph Theory for Multi-Agent Integration
barqawicloud
 
Ben Blair - Operating Safely in a Vibe Coding World
Ben Blair - Operating Safely in a Vibe Coding WorldBen Blair - Operating Safely in a Vibe Coding World
Ben Blair - Operating Safely in a Vibe Coding World
AWS Chicago
 
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdfBoosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Alkin Tezuysal
 
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Shashikant Jagtap
 
Domino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
Domino IQ – Was Sie erwartet, erste Schritte und AnwendungsfälleDomino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
Domino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
panagenda
 
Introduction to Typescript - GDG On Campus EUE
Introduction to Typescript - GDG On Campus EUEIntroduction to Typescript - GDG On Campus EUE
Introduction to Typescript - GDG On Campus EUE
Google Developer Group On Campus European Universities in Egypt
 
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
NTT DATA Technology & Innovation
 
Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...
BookNet Canada
 
Edge-banding-machines-edgeteq-s-200-en-.pdf
Edge-banding-machines-edgeteq-s-200-en-.pdfEdge-banding-machines-edgeteq-s-200-en-.pdf
Edge-banding-machines-edgeteq-s-200-en-.pdf
AmirStern2
 
Kubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too LateKubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too Late
Michael Furman
 
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Safe Software
 
Oracle Cloud and AI Specialization Program
Oracle Cloud and AI Specialization ProgramOracle Cloud and AI Specialization Program
Oracle Cloud and AI Specialization Program
VICTOR MAESTRE RAMIREZ
 
AI Agents in Logistics and Supply Chain Applications Benefits and Implementation
AI Agents in Logistics and Supply Chain Applications Benefits and ImplementationAI Agents in Logistics and Supply Chain Applications Benefits and Implementation
AI Agents in Logistics and Supply Chain Applications Benefits and Implementation
Christine Shepherd
 
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Anish Kumar
 
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdfcnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
AmirStern2
 
Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.
hok12341073
 
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely
 
Your startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean accountYour startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean account
angelo60207
 
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven InfrastructureNo-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
Safe Software
 
If You Use Databricks, You Definitely Need FME
If You Use Databricks, You Definitely Need FMEIf You Use Databricks, You Definitely Need FME
If You Use Databricks, You Definitely Need FME
Safe Software
 
PyData - Graph Theory for Multi-Agent Integration
PyData - Graph Theory for Multi-Agent IntegrationPyData - Graph Theory for Multi-Agent Integration
PyData - Graph Theory for Multi-Agent Integration
barqawicloud
 
Ben Blair - Operating Safely in a Vibe Coding World
Ben Blair - Operating Safely in a Vibe Coding WorldBen Blair - Operating Safely in a Vibe Coding World
Ben Blair - Operating Safely in a Vibe Coding World
AWS Chicago
 
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdfBoosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Alkin Tezuysal
 
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Shashikant Jagtap
 
Domino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
Domino IQ – Was Sie erwartet, erste Schritte und AnwendungsfälleDomino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
Domino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
panagenda
 
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
NTT DATA Technology & Innovation
 
Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...
BookNet Canada
 
Edge-banding-machines-edgeteq-s-200-en-.pdf
Edge-banding-machines-edgeteq-s-200-en-.pdfEdge-banding-machines-edgeteq-s-200-en-.pdf
Edge-banding-machines-edgeteq-s-200-en-.pdf
AmirStern2
 
Kubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too LateKubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too Late
Michael Furman
 
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Safe Software
 
Oracle Cloud and AI Specialization Program
Oracle Cloud and AI Specialization ProgramOracle Cloud and AI Specialization Program
Oracle Cloud and AI Specialization Program
VICTOR MAESTRE RAMIREZ
 
AI Agents in Logistics and Supply Chain Applications Benefits and Implementation
AI Agents in Logistics and Supply Chain Applications Benefits and ImplementationAI Agents in Logistics and Supply Chain Applications Benefits and Implementation
AI Agents in Logistics and Supply Chain Applications Benefits and Implementation
Christine Shepherd
 
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Anish Kumar
 
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdfcnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
AmirStern2
 
Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.
hok12341073
 
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely
 
Your startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean accountYour startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean account
angelo60207
 
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven InfrastructureNo-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
Safe Software
 

Intro to object oriented programming

Editor's Notes

  • #5: Photo by meganpru(Creative Commons License)http://www.flickr.com/photos/meganpru/57943941/
  • #6: Complexity of the problem domainThe problems we try to solve in software often involve elements of inescapable complexity, in which we find a myriad of competing, perhaps even contradictory, requirementsDifficulty to manage the development processThe fundamental task of the software development team is to engineer the illusion of simplicity – to shield users from this vast and often arbitrary external complexityFlexibility possible through softwareSoftware offers the ultimate flexibility, so it is possible for a developer to express almost any kinf of abstractionCharacterizing the behavior of discrete systemsA lot of software is designed to model discrete systems. Discrete systems are not easily modeled in procedural code.
  • #12: Photo by All Glass Photo's photostream(Creative Commons License)http://www.flickr.com/photos/jim_rafferty_uk/2203549363/
  • #15: Sample Dialog:In C# like any other object oriented language, the members in a type are basically either fields or methods. However, C# has a rich selection of field and method options.Fields are the data or state of an object or type, and methods are the functionality.Members come in two basic forms, instance and static. Instance members are the most common, and there will be one per instance or object. Static members are shared amongst instances and are one per type.Instance methods require an instance to be called, but static methods can be called directly just using the name of the type. The automatic “this” parameter is passed to instance methods, but not static methods.In .NET or managed code it is a common design pattern to create a class that cannot be instantiated, with nothing but static methods. This is a way of creating methods that are sort-of global, but are still logically grouped with other related methods. The System.Console class is an example of this design pattern.Speaker Instructions:You don’t have to say the stuff in that last paragraph, but concrete examples like these do help to nail down the ideas for the listeners.
  • #20: As an object oriented programmer you will first and foremost create instances of types. This means that you will use a definition for a type, which has a name such as String or ArrayList, to create an actual object in memory. This object is structured based on the details described in the type’s definition.After you have created an object, you can use it by calling methods and/or referencing fields on the object. When you are finished with the object it must be cleaned up. Is some environments you do this explicitly; in others, such as C# or Java, cleanup is done for you by the system.Creating instances is a nice introduction to OO programming, but eventually you will have to define your own type. By doing so you create a new classification for a kind of object that can be created. You give the type a name, and you create members of the type such as methods and fields.It is important to distinguish between types and instances, so I will make an analogy. Think of the type as a descriptive tool (like a cookie cutter), while an instance is an object created from that description (in the same way that a cookie is created from a cookie cutter).
  • #22: Static typesare most often used when you need to call a method repeatedly.It doesn’t make sense to waste the overhead of instantiating an object just to call a method.When using a static type, only one instance of the class is created.
  • #23: Sample Dialog:C# supports constructor syntax much like C++. However, unlike C++ it is invalid to call a constructor method directly, so if you wish to implement a constructor in terms of another constructor you must use the special colon-this notation you see here.In this example, the simpler Point() constructor automatically calls the more complex constructor with the default x and y values of 0.You can indicate which base constructor to callUse the base keywordYou can implement simpler constructors in terms of more complex ones with the this keyword (suggested)Speaker Instructions:FYI, it is recommended that you have only one constructor for a type, and that the rest of the constructors be implemented in terms of this one. However, this is not always possible and must be handled on a type-by-type bases.
  • #24: An object is a reference type.This means that variables that refer to an object are simply pointing to that object. Multiple variables can be pointing to the same object, which can cause confusion. Accessing any of these variables will access or modify the object.From the computer’s point of view, objects are data. They are the culmination of their fields and enough information to indicate their type. Often this data is complex and sizeable, and it is stored in the memory heap of the program that created the instance.Because objects so often live in the heap-memory of a program, the most common way of dealing with an instance is through a reference variable. The reference variable can be a global or local variable, or it can be a field in another object. Either way, there are some rules of reference variables.Reference variables have a type associated with them. For every object-type defined in an object oriented system, there is a matching reference variable type that is used to refer to instances of the type.Reference variables can refer to an instance or object, or they can refer to null (in most OO languages anyway). A null reference simply indicates that this variable does not refer to any object, but could have an object reference assigned to it.Reference variables do not always refer to objects of the exact sametype as the reference variable. This can be confusing, but in fact the rules are simple. A reference variable must refer to an object of matching type or it must refer to an object that is ultimately derived from the matching type.Looking back to the relationship between Automobile and Machine, a reference variable of type Automobile can only refer to an instance of Automobile; however a reference variable of type Machine can refer to an instance of Machine or an instance of Automobile. You can look at this as being possible, because Automobile is a Machine through the affect of derivation.Reference variables are your means of access to an object or instance. There are two related rules of reference variables.Regardless of what type of instance your reference variable refers to, it is the type of the variable that constrains how you can touch or affect the instance. Regardless of what type of reference variable you are using to refer to an object, the type of the object never changes for the life of the object.
  • #25: Sample Dialog:C# has built in support for event notification and handling, which is great for dealing with OSs that are becoming increasingly event driven.Events in C# are very flexible compared to the virtual-function method of responding to system events.Speaker Instructions:We have several slides on this, so you don’t have to say everything on this slide.
  • #26: Sample Dialog:The source code on this slide shows a simple class derived from Form. The interesting part, however, is how the class registers its interest in the Click event defined by an instance of the Button class. The MyForm class indicates which of its methods (in this case the HandleClick method) should be called when the event is fired.
  • #27: Sample Dialog:Like C++ and Java, C# supports member and class accessibility. The default accessibility is private, and you must decorate members with an accessibility modifier to set a different accessibility.The most common accessibilities are public, private, and protected. However, C# introduces the idea of an internal accessibility which allows access by any class in the same binary assembly file. This is similar to, but more flexible than the C++ friend class.Speaker Instructions:You could spend forever talking about accessibility. If you like you can edge into the direction of design by saying that fields should be private, and methods can be public, etc. But be careful, because you could sink ten minutes on this slide alone.
  • #31: Encapsulation and Abstraction are related concepts
  • #32: Encapsulation is the hiding of the internal mechanisms and data structures of a software component behind a defined interface.We don’t need to understand the details of how the component works internally in order to use that component.Increases integrity by preventing external users from setting internal state of a component to an invalid state.
  • #33: Abstraction is simplifying complex reality by modeling classes appropriate to the problem, and working at the most appropriate level of inheritance for a given aspect of the problem.
  • #35: The object structure is important because it illustrates how different objects collaborate with one another through patterns of interaction.
  • #36: A type defines a number of fields and methods. A derived type inherits the base type’s fields and methods, and adds more of its own, to become a new type (extending from the exisiting one).
  • #37: Polymorphism is closely related to type-derivation and reference variables. But it is an advanced topic, and can be difficult to describe. The goal is to allow a generic piece of code to work with objects or instances generically; meanwhile we want the objects themselves to do the right thing based on their respective types.
  • #38: Sample Dialog:To create a virtual function in C# you must attribute your method with the virtual keyword. Virtual methods can be public, protected, or protected internal.To override a virtual method in a derived class you must explicitly indicate your intent using the override keyword. Your derived method must also match the base method signature exactly.Speaker Instructions:The override keyword is actually part of the versioning story in the .NET Framework. But this is probably a bit too much to explain in the discussion. However, for your own study you may want to look up the “override” and “new” keywords in the documentation, as this is an example of a feature that is much more well thought out than the equivalent feature in Java.Another Example:using System; class App{ public static void Main(String[] args){ Object[] objects = new Object[]{ new Lemon(), new Grapefruit(), new Truck(), new Lemon(), new Lime() };foreach(Object o in objects){Console.WriteLine(o.ToString()); } }} class Citrus{ public override String ToString(){ return "I am a "+this.GetType().ToString(); }} class Lime:Citrus{} class Lemon:Citrus{} class Grapefruit:Citrus{} class Truck{ public override String ToString(){ return "Truck here"; }}
  • #40: Sample Dialog:Interfaces are an excellent way for a type to take on a role without being derived from a type that defines this role. For example, two totally unrelated types can be sortable and therefore take on the well-defined ability to be sorted, even though they are not derived in the same derivation hierarchy. This is possible through interfaces.In C# you cannot have multiple base classes, but a type can implement any number of interfaces.You will find that you implement pre-existing interfaces often, but from time to time you will have to define your own interface. Interfaces can include only methods, properties, and events. It is not valid for an interface to include a field. Interfaces are defined using the interface keyword as shown here.
  • #41: Interfaces are a great feature of object oriented programming. Some languages such as C++ support a concept called multiple derivation. The .NET Framework does not allow for multiple inheritance, and as a result neither does C#. Sometimes, it is nice, however, for a type to be able to take on several roles. This is where Interfaces come in.
  • #42: When Designing a complex software project, it is essential to decompose it into smaller and smaller parts, each of which we may then refine independently.
  • #49: Poster by Derrick Bailey
  • #50: Poster by Derrick Bailey
  • #51: Poster by Derrick Bailey
  • #52: Code sample from Chander Dahl’s presentation, based on writings of Robert Martin
  • #56: Poster by Derrick Bailey
  • #58: Poster by Derrick Bailey