background preloader

The Objective-C Programming Language: Introduction

The Objective-C Programming Language: Introduction
Objective-C is the primary programming language you use when writing software for OS X and iOS. It’s a superset of the C programming language and provides object-oriented capabilities and a dynamic runtime. Objective-C inherits the syntax, primitive types, and flow control statements of C and adds syntax for defining classes and methods. At a Glance This document introduces the Objective-C language and offers extensive examples of its use. An App Is Built from a Network of Objects When building apps for OS X or iOS, you’ll spend most of your time working with objects. If you’re writing your own class, start by providing a description of the class that details the intended public interface to instances of the class. Categories Extend Existing Classes Rather than creating an entirely new class to provide minor additional capabilities over an existing class, it’s possible to define a category to add custom behavior to an existing class. Protocols Define Messaging Contracts Prerequisites

Learning Objective-C: A Primer Objective-C is the primary programming language you use when writing software for OS X and iOS. It’s a superset of the C programming language and provides object-oriented capabilities and a dynamic runtime. Objective-C inherits the syntax, primitive types, and flow control statements of C and adds syntax for defining classes and methods. At a Glance This document introduces the Objective-C language and offers extensive examples of its use. An App Is Built from a Network of Objects When building apps for OS X or iOS, you’ll spend most of your time working with objects. If you’re writing your own class, start by providing a description of the class that details the intended public interface to instances of the class. Categories Extend Existing Classes Rather than creating an entirely new class to provide minor additional capabilities over an existing class, it’s possible to define a category to add custom behavior to an existing class. Protocols Define Messaging Contracts Prerequisites

Coding Goûter « On n'apprend (toujours) pas la programmation à l'école ? Amusons-nous avec nos enfants à coder en mangeant des gâteaux et des bonbons ! Learning Cocoa with Objective-C From WikiContent Based on the Jaguar release of Mac OS X 10.2, this new edition of Learning Cocoa covers the latest updates to the Cocoa frameworks, including examples that use the Address Book and Universal Access APIs. Also included with this edition is a handy quick reference card, charting Cocoa's Foundation and AppKit frameworks, along with an Appendix that includes a listing of resources essential to any Cocoa developer--beginning or advanced. This is the "must-have" book for people who want to develop applications for Mac OS X, and is the only book approved and reviewed by Apple engineers. Contents Author ; James Duncan Davidson Copyright Copyright © 2002, 2001 O'Reilly & Associates, Inc. Printed in the United States of America. Published by O'Reilly & Associates, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O'Reilly & Associates books may be purchased for educational, business, or sales promotional use. ) is used with permission of Apple Computer, Inc.

9 Code Smells of Preprocessor Use - Quality Coding Preprocessed food also smells [This post is part of the Code Smells in Objective-C series.] Every time you use the preprocessor, what you see isn’t what you compile. With few exceptions, using the C preprocessor is a code smell. Here’s a handy command to run from Terminal. find . \( \( -name "*. This command builds in some exceptions. Here are some common preprocessor idioms, and how to replace them: 1. Let’s start with a simple one that comes from our C heritage: Smell Unless you’re delivering platform-agnostic C or C++ code, there’s no reason to use #include, along with the accompanying include guards. 2. #define WIDTH(view) view.frame.size.width Just because you’re in Objective-C doesn’t mean you can’t use plain C functions! And this isn’t your dad’s C! static inline CGFloat width(UIView *view) { return view.frame.size.width; } 3. Now we begin a set of preprocessor smells around constants. #define kTimeoutInterval 90.0 If a constant is used only within a single file, make it a static const.

Cocoa Dev Central: Learn Objective-C Objective-C Objective-C is the primary language used to write Mac software. If you're comfortable with basic object-oriented concepts and the C language, Objective-C will make a lot of sense. If you don't know C, you should read the C Tutorial first. This tutorial is written and illustrated by Scott Stevenson Copyright © 2008 Scott Stevenson Calling Methods To get started as quickly as possible, let's look at some simple examples. [object method]; [object methodWithInput:input]; Methods can return a value: output = [object methodWithOutput]; output = [object methodWithInputAndOutput:input]; You can call methods on classes too, which is how you create objects. id myObject = [NSString string]; The id type means that the myObject variable can refer to any kind of object, so the actual class and the methods it implements aren't known when you compile the app. In this example, it's obvious the object type will be an NSString, so we can change the type: NSString* myString = [NSString string]; Accessors

PHP Simple HTML DOM Parser Index Quick Start Top $html = file_get_html(' foreach($html->find('img') as $element) echo $element->src . foreach($html->find('a') as $element) echo $element->href . $html = str_get_html('<div id="hello">Hello</div><div id="world">World</div>'); echo file_get_html(' $html = file_get_html(' foreach($html->find('div.article') as $article) { $item['title'] = $article->find('div.title', 0)->plaintext; $item['intro'] = $article->find('div.intro', 0)->plaintext; $item['details'] = $article->find('div.details', 0)->plaintext; $articles[] = $item; } print_r($articles); How to create HTML DOM object? $html = str_get_html('<html><body>Hello! $html = file_get_html(' $html = file_get_html('test.htm'); $html = new simple_html_dom(); $html->load('<html><body>Hello! $html->load_file(' $html->load_file('test.htm'); How to find HTML elements? $ret = $html->find('a'); $value = $e->href;

4 Free E-Books on Learning Objective-C, the Programming Language of iOS and OSX Want to write apps for OSX, the iPhone or the iPad? You can learn JavaScript and use a frameworks like PhoneGap or Titanium. Or you can learn the official language of Apple operating systems: Objective-C. The debate over whether to build mobile apps in JavaScript or Objective-C is beyond the scope of this blog post. But if you want to learn Objective-C, these resources will get you started. Become an Xcoder: Start Programming the Mac Using Objective-C Become an Xcoder: Start Programming the Mac Using Objective-C by Bert Altenberg, Alex Clarke and Philippe Mougin is a programming book for absolute beginners. Objective-C 2.0 Essentials Objective-C 2.0 Essentials by Neil Smyth is an introduction to Objective-C available for free online. Learning Cocoa with Objective-C Learning Cocoa with Objective-C by James Duncan Davidson. The Objective-C Programming Language The Objective-C Programming Language is an introduction to Objective-C from the official Apple website.

Objective-C Objective-C source code program files usually have .m filename extensions, while Objective-C header files have .h extensions, the same as for C header files. History[edit] Objective-C was created primarily by Brad Cox and Tom Love in the early 1980s at their company Stepstone.[2] Both had been introduced to Smalltalk while at ITT Corporation's Programming Technology Center in 1981. The earliest work on Objective-C traces back to around that time.[3] Cox was intrigued by problems of true reusability in software design and programming. He realized that a language like Smalltalk would be invaluable in building development environments for system developers at ITT. Cox began writing a pre-processor for C to add some of the capabilities of Smalltalk. In order to demonstrate that real progress could be made, Cox showed that making interchangeable software components really needed only a few practical changes to existing tools. Popularization through NeXT[edit] Syntax[edit] Messages[edit]

DBTA - Database Trends and Applications

Related: