The disposition of objective-C)

Source: Internet
Author: User

Address: http://amattn.com/2011/10/15/the_disposition_of_objective-c.html

After ten years of objc programming, I will discuss some comments on objc here.

Verbose)

This is the most obvious objc feature. Objc programming always uses extremely redundant syntaxes. Experienced objcProgramStaff rely heavily on IDE, etc.Multiple tools to assist coding. If you want to write objc skillfully and beautifullyCode, You have to use a lot of tools to deal with the damn syntax, such as code snippets (snippets), keyboardMacros, custom templates, etc. These skills will be out of the box. Fortunately, the standard message transmission mechanism is easy to read, saving objc a lot of points.

Ugly)

Objc is an ugly language. The C language is used, and the class structure is filled with @ commands-it is like a tramp wearing a garbage bag. ThenSmalltalk. Then property is invented to solve the problem. Finally, a ^ code block (block, which is introduced after ios4, is equivalent to the CFunction) to complete the language.

I love objc, but I still think that the syntax of objc is neither concise nor beautiful.

Readable)

Good objc code is especially easy to read. This is partly due to the syntax preference of the objc imperative. Generally, the message transmission mechanism is a hotbed of program errors. HoweverTo enable the message body to self-describe and read easily.

The message transmission mechanism is the biggest highlight of objc.

Compiled language (Compiled)

There are two notable benefits:

Thanks to compilers and static analyzer, many errors do not have to be captured by programmers. So objc programmers are not stuck with boring and mechanical errors.

The second advantage is excellent program performance. So far, the iPhone 3gs and later devices still have excellent performance.

Ecosystem)

Apple took over objective-C's ide, language implementation, and mainstream libraries. Xcode, llvm, and cocoa make up for the defects in many languages. DueClass extensions, such as subclass, are completed at runtime. If you write your own objc SDK, framework, and library, you will encounter a lot of trouble.

Static type, dynamic type, basic type (static, dynamic or duck typed)

In practice, your ostentatioulay humble author prefers static and original types, because they rarely cause errors. When you doMultiple types are required. ID is a dynamic and convenient tool. Formal and non-formal protocols are the application of ID.

Trend (momentum)

Good wine is fragrant for a long time, objc is also growing. We have obtained attributes, blocks, gcd, and the latest arc. Only a fool can think that objc has no future. YouFor routine useProgramming LanguageWill it become more and more easy to use?

What does objc really lack?

I propose a rumor:

Objective-C: easy-to-expand, easy-to-read (punctuation-based) programming language.

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.