SlideShare ist ein Scribd-Unternehmen logo
1 von 7
Class 11 – Intro to Classes
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Introducing Classes ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The Ball Class PROPERTIES Size Base_Color Elasticity Shape Decal? METHODS Roll Bounce Curve? Fly Spin
Classes in Ruby ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
A Class Act! ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Wrap-up ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

Weitere ähnliche Inhalte

Was ist angesagt?

Classes And Objects
Classes And ObjectsClasses And Objects
Classes And Objectsrahulsahay19
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented ProgrammingManish Pandit
 
Reflection and Introspection
Reflection and IntrospectionReflection and Introspection
Reflection and Introspectionadil raja
 
Ruby OOP: Objects over Classes
Ruby OOP: Objects over ClassesRuby OOP: Objects over Classes
Ruby OOP: Objects over ClassesAman King
 
OOP->A Bird's-eye view
OOP->A Bird's-eye viewOOP->A Bird's-eye view
OOP->A Bird's-eye viewSaugata Bose
 
java-corporate-training-institute-in-mumbai
java-corporate-training-institute-in-mumbaijava-corporate-training-institute-in-mumbai
java-corporate-training-institute-in-mumbaiUnmesh Baile
 
Object Oriented Programming : Part 2
Object Oriented Programming : Part 2Object Oriented Programming : Part 2
Object Oriented Programming : Part 2Madhavan Malolan
 
Object oriented programming (oop) cs304 power point slides lecture 01
Object oriented programming (oop)   cs304 power point slides lecture 01Object oriented programming (oop)   cs304 power point slides lecture 01
Object oriented programming (oop) cs304 power point slides lecture 01Adil Kakakhel
 

Was ist angesagt? (12)

Presentation on java
Presentation  on  javaPresentation  on  java
Presentation on java
 
RIBBUN SOFTWARE
RIBBUN SOFTWARERIBBUN SOFTWARE
RIBBUN SOFTWARE
 
Introduction what is java
Introduction what is javaIntroduction what is java
Introduction what is java
 
Classes And Objects
Classes And ObjectsClasses And Objects
Classes And Objects
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
 
Reflection and Introspection
Reflection and IntrospectionReflection and Introspection
Reflection and Introspection
 
Ruby OOP: Objects over Classes
Ruby OOP: Objects over ClassesRuby OOP: Objects over Classes
Ruby OOP: Objects over Classes
 
OOP->A Bird's-eye view
OOP->A Bird's-eye viewOOP->A Bird's-eye view
OOP->A Bird's-eye view
 
java-corporate-training-institute-in-mumbai
java-corporate-training-institute-in-mumbaijava-corporate-training-institute-in-mumbai
java-corporate-training-institute-in-mumbai
 
Java
JavaJava
Java
 
Object Oriented Programming : Part 2
Object Oriented Programming : Part 2Object Oriented Programming : Part 2
Object Oriented Programming : Part 2
 
Object oriented programming (oop) cs304 power point slides lecture 01
Object oriented programming (oop)   cs304 power point slides lecture 01Object oriented programming (oop)   cs304 power point slides lecture 01
Object oriented programming (oop) cs304 power point slides lecture 01
 

Ähnlich wie Class 11 lecture notes

Is2215 lecture2 student(2)
Is2215 lecture2 student(2)Is2215 lecture2 student(2)
Is2215 lecture2 student(2)dannygriff1
 
Moo the universe and everything
Moo the universe and everythingMoo the universe and everything
Moo the universe and everythingHenry Van Styn
 
Objected-Oriented Programming with Java
Objected-Oriented Programming with JavaObjected-Oriented Programming with Java
Objected-Oriented Programming with JavaOum Saokosal
 
Core java and advance java syallabus - Cacit.co.in
Core java and advance java syallabus - Cacit.co.inCore java and advance java syallabus - Cacit.co.in
Core java and advance java syallabus - Cacit.co.incacitnoida
 
Take the Plunge with OOP from #pnwphp
Take the Plunge with OOP from #pnwphpTake the Plunge with OOP from #pnwphp
Take the Plunge with OOP from #pnwphpAlena Holligan
 
A Tour Of Scala
A Tour Of ScalaA Tour Of Scala
A Tour Of Scalafanf42
 
Php meetup 20130912 reflection
Php meetup 20130912   reflectionPhp meetup 20130912   reflection
Php meetup 20130912 reflectionJoelRSimpson
 
Java se 8 fundamentals
Java se 8 fundamentalsJava se 8 fundamentals
Java se 8 fundamentalsmegharajk
 
PHP-05-Objects.ppt
PHP-05-Objects.pptPHP-05-Objects.ppt
PHP-05-Objects.pptrani marri
 
Static or Dynamic Typing? Why not both?
Static or Dynamic Typing? Why not both?Static or Dynamic Typing? Why not both?
Static or Dynamic Typing? Why not both?Mario Camou Riveroll
 
Core java lessons
Core java lessonsCore java lessons
Core java lessonsvivek shah
 
Me, my self and IPython
Me, my self and IPythonMe, my self and IPython
Me, my self and IPythonJoel Klinger
 
Lecture-10_PHP-OOP.pptx
Lecture-10_PHP-OOP.pptxLecture-10_PHP-OOP.pptx
Lecture-10_PHP-OOP.pptxShaownRoy1
 

Ähnlich wie Class 11 lecture notes (20)

Is2215 lecture2 student(2)
Is2215 lecture2 student(2)Is2215 lecture2 student(2)
Is2215 lecture2 student(2)
 
OOPs in Java
OOPs in JavaOOPs in Java
OOPs in Java
 
Moo the universe and everything
Moo the universe and everythingMoo the universe and everything
Moo the universe and everything
 
Objected-Oriented Programming with Java
Objected-Oriented Programming with JavaObjected-Oriented Programming with Java
Objected-Oriented Programming with Java
 
Core java and advance java syallabus - Cacit.co.in
Core java and advance java syallabus - Cacit.co.inCore java and advance java syallabus - Cacit.co.in
Core java and advance java syallabus - Cacit.co.in
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Rails
 
Take the Plunge with OOP from #pnwphp
Take the Plunge with OOP from #pnwphpTake the Plunge with OOP from #pnwphp
Take the Plunge with OOP from #pnwphp
 
OOP in PHP
OOP in PHPOOP in PHP
OOP in PHP
 
A Tour Of Scala
A Tour Of ScalaA Tour Of Scala
A Tour Of Scala
 
Php meetup 20130912 reflection
Php meetup 20130912   reflectionPhp meetup 20130912   reflection
Php meetup 20130912 reflection
 
Core java online training
Core java online trainingCore java online training
Core java online training
 
Java se 8 fundamentals
Java se 8 fundamentalsJava se 8 fundamentals
Java se 8 fundamentals
 
OOP Day 2
OOP Day 2OOP Day 2
OOP Day 2
 
PHP-05-Objects.ppt
PHP-05-Objects.pptPHP-05-Objects.ppt
PHP-05-Objects.ppt
 
Static or Dynamic Typing? Why not both?
Static or Dynamic Typing? Why not both?Static or Dynamic Typing? Why not both?
Static or Dynamic Typing? Why not both?
 
Core java lessons
Core java lessonsCore java lessons
Core java lessons
 
Me, my self and IPython
Me, my self and IPythonMe, my self and IPython
Me, my self and IPython
 
Ravi software faculty
Ravi software facultyRavi software faculty
Ravi software faculty
 
130704798265658191
130704798265658191130704798265658191
130704798265658191
 
Lecture-10_PHP-OOP.pptx
Lecture-10_PHP-OOP.pptxLecture-10_PHP-OOP.pptx
Lecture-10_PHP-OOP.pptx
 

Mehr von Stephen Parsons

Atlantic Woodworkers Website Strategy
Atlantic Woodworkers Website StrategyAtlantic Woodworkers Website Strategy
Atlantic Woodworkers Website StrategyStephen Parsons
 
Chairs Report to LSCRS 2012 AGM
Chairs Report to LSCRS 2012 AGMChairs Report to LSCRS 2012 AGM
Chairs Report to LSCRS 2012 AGMStephen Parsons
 
Program Renewal for NSCC Schools 2010-11
Program Renewal for NSCC Schools 2010-11Program Renewal for NSCC Schools 2010-11
Program Renewal for NSCC Schools 2010-11Stephen Parsons
 
Class 6 truth tables and boolean math
Class 6   truth tables and boolean mathClass 6   truth tables and boolean math
Class 6 truth tables and boolean mathStephen Parsons
 
Class 5 - Set Theory and Venn Diagrams
Class 5 - Set Theory and Venn DiagramsClass 5 - Set Theory and Venn Diagrams
Class 5 - Set Theory and Venn DiagramsStephen Parsons
 
Class 4 IPO and Intro to Ruby
Class 4 IPO and Intro to RubyClass 4 IPO and Intro to Ruby
Class 4 IPO and Intro to RubyStephen Parsons
 
Class 3 Binary & Hexadecimal
Class 3 Binary & HexadecimalClass 3 Binary & Hexadecimal
Class 3 Binary & HexadecimalStephen Parsons
 
Class 1 introduction to logic & problem solving
Class 1   introduction to logic & problem solvingClass 1   introduction to logic & problem solving
Class 1 introduction to logic & problem solvingStephen Parsons
 
Portfolio Of A Community
Portfolio Of A CommunityPortfolio Of A Community
Portfolio Of A CommunityStephen Parsons
 
Cause & effect analysis part 2
Cause & effect analysis part 2Cause & effect analysis part 2
Cause & effect analysis part 2Stephen Parsons
 
Cause & effect analysis part 1
Cause & effect analysis part 1Cause & effect analysis part 1
Cause & effect analysis part 1Stephen Parsons
 

Mehr von Stephen Parsons (19)

Atlantic Woodworkers Website Strategy
Atlantic Woodworkers Website StrategyAtlantic Woodworkers Website Strategy
Atlantic Woodworkers Website Strategy
 
Chairs Report to LSCRS 2012 AGM
Chairs Report to LSCRS 2012 AGMChairs Report to LSCRS 2012 AGM
Chairs Report to LSCRS 2012 AGM
 
Class 10 Arrays
Class 10 ArraysClass 10 Arrays
Class 10 Arrays
 
Program Renewal for NSCC Schools 2010-11
Program Renewal for NSCC Schools 2010-11Program Renewal for NSCC Schools 2010-11
Program Renewal for NSCC Schools 2010-11
 
Class 7 lecture notes
Class 7 lecture notesClass 7 lecture notes
Class 7 lecture notes
 
Class 6a ruby math
Class 6a   ruby mathClass 6a   ruby math
Class 6a ruby math
 
Class 6 truth tables and boolean math
Class 6   truth tables and boolean mathClass 6   truth tables and boolean math
Class 6 truth tables and boolean math
 
Class 5 - Set Theory and Venn Diagrams
Class 5 - Set Theory and Venn DiagramsClass 5 - Set Theory and Venn Diagrams
Class 5 - Set Theory and Venn Diagrams
 
Class 4 IPO and Intro to Ruby
Class 4 IPO and Intro to RubyClass 4 IPO and Intro to Ruby
Class 4 IPO and Intro to Ruby
 
Class 3 Binary & Hexadecimal
Class 3 Binary & HexadecimalClass 3 Binary & Hexadecimal
Class 3 Binary & Hexadecimal
 
Class 2 Math I
Class 2 Math IClass 2 Math I
Class 2 Math I
 
Class 1 introduction to logic & problem solving
Class 1   introduction to logic & problem solvingClass 1   introduction to logic & problem solving
Class 1 introduction to logic & problem solving
 
Portfolio Of A Community
Portfolio Of A CommunityPortfolio Of A Community
Portfolio Of A Community
 
Cause & effect analysis part 2
Cause & effect analysis part 2Cause & effect analysis part 2
Cause & effect analysis part 2
 
Cause & effect analysis part 1
Cause & effect analysis part 1Cause & effect analysis part 1
Cause & effect analysis part 1
 
Class 10 Lecture Notes
Class 10  Lecture  NotesClass 10  Lecture  Notes
Class 10 Lecture Notes
 
Class 9 Lecture Notes
Class 9 Lecture NotesClass 9 Lecture Notes
Class 9 Lecture Notes
 
Class 8 Lecture Notes
Class 8 Lecture NotesClass 8 Lecture Notes
Class 8 Lecture Notes
 
Deck Project Phase II
Deck Project Phase IIDeck Project Phase II
Deck Project Phase II
 

Kürzlich hochgeladen

Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701bronxfugly43
 

Kürzlich hochgeladen (20)

Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 

Class 11 lecture notes

  • 1. Class 11 – Intro to Classes
  • 2.
  • 3.
  • 4. The Ball Class PROPERTIES Size Base_Color Elasticity Shape Decal? METHODS Roll Bounce Curve? Fly Spin
  • 5.
  • 6.
  • 7.

Hinweis der Redaktion

  1. This evening’s class will start with a brief introduction to classes, a concept central to the notion of object-oriented programming. By the time we have finished this class you will have examined concepts related to object-oriented programming and be able to articulate the meaning and utility of classes in programming.
  2. Our agenda is a short one:
  3. We will begin our discussion on classes with an exploration of object-oriented development, an approach to programming that starts by dealing with entities in the code as “objects” that can be manipulated and examined like objects in the real-world. Our code so far has been fairly simple, but at the same time quite verbose – that is, we have had to write a lot of code – often repeatedly – in order to get our solutions to work. We have learned that some techniques like branching, looping and the development of methods can allow us to write more elegant (or tighter) code. OOD allows us to go a step further by modelling real-world objects so that we can use them more effectively. A Class in programming terms is the model of an object: something that represents a thing and can describe properties or attributes of the object as well as the tings it can do – its methods or behaviours. For example, if we wanted to develop a game in which we needed to model a car, we would need to describe the object with the properties as well as the actions that the car can undertake. So how do we describe a car? What are its attributes? [type, model, maker, ext_color, int_color, style, engine_size, hp, warranty, int_fabric]. And what can a car do [drive, backup, accelerate, park] Class creation and manipulation requires certain rules and procedures and those are largely determined by the language. Ruby is a very simple yet robust language that minimizes the rules and procedures needed to create and manipulate its Classes. In addition, Ruby has many built-in classes – some of which we will examine shortly. These built-in classes are part of the default set of capabilities that the language is able to work with and in fact that we have already been working with since the beginning of our work in Ruby. Why use classes? To begin, being able to abstract – or model – an object as a Class allows us to use it as a blueprint or cookie-cutter so we can create numerous instances of the object and manipulate its properties and behaviours. This allows us to re-use the code many times rather than having to write it every time we want to use an object in our code. Second, as a developer if I write a piece of code and want to re-sell that application, I can encapsulate the class into an encrypted object like a java .jar file or a Windows .dll and hide the details of the code that makes it work – protecting my investment and my intellectual property. If I want to use someone else’s class I may be able to simply attach the class to my application and call its properties and methods by following a published API (application programming interface). The API tells us what I can pass to the object and what I will get back from it…I don’t really need to know what’s inside of it. Finally, I can create classes based on other classes – so that if I need to have an object that is like some other object, but has some unique capabilities or features, I can create a Class based on another (its parent) and then just add the additional properties or functions to it. I can also use functions that are in one class across numerous classes through something called polymorphism – as long as I follow some basic rules. Overall, then, Classes allow me to create a model of a business object and deploy or re-use instances of that object that I can manipulate in code. Let’s try an example: let’s think about the idea of a ball. I want you to write down two columns for our class “Ball”. What are all the things that describe a ball (the features that might make one ball different from or similar to another ball) and what are the things a ball can do (something that all balls may be made to do)…
  4. Well here’s the start of a model or abstraction of the Ball Class. The basic attributes might include…(see image) And the basic behaviours could include…(see image) What else did you identify? Are they features of ALL Balls? Now if we instantiate the class Ball by creating a new Ball, then that object should be able to be described by any of those properties and should be able to do any of those methods. If we wanted to create a new class of ball – say Soccer_Ball, then what new properties and methods might we need to add?
  5. Let’s look at some of the built-in classes in Ruby – you can point your browser to the URL shown here and explore some of the Classes in Ruby. We’ve used some of these Classes already, most recently Array – let’s look at that…note the methods listed for the Class “Array” Now look at some others – here are some ideas that might be useful: String, Matrix, Foo (don’t ask), and how about Object! Object is the Mother of ALL Classes in Ruby, so that means that everything that Object can do, every other Class can do too. Looking at parent  child relationships, you can see the inheritance in something like DateTime Class – which is a child of Date. We can develop our own classes based on those classes simply by creating a sub-class…or we can create our own class by using the class keyword, capitalizing the class name and defining the properties and methods of the class – remember that to Ruby both properties and behaviours are all methods, but properties are just laid out to allow us to set the value of a property and to get the value of the property (we’ll see this in a moment when I demonstrate a class in Ruby). Finally, to use the Class – you use the “new” keyword to create a copy of the object and then you are off to the races! Let’s see an example.
  6. In this example, we’ll code the Class Ball and create a ball Color property and a bounce method. Follow along if you can. Initialize is a useful function that is run automatically when the object of the class is created. Although initialize can be left out, it is a good idea to add it in, even if it does nothing more than set the object up. You can use initialize to set up the default properties of the object. The left side is the creation of the Class, the right shows some code we can use to work with the class…we start by creating an instance of the Class using new and then we can do anything that is defined in the class – set the color, get the color, and bounce the ball. Note that when we ask the ball to bounce we tell it the number of times we want it to bounce and it does so. In the next section, I call a random function to set the color of the ball and then I print out the color of that particular ball. If I decided to create a second and third ball, they might be different colors – but each one would keep that property unless we change it.
  7. So for this course, we will not really need to get you developing Classes to any great extent. Our purpose was really to get you familiar with the notion of object-oriented programming and development and to understand a little about how classes work and how you might create and use a class. I don’t suggest that you should create and use Classes in your project or assignment, but you are free to do so if you think you want to. OOP is a subject you would undertake in some detail at the next level or programming such as in our PROG 1040 Programming I or many of our courses in Programming and Web Concentrations. In our next session we are going to look at a technique to evaluate cause and effect in business or workplace situations using a tool called a Fishbone Diagram