Why should developers use Mac OS x and OS x tips? I wrote a great post.

Source: Internet
Author: User
Tags ole
From: http://blog.youxu.info/2010/02/28/why-mac-os-x-for-programmers/

A week ago, I chatted with tinyfool about Apple's operating system and thought that Apple's operating system (Mac OS) was a good choice for developers. Tinyfool's pen was very fast. I wrote a long article right away, and my pen was very slow. Today I only got all the code well. The main starting point of his article is the advantages of the Mac platform as the target development platform. The main starting point of my article is the advantages of Mac OS as a development tool.

Developer Tools
For developers, the maximum purpose of all development tools is to maximize the productivity and creativity of developers ). In our time, using GUI is a good way to increase productivity. Although the Unix developers of the previous generation do not need the GUI. Hackers with a screen, a keyboard, and an editor are everywhere, but over the past 20 years, the development environment has changed dramatically. For example, compared with the text-based environment used by programmers in the past, the rich format of documents in the GUI is more intuitive and the reading experience is better. Even if you do not need to develop any
Gui programs, modern developers also use GUI to view web images and documents. Therefore, even the most traditional command line developers can actually access the GUI. For example, the best terminal programs are all simulated under X. Because of the appearance of these simulated terminals, some complex visualization functions can be implemented in these terminals, for example, Unicode display (rxvt-Unicode.

For developers, it is a great dream to have a group of development tools that can maximize productivity. So where does this development tool come from? In general, these tools come from three aspects: 1. provided through the system and a single application software; 2. use various applications together. by customizing and changing existing applications. These three points are no longer familiar to Unix developers. They are nothing more than writing scripts and taking pipelines. Therefore, in the previous GUI era, this philosophy was very prevalent. Developers knew that they needed to install the script parser, write some scripts, and configure some environments, in order to transform the factory UNIX system into a handy system.
Basically anyone who has been using Unix/Linux for many years has a variety of "private" scripts in the machine. Without these scripts, the efficiency will be greatly reduced.

Traditional loss in the GUI age

In the 1980s S, the era of GUI and PC popularization came. Since then, computers have become personal computers. For the first time in history, computers were not designed for developers but for common users. The demand of common users is to solve one practical problem. The solution provided by the software industry is to provide users with one application software, rather than allowing users to program and write scripts one by one, the huge demand for software instantly makes a huge software industry. This indirect consequence is that, for ordinary users, the only means to turn a computer into a "Personal Computer" that can help them complete their tasks is to constantly install various applications in the stacked beddings.

We can use a simple example to illustrate this usage mode. We all know that an empirical principle for installing Windows systems is to divide the operating system and applications into two logical disks, one on disk C and the other on disk D. The principle of this disk partitioning experience is not only known to Internet cafe owners, but also to the female students who only point mouse in my university. Why is this amazing phenomenon? In fact, this is determined by the typical use mode of Windows users. On Windows systems, applications and documents are the key. The operating system is just something that can be reinstalled at any time. Therefore, the two are separated without affecting each other. Under the guidance of this mode, reinstallation of Windows System disks is very low-cost, as long as the documents are not lost, the application is not lost. How much is wasted
Geek has a wonderful time to reinstall the system, and has contributed to a wonderful marriage :). In short, in the GUI era, an application should be installed to solve a problem. As for the communication between applications and the control of applications by using non-keyboard and mouse methods, it is no longer an issue to be considered, the mainstream operating systems and application software won't let you do this. The operating system blocks all the other routes and clearly tells you to buy software for a certain function.

The Inspiration of Smalltalk


In fact, this is not the case in the GUI era. We all know that the GUI was originally developed by the Alan Kay team of Xerox for scientific research. Bill Gates and Steve Jobs copied some of them to Xerox, so the window and buttons are everywhere. They all saw the graphic interface and the object-oriented form. They saw the graphic interface and placed the buttons, icons, and other objects, and then clicked and dragged them. Because all gui interfaces start from the text interface, all gui programs are actually the packaging of the original executable program. The emergence of C ++ is also very clever. C is packaged into an object-oriented language,
C ++ has easily adapted to the trend of making executable programs GUI, and has become the mainstream development language in the GUI era. On the surface, as long as you run these executable programs, you will be able to see the graphic interface, and you will be able to operate them with the mouse, but the underlying layer of these things, all are compiled executable programs. The runtime environments and object containers in Smalltalk are lost, and all graphic interfaces are used, or directly run on the computer's CPU, rather than a virtual object-oriented container. This object-oriented container (also called "RunTime" or "runtime environment") is the god of smalltalk. To put it simply, Smalltalk itself has an object-oriented runtime, so even when it comes to execution, all the objects in it can still be interconnected.
In addition to being object-oriented before compilation, all programs written in C ++ become machine code as long as they are compiled, and there is no relationship with the object any more, so there is no statement to dynamically view (inspect) and modify (modify) These program objects at runtime. In short, due to historical limitations, these GUI platforms have evolved progressively, so no platform has carefully considered the communication of objects like smalltalk, in addition, as we have mentioned above, the method to expand the system is to introduce new application software, and there is no need for interconnectivity, the implementation method that prevents objects from being controlled by external programs does not matter.

However, developers are not common users. They still need to transform computers into their own tools. When the existing tools cannot solve the problem, you may re-invent the wheel, or you may reuse the existing tools or reconfigure the tools as needed. Therefore, unlike normal users, developers need the configurability of these guis and the interconnection between these GUI programs. In other words, the first problem is related to the scripting of GUI applications, and the second problem is related to inter-process communication between GUI programs. These two problems are simple to say, but they all involve the Fundamental Design Issues of the GUI system. Here is a little joke about history. I gave this only chance.
Mac OS X. For other operating systems, there is no good solution to these two problems.

Inter-process communication, Apple's Solution

There are two flowers in each table. Let's talk about inter-process communication in Gui programs. The so-called inter-process communication (IPC) means information sharing between two programs. As we all know, * a powerful feature of Nix is that pipelines are the simplest, cheapest, and most commonly used * nix inter-process communication methods. In the GUI era, the most common IPC Mechanism is clipboard and mouse drag and drop operations. Although these two operations are intuitive, they all involve human operations and the program cannot automatically complete inter-process communication. To improve work efficiency, the computer must be able to complete these tasks without human interference. In order to automate these tasks, the operating system cannot simply draw windows and then everything is ready. It must know which programs are running and which programs can send messages to which ones can communicate. For example, if we want to automatically select a word from the reader and send it to the dictionary program for interpretation, the computer needs to know that the dictionary program can accept a string while running, but cannot accept images. If we abstract the dictionary program into an object that provides the "dictionary query" service, we have no doubt that if we want to send characters to the dictionary program, we must first know what the dictionary program can accept, how can I send the word to a dictionary.
All such information must be managed by the operating system.(It is impossible for every application to remember the dictionary. This program can accept strings and cannot accept images. In this way, every application must write down information about all other possible applications, this is a square-level relationship. It is unrealistic to take into account all other programs when developers need to develop a program). In the industry, a unified management runtime environment is required to manage the communication between these programs. As we have mentioned above, Smalltalk's God lies in a unified object-oriented runtime, so that all applications can be interconnected. However, the evolution process of GUI programs on all platforms does not follow this path, but only simulates the appearance. Even if some platforms want to achieve interconnection, it cannot be done completely (for example, Microsoft's
Ole, COM, etc ).

Is a good thing, always shine. However, to make this good thing fully accepted by the new operating system, to make a system adopt a unified operating environment from the bottom layer to the upper layer, it is necessary to discard a lot of historical burdens. Getting rid of this historical burden is not easy for any operating system. If we go back to that year, we will be imagining how good it would be to create a clean and tidy GUI system from scratch, regardless of the market or the existing platform. History is such a drama. I have really arranged a person to do this. This person is Steve Jobs.

In 1985, Steve Jobs was swept out by Apple and set up next to create a high-quality GUI computer system. History gave Steve Jobs a chance to do everything from scratch. This time, teachers Joe and the developers of next realized that it was impossible to copy the form of smalltalk, and they had to take it with their gods to design inter-process communication and GUI systems. At the kernel level, they used the Mach microkernel designed for BSD. This operating system kernel is designed to replace outdated UNIX kernels. One core design philosophy is to redesign inter-process communication; although the microkernel-based operating system is no longer a trend (for this reason
Linus and Tanenbaum had a big fight), but compared with the UNIX system kernel at that time (at this time Linux has not yet appeared, the Unix kernel only has BSD, Bell, sun and so on), Mach is a high starting point. In this kernel, next engineers began to build an object-oriented basic system. This system already has a blueprint in Smalltalk. Therefore, these engineers use Smalltalk as the blueprint and first design a C-based language, that is, Objective C, copied the typical [object message: parameter] Syntax of smalltalk.(I personally do not like
In Objective C, Smalltalk is a dynamic object-oriented language. Next has a chance to use the Smalltalk language. If Smalltalk is used, the current cocoa framework will be more beautiful and the code will be more clean. I don't know if Objective C's self-developed language is based on patent considerations. Anyway, all the innovations in Objective C over the past 20 years have taken place, it is just like smalltalk. Java and Ruby have been getting things from Smalltalk over the past few years)
. With the kernel and language, next builds a pure object-oriented runtime environment and class library (and
The idea of a unified class library in Java and. NET is similar, but more than a decade ago.) This class library was called nextstep at that time, so all class names are prefixed with NS, which is very ugly. It is a pity that the class libraries of the Time Beyond the age were too busy, saying that Smalltalk surpassed the time for 20 years, so in the middle of 1990s, programmers remembered that Smalltalk was good, the emergence of Java Ruby and other languages inspired by smalltalk. Although Mr. Joe lags behind Smalltalk for 5 years, he is also ahead of the industry for 5-10 years. Therefore, in 1995, Windows
95 is crazy, but miss Joe's nextstep is not dynamic. He can only repackage the class library and sell it as a web class library, that is, webobjects. This is unintentional, and the business is good, because at that time, web development had been exhausted without a unified Runtime Environment (this is also the reason why Java will become popular in the future ). We say that gold is always shining, but the premise is (1) wait a few more years until the industry returns to realize its benefits, (2) get support from a mainstream operating system, replace all the underlying layers with Jack's stuff. Mr Joe knew the two conditions, so he accelerated the pace of cooperation with sun and wanted to put the system on Sun's workstation.
However, Sun has a strong underlying technology, and Java has been widely promoted during that time. In fact, Mr. Joe won't win much on Sun's road. Besides, Sun has a strong kernel technology, therefore, we must disband nextstep to rewrite the kernel. If we don't play with sun, it will be a problem for the next company to support more than five years. Secondly, almost every company that works as a personal computer has switched to Microsoft, other workstation companies all have their own strong underlying technologies and cannot use Mr Joe's stuff. So it seems that Mr Joe and his Yang spring snow seem to have poor prospects. However, there is no way out of sight. Looking at the market of that year, only one company did not go against Microsoft, nor did it have a strong underlying technology. It also had some roots with Mr Joe. History is such a drama, this company is the apple that swept out instructor Joe.

In the middle of 1990s, Apple had a tough time. the PC market was defeated by the Wintel alliance, and the achievements in emerging markets were also messy, so did investors, sculley, who let Mr. Joe go out, also swept out the house. Then he bought Mr. Joe's company and asked Mr. Joe to resume his job to repeat apple. Therefore, the two conditions we mentioned above are suddenly met: first, he is now the boss, so we can completely reinvent the original Apple system, use your new guy. Second, the engineers at next should not worry about unemployment. Now apple is responsible for paying, so they can just start to transform the Apple system, the main task is to replace Apple's old system with a new system brought by you, and maintain the style of the GUI of the new system and the old system.
This work was completed only when next was acquired in 1995 and around 2001. In the past six years, Mr. Joe also allowed apple to make a profit again.

The Mac OS X released in 2001 is the tenth generation of Apple's operating system. It is based entirely on the class library that Joe developed at next. Naturally, has a unified object-oriented runtime. In this runtime and class library system, Mac OS X calls it cocoa. In fact, Mac OS X is not very good when it comes out, but it depends on this well-designed underlying system, the iterative development cycle of Mac OS X is much shorter than that of other operating systems (only slower than Linux, but only kernel in Linux ). in just eight years, Mac OS X has made seven major releases. Although we look at Mac
OS from 10.0 to 10.6 is only a progress in version number. In fact, every time it is a major release, it is roughly equivalent to upgrading from Windows 95 to Windows 98 or Windows 2000 to Windows XP. Such a release does not change the main version number. On the one hand, it is from the market perspective. On the other hand, it does indicate that the underlying layer of OS X is already in a relatively stable state. Many windows programmers advocate. net. Yes ,. net is indeed a very good framework, but imagine that Apple had a unified runtime in 1995, in addition, all programs have been developed on this unified framework over the years.
The cocoa community is more mature than the. NET community.

Application Scripting

A system with inter-process communication alone cannot be regarded as a completely mature GUI system, because inter-process communication is still at the bottom layer, and applications on the GUI are endless, it is impossible for any problem to be solved by communication between processes at the underlying layer. Therefore, to make the GUI system evolve to an easy-to-use and customizable level, it is necessary to open script control for GUI programs. Only when the GUI program can be controlled externally can the GUI system be used together. In fact, once you have a unified runtime, it is not difficult to use scripts to control GUI programs as long as you design a unified script interface during application software development. For example, Microsoft's office suite can be used completely.
VBScript to control. Unfortunately, no system can implement full system control. To achieve full system control, not only must the system provide the underlying support, but more importantly, it should be able to persuade all developers, or let all developers develop a good habit of opening up the script interface. Technically, this is not a big problem, as long as developers implement specific interfaces according to the unified script communication protocol. However, if there are too many GUI development methods on a platform and developers only choose what they like, such standards cannot be unified. For example, both KDE and gnome have their own scripting systems on Linux, but some developers use KDE and some use gnome,
Some do not need either of them, so we cannot talk about a consistent interface. A platform must have consistent script control interfaces unless (1 ). there is a GUI development method on this platform. Since ancient times, there has been one on Huashan Road. If you don't do it, you can only make standard interfaces. (2 ). most of the mainstream application software on this platform has implemented this script interface, because of the pull of these programs, if other GUI programs want to integrate the existing application software circle on the platform to communicate with each other, this interface must be implemented. In 2000, only one company was able to meet both requirements, namely apple. Microsoft partially implemented these two items and basically used VBA to unify the Office
But out of office, Microsoft's OLE object model is almost useless, and the closely bound VBA is naturally unattended. However, according to some friends who work in the financial industry, VBA can greatly improve the productivity of M $ office.

Gui scripting is not a overnight task. In particular, we say that we need to make a unified script interface to meet the needs of various programs. This is not something we can do in a year or two, it will take many years of technical accumulation and design trade-offs to converge to a relatively stable and mature system, and Apple has had such experience more than a decade ago, why is Apple so lucky again?

In the late 1980s s, there was a software on apple that was far beyond the age, called HyperCard. I once played this software on the last generation of Apple. The specific idea is that you can store a "card" on which multimedia sound, image text, and other objects can be placed, basically, it is the same as the current web page. The only difference is that these cards are stored locally. The HyperCard software can be used for courseware, slide presentation, and so on before the software such as PowerPoint is available. It is an extremely powerful tool. To allow users to customize this card, this program provides a very powerful programming system called hypertalk.
Because this programming language is used by ordinary people rather than programmers, you will feel that it is not programming, but writing English. Although this set of things is basically learned from smalltalk, programming with the English syntax method is indeed a brand new idea. Apple has carried forward this language to ordinary people's programming, the language and documentation are rewritten in a way closer to natural language, imitating the hypertalk system, and a cross-system scripting language called applescript is released. This language is no different from natural language. For example, the size of the window to be retrieved is no longer
window.getSize()
Instead
get size of window

The first word displayed in section 22nd is no longer
print(paragraph[22].getWordByIndex[0])
Instead
print the first word of paragraph 22

Even worse, you can also write in French and Japanese. In the late 1980s s and the early 1990s S, Apple was basically pushed to the corner by PC machines, leaving only the publishing industry, because of the relationship between application software and graphic processing capabilities, the design industry and other professional industries are still guarding the Apple Computer. Users in both industries need automated GUI control, but programming is not very good. Therefore, developers of these applications are also involved in applescript. Before Mr. Joe joined the company in 1990s, Apple made all the finder scripts. quarkxpress and FileMaker in the publishing industry were also completely scripted. After Mr. Joe joined Apple
With the new cocoa technology, Apple released safari, iTunes, iphotos and other software on Mac OS X, all of which were scripted. All the historical opportunities that other companies can expect and cannot find are captured by Apple, and all of them are stuffed into Mac OS X. Now, all third-party development tools, such as Firefox and adium, are not actually developed by Apple, nor are there too many apple origins, but Firefox should read safari bookmarks, use applescript, so Firefox also forces Scripting (this does not exist on other platforms ).
The same is adium. This chat software wants to regard the songs being played by iTunes as status information. Okay, applescript. So it is also scripted, in Linux, Pidgin is not so scripted. Therefore, the apple platform has become a kind of inertia. If you don't want to be scripted, you won't be involved. Do you still want to be scripted?

Conclusion

As we all know, the main philosophy of the UNIX era is to provide developers with a group of small and exquisite gadgets that can be used together at will, that is, the so-called software tools, and then let developers start from this, build your own tools and build your own Swiss Army knife. The purpose of the operating system used by developers is either to provide such a group of development tools, or to provide a convenient platform for such development tools to make such tools possible. If UNIX is an operating system that is easy to transform into an "own operating system" in the command line era, Mac OS X is such an operating system in the GUI era. Even from the perspective of application software,
Mac OS x has a good foundation and makes it easier to produce high-quality software. Therefore, even if only application software is used, developers should give priority to Mac OS X.

Appendix A: relatively correct Mac OS X usage habits

0. Be sure to install quicksilver or use "services". Otherwise, Apple will be used as a Windows server.
1. on Apple computers, because of tools such as services and quicksilver, copying and pasting between 90% of programs can be avoided.
2. copy and paste the remaining 10% programs. If you use a good editor, you can omit 90%.

Appendix B: Why is the Linux system not good enough?

First, the GUI subsystem on Linux is not a part of Linux, but X and the above KDE and gnome
And so on. Over the past few years, these systems have finally begun to centrally manage an object-oriented runtime environment. However, these two systems are all written in C ++, so it is easy to make great effort to get the runtime information and take a long detour, if the two systems are written in runtime languages such as Smalltalk at the beginning, at least the current framework should be able to compete with cocoa.

Second, in the past few years, X has also recognized the shortcomings in script-based control. Therefore, a few years ago, the RedHat standard for desktop was proposed. It is a pity that every program has opened the promise interface, so compared with Apple, there is still a long way to go.

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.