1 / 26

Object Oriented Programming Course Introduction

Object Oriented Programming Course Introduction. Dr. Mike Spann m.spann@bham.ac.uk. Course Introduction. This course introduces you to object oriented programming using C# and the .NET programming environment

kalb
Télécharger la présentation

Object Oriented Programming Course Introduction

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Object Oriented ProgrammingCourseIntroduction Dr. Mike Spann m.spann@bham.ac.uk

  2. Course Introduction This course introduces you to object oriented programming using C# and the .NET programming environment It also teaches you a few more advanced techniques such as graphics/multimedia programming and web form programming You will be introduced to object oriented design techniques using UML notation

  3. Course Introduction The course will consist of lectures, tutorials and an un-assessed programming exercise It is assessed by a major programming assignment only (no exam!)

  4. Recommended Textbook • There are already dozens of textbooks on C# • You need to choose one which suits you and your budget • The course recommended book is: • Visual C# 2010. How to Program. 3rd Edition. H.M. Deitel, P.J. Deitel • Published by Pearson • ISBN 0-13-701183-0 • It has everything there but is rather long and glosses over some important detail at times • Amazon Link

  5. Course resources Course web site Visual studio home page Visual C# developer centre Visual C# basics

  6. Course contents (Week 1) Course Introduction Introduction to C# Classes and Objects Inheritance and Polymorphism Interfaces, Callbacks, Delegates and Events Graphical User Interfaces Graphics and Multimedia Multi-threading Files and Streams Windows Forms and ASP.NET

  7. Visual Studio • Visual Studio 2012 is now installed on the School network and it is recommended that you use that for your assignment • Do not use the express version! • You can install VS2012 on your laptop for free using the University MSDN agreement • Go to https://www.epsit.bham.ac.uk/software/msdn-aa/ • As far as I know, VS 2013 not installed on the school network but you are welcome to install it • I have it on my office machine

  8. Object Oriented Programming (OOP) Introduction • OOP: Now the dominant way to program, yet it is over 40 years old! (Simula '67 and Smalltalk '72 were the first OOPLs) • Dr. Alan Kay received ACM’s Turing Award, the “Nobel Prize of Computing,” in 2003 for Smalltalk, the first complete dynamic OOPL • It was slow to catch on, but since the mid-90’s everybody’s been doing it! • OOP emphasizes objects, which often reflect real-life objects • have both properties and capabilities • i.e., they can perform tasks: “they know how to...”

  9. OOP Introduction • A simple way to think about designing and implementing a system using OOP is to ask the following 3 questions about your proposed system: • What are the system’s objects? • What do those objects know how to do? • What properties do those objects have?

  10. Examples A B Digital watch

  11. Examples (Digital watch) • What are the objects? • watch display, buttons A (set mode), B(adjust time), timer • Capabilities: What do those objects know how to do? • watch display: • be created • display the time or hours/minutes digits individually • button A: • sets/resets display mode • button B: • sends message to watch display to increment/decrement hours/minutes digits

  12. Examples (Digital watch) • What properties do those objects have? • watch display: • size • background colour • text fonts • flash on/off • display mode • button A, button B: • size • colour

  13. Examples Traffic light controller

  14. Examples (Traffic light controller) • What are the objects? • lamp controller, sequencer, traffic sensor, priority scheduler • Capabilities: What do those objects know how to do? • lamp controller: • be created • turns red, amber, green lamps on and off • sequencer: • be created • sends on/off signal to lamp controllers in correct sequence and at correct times

  15. Examples (Traffic light controller) • Capabilities: What do those objects know how to do? (cont) • traffic sensor: • be created • determines mean vehicle count per unit time • priority scheduler: • be created • sends on/off signal to lamp controllers in correct sequence and at correct times

  16. Examples (Traffic light controller) • What properties do those objects have? • lamp controller: • sequencer: • sequence intervals • traffic sensor: • averaging window size • priority scheduler: • traffic through-put requirements

  17. Examples Tetris

  18. Examples (Tetris) • What are the objects? • piece, board • Capabilities: What do those objects know how to do? • piece: • be created • fall • rotate • stop at collision • board: • be created • remove rows • check for end of game

  19. Examples (Tetris) • What properties do those objects have? • piece: • orientation • position • shape • color • board: • size • rows

  20. So what is object oriented? • In OOP, objects are considered anthropomorphic • the object has both storage and behaviour to operate on its current state • eg bed can make itself, door can open itself, menu can let selections be picked • but, each must be told when to perform actions by another object — so objects must cooperate to accomplish task • Each object represents an abstraction • a “black box” - hides details you do not care about • allows you as the programmer to control program’s complexity — only think about salient features

  21. So what is object oriented? • So, OOP involves writing programs by modeling the problem as set of collaborating components • you determine what the building blocks are • think about the object, their behaviour and their properties • put them together so they cooperate properly • think about how they interact with other objects • A simple analogy is like building with smart Legos, some of which are pre-defined, some of which you design!

  22. What exactly is OOP? • 3 components: • Data abstraction • implementation, interface • Encapsulation • ‘packaged’ objects • controlled interaction with other objects • Polymorphism (‘many forms’) • objects can assume ‘many forms’ through same interface

  23. Why OOP? • Allows the management of complexity. • How? • Controlled object behaviour and interactions as defined by the object state. • Allows for extendibility and re-usability. • How? • Classes are packaged with well defined interfaces and hidden implementations.

  24. OOP Applications • What is OOP good for? • Modelling asynchronously interacting objects. Eg: • GUIs • Event simulation • Ray tracing visualisation • CAD simulation • Real-time control/embedded systems • Robotics • Image/Video processing • Client/Server systems

  25. OOP Applications • What is OOP not good for? • Mathematical programming (use MATLAB or MATHCAD!) • Data processing

  26. youtube Intro to OOP http://www.youtube.com/watch?v=OQjPcS1tkDQ

More Related