1 / 13

Objective-C

Objective-C. Drew Cheng CS420. Overview. True superset of ANSI C Object-Oriented methods from SmallTalk There is no formal written standard for the language Relies on outside libraries Iterative/Imperative Flexibility, most things are done at runtime Dynamic Typing Dynamic Binding

unity
Download Presentation

Objective-C

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. Objective-C Drew Cheng CS420

  2. Overview • True superset of ANSI C • Object-Oriented methods from SmallTalk • There is no formal written standard for the language • Relies on outside libraries • Iterative/Imperative • Flexibility, most things are done at runtime • Dynamic Typing • Dynamic Binding • Dynamic Linking • Message Passing

  3. History • Created by Brad Cox and Tom Love at their company Stepstone • Both were introduced to SmallTalk while working at ITT • Cox was interested in the problems of true reusability in software design and programming • Modified C compiler and created a Object-Oriented extension of C called OOPC • Tom Love added more to OOPC from SmallTalk creating Objective-C

  4. 1986 – Stepstone releases Objective-C • 1988 – Steve Jobs acquires Objective-C license for NeXT • NeXT releases their own Objective-C compiler and libraries used in NeXTstep Operating System and OpenStep API • 1993 – GNU Objective-C runtime, currently in use, created by Kresten Thorup • 1996 – Apple Inc. acquires NeXT and uses OpenStep in new Mac OS X • Apple combines Objective-C and NeXT’s Objective-C, creates Cocoa API, most significant environment

  5. Uniqueness • Messaging/Forwarding • Does not call method, sends message • Target of message is resolved at runtime • Message passing has no type checking • Receiver not guaranteed to respond. No response either return null pointer or “forward” to an object that will respond • Initial interpretation of message in Objc-C 3x longer than C++ virtual method call. Messages are cached and subsequent calls 50% faster than C++ method call. • Categories/Protocols

  6. Primitives • Int, float, double, char • Unsigned, signed, short, long, long long • id – Generic object type • Can be used to store any object • Essential to Objective-C’s dynamic binding • If/Else Statements, For/While/Do Loops • Combine features by nesting, “and/or” conditionals • Abstraction – variables, functions, classes

  7. Functions

  8. Variable Passing • Default method is pass-by-value for primitive data types • Objects use pass-by-reference • Impossible to use pass-by-value for Objects • Does not pass by result, value-result, name, or need

  9. Type Checking • Dynamic type checking • Considered weak typed language • Language supports coercion • When adding float and int, one is changed • Does not support type inference

  10. Object-Oriented • Does not support multiple inheritance • Class must inherit from Object/NSObject class • Variable inheritance is dynamic • Method inheritance is dynamic • The super-method invocation uses method from class that super is called in (dynamic) • No operation and method overloading

  11. Conclusion • Very easy to learn • Simple way of handling classes and objects • Dynamism allows flexibility in code • Errors may are not found until runtime • Not a very used language outside Apple

More Related