OOP Via C#

(in 30 min or less...)

About me



  • Father(Father first)
  • Professional Software Developer (Since 2008 or so)
  • All around IT Guy(Since 2003 or so)

about me

  • Amateur artist, musician, writer, philosopher
  • Gamer(Not nearly as much of one as I used to be)
  • Nerd (All around Nerd and damn proud)
  • Technology Enthusiast(I like gadgets)
  • Slight Movie Buff (I like to think I know some of the more obscure titles.)

Order of events



  • What?
  • Why?
  • OOP Concepts 
    • C# and OOP

    WHAT IS OBJECT ORIENTED PROGRAMMING?



    A programming style  used to 
    organize code in such a way that makes it
    easier to maintain


    Uses objects as a means of 
    holding information about 
    state and behavior.

    WHAT IS OBJECT ORIENTED PROGRAMMING?


    State

    • The characteristics of an object. 
    (Think nouns)

    Behavior

    • The things an object can do. 

    (Think verbs)

    Why ?



    Maintainability
    (easier to understand, adapt and extend)

    Reusability
    (Don't Repeat Yourself)

    Can be related to in terms of the 
    Real World






    Core Concepts

    what is Encapsulation



    Principle of Information Hiding
    (the devils in the details)

    Restricting Access

    You don't have to know how it 
    works to use it.

    ENCAPSULATION


    ENCAPSULATION

    InheritaNCE


    Principle of class hierarchy. 

    It is the ability for one object to take on 
    the states, behaviors, and functionality of 
    another object.

    (Republican is a type of politician)
    (Democrat is a type of politician)
    (Dog is a type of pet)
    (Cat is a type of pet)

    INHERITANCE

    Polymorphism


    (Poly : Many)

    (Morphism : FormsShapes, Faces)


    Having multiple classes that can 
    be used interchangeably


    Polymorphism

    Example 


    POLYMORPHISM






    C# and oop

    Class


    Describes the blueprint or the prototype for an object.

    Defining a class in C#

    class SampleClass
    {
    }

    object

    object


    The usable instance of a class

    Creating an instance of a class


    SampleClass MyObject = new SampleClass();

    objects and classes

    Class
    (The recipe for a cake)

    Contains blueprint about type of object


    objects and classes

    Object
    (The delishcake)

    Contains the actual object implementation

    properties 


    Properties represent 
    information that an object contains

    Declaring a property in a class

    class SampleClass
    {
        public int SampleProperty { get; set; }
    }

    methods



    A method is an action that an object can perform.
    (think verbs)

    Declaring a method in a class

    class SampleClass
    {
        public int sampleMethod(string sampleParam)
        {
            // Insert code here
        }
    }

    EXERCISE in oop




    CODE



    Refs

    (C# simple examples and defs)
    (good for long winded tech speak oop definition)
    (good tutorial on oop)
    (images)
    (my blog)

    C# in 30 min or less

    By Terrance Smith

    C# in 30 min or less

    • 1,798