Objective-C programming language-Introduction

Source: Internet
Author: User

Objective-the C language is designed as an exquisite, object-oriented, and easy-to-use computer language. It is fully based on the Standard C language and has made the smallest but powerful extension language. This extended language draws on the earlier Smalltalk style that can support object-oriented languages. Objective-C uses a simple and easy-to-understand method to enable the C language to fully support object-oriented programming.

Most object-oriented development protects the following parts:

  • An object-oriented language

  •  

    A Class Library

  • A series of development tools

  • One Runtime Environment

This document describes the program language, the first part of the development environment. At the same time, it provides a simple description of the second class library, and objective-C provides the programming framework-cocoa. The runtime is described in a separate document --Objective-C
Runtime programming guide
.

Who should read this document?

Readers of this document are expected to be interested in the following:

  • Objective-C Programming

  • Basic information of the cocoa application database

This document not only introduces the object-oriented features of objective-C, but also comprehensively introduces the language itself. Of course, it only focuses on the expansion of C, without protecting the C language itself.

Because it is not a document describing the C language, readers are required to have a basic C language. Since object-oriented is very different from the process of C language, even if you are not an expert in C language, it will not hinder your understanding of this document.

Organizational structure of this document

The following sections cover the C language extensions.

  • "Instances, classes, and messages"

  • "Define a class"

  • "Protocol"

  • "Define attribute variables"

  • "Category and extension"

  • "Joint Reference"

  • "Quick enumeration"

  • "Static binding"

  • "Selector"

  • "Exception Handling"

  • "Thread"

At the end of the article, there is a summary of all objective-C language and object-oriented terms.

Conventions

This document uses simplified and simplified Chinese characters to indicate different parts. The precursor indicates that this part must use such a character and cannot be changed. Bold indicates that this part can be customized. For example, the following code:

@interface
Classname(
Categoryname)

Indicates@interfaceAnd the other two parts are required, but you can select the class name and category name.

In the example code, the ellipsis indicates that some code is available, but it is not displayed:

- (void)encodeWithCoder:(NSCoder *)coder
{
    [super encodeWithCoder:coder];
    ...
}

See

If you have never experienced object-oriented programming, read the article first.Object-oriented
Programming with objective-C
. If you have experience in object-oriented development in other languages, such as C ++ and Java, we recommend that you read this article, because objecctive-C's object-oriented language support is different from other languages.Object-oriented
Programming with objective-C
This helps you familiarize yourself with object-oriented programming from the perspective of objective-C developers. He provides an object-oriented design idea and how to publish a program that faces objects.

Runtime System

Objective-C
Runtime programming guide
Describes the runtime features of objective-C and how you use it.

Objective-C
Runtime reference
Describes the structures and functions provided by objective-C in the runtime system. You can use these support to interact with the runtime system. For example, you can dynamically add classes, add functions to classes, or obtain a list of all classes in the loaded library.

Memory Management

Objective-C supports three methods of Memory Management: automatic garbage collection and memory counters:

  • The Automatic Memory count management (ARC) compiler is responsible for managing the lifecycle of an instance.

  • Manual management of memory counters(MRC, sometimes called MRR as "manual increase/release"), programmers are responsible for all the memory management work.

    Manual memory management methods are described in the articleAdvanced
    Memory Management programming guide
    .

  • Garbage CollectionThe system provides garbage collection to automatically manage memory management and instance lifecycle management. Where you pass responsibility for determining the lifetime of objects to an automatic "collector ."

    The garbage collection technology is described inGarbage collection programming guide. (This technology cannot be used in iOS development.-You cannot see this document in the iOS development center)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.