iOS SDK and iOS development platform history

Since 2007, after Steve Jobs announced the first generation of iPhone, iPhone immediately got a lot of fans, they love this product as crazy. But the big boys in the cellphone industry never think it a big deal. Nokia mocked Apple, No one will use a phone like that. Fans of blackberry looked iPhone user as freak, why on earth did anyone will use a phone without keyboard, how did you input? Yes, at the time of iPhone first generation, if you compared the function list of iPhone and a Nokia phone, you might say, this is a garbage, even can’t support 3G, etc. The New York Times and the Wall street Journal, they really liked this product and put a lot of good word for it, but they didn’t really think it will have a great future.

But after serval years, two giants (Moto and Nokia) in this industry have beed acquired by others, now people don’t like DC and DV anymore. One product of one American company, pulled down Nokia from its throne, made all the market accumulation of Japan digital products to nothing, all in one night.

But at that moment, iPhone didn’t support third-party apps yet. Now, some people are accusing Apple don’t support Web developers, they just don’t remember at that moment, iPhone didn’t support any native app, all the third-party apps must developed with HTML.

In this article we will talk about the history of iOS 1-8 SDK, and how these SDK change the developer and change the world.

iPhone OS 1 SDK

iPhone OS 1 SDK announced at March 2008, Developers already couldn’t wait any longer, they rushed into, this was the beginning of the mobile internet’s golden age.

iPhone OS 3 SDK

The first big update of iOS is iPhone OS 3. In this version, apple bought in a lot of functions, which users looked forward a long time, include copy and paste, landscape orientation keyboard, multimedia SMS, and so on.

For the developers, the significant point is, iPhone OS 3.0 SDK provided the support of iPhone accessories, and after that countless iPhone accessories appeared on the market.

And in this version, Apple started to provide Map API, and this brought out a new type of app, LBS App.

And music library access, people waited it long enough.

In this version, Apple started to provide a push notification service, use this service, all the notifications send from Apple’s server, iPhone only need to maintain one persistent connection with the server, then can get all notifications to any apps in the iPhone. This method can get best efficiency of power usage and performance. Since then, real online chat tools appeared in iOS platform, and this brought a great nightmare to all patients with obsessive-compulsive disorder, they started to busy on clear the number appeared on the right-top corner of every app icon.

In-App Purchase gave developers a new business model, they can make some free apps and games, and in the app they sale digital contents, chargeable functions and game props to make money. This function has great impact for App Store and whole mobile develop environment.

From the language point of view, after iPhone OS 3.0 released, developers usage rate of Objective-C raised from 0.1% to 9%, for now. On the Programming Community index, Objective-C already got the top 3 position. And it is wroth to mention that, Objective-C always isn’t a multi-platform language, is mainly used for iOS and Mac platform. Almost all the other languages at the top positions can use at almost all the platforms.


Figure 1: TIOBE Index for Objective-C

One big improve of iPhone OS SDK 3.0 is iPhone OS SDK 3.2 for iPad. In this version, Apple announced a new concept Universal App. Developers can provide both iPad and iPhone version in one app, the technic behind this is Fat Binary, you can put serval CPUs binary in one executable file. This technic has been used at Mac OS X migrated from PowerPC CPU to Intel CPU, and the migration of 32-bit to 64-bit CPU. The benefit of using this technic is that, user never need understand the different of iPhone and iPad, or PowerPC and Intel, or 32-bit and 64-bit, user can just download one app, and consider everything is done.

For help developers migrate app from iPhone to iPad, Apple support every iPhone app run at iPad, as 1X display model and 2X display model, Apple and developers may think that will make users happy. But very soon after iPad released, all the popular iPhone app can run at iPad, the developers were forced by users to provide a iPad optimised version.


Because iPhone SDK can run both on iPhone, iPod touch and iPad, so cause some ambiguity. Apple try to unify the brand, so from iOS 4.0, they change iPhone OS SDK’s name to iOS SDK.

Even from the first version of iOS, it is a fully functional UNIX base mutiltask operation system, but third-party app isn’t allowed run in background, any third-party app once it has been switched to the background will be killed. So some users and developers think iPhone is a single task system. But after iOS 4, Apple started to support all apps to quick switch, it means, after third-party app been switch out to background, it will not be killed, it will be suspended, once it been switch back, it will continue run immediately.

And for audio play app, VoIP app, LBS App, iOS 4 started to provide fully background running support. These consideration come from power supply, perform cace, functionality, may be can not fit all the needs of developers, but great improve the app catalog of App Store and their functions.

And this version, Apple started to use iAd, but for now, iAd still isn’t a very big deal for Apple.

The device announced with iOS 4 is iPhone 4, it is the first device support retina screen ever. In iOS 4 SDK, Apple provide a technic 2x image to support retina screen. Many developers don’t take seriously about retina screen, but very soon after that, eyes of users have evolved, they can easy tell if the app provide retina screen optimise or not, if not, they will keep complaining to the developers. So, just after three month or longer, retina screen optimise became the normal situation for App Store, all the popular apps have retina screen optimised.


From this version, Apple announced iCloud, this action means MobileMe is a total failure. iCloud has been mixed reception from birth, recently naked celebrity pictures leak event got iCloud more and more criticism. But you can’t argue, iCloud brought a lot of users to the Cloud Age. iCloud might still have some problems, but developers originally need buy their own servers, pay money to data storage, now they can use iCloud free to provide same function. And you know why, Chinese developers don’t very care iCloud.

At language level, iOS 5 SDK add ARC. Objective-C on iOS use reference counting technic to manage memory. Good side is this will great reduce memory consume and improve performance. But bad side is obvious, it need developers always watch memory, write code very carefully to make sure not leak (forget release) and not crash (early release or over release).

This causes a lot of pain and works to developers. ARC technic use LLVM to make static code analysis, automate add reference counting code, reduce a lot of works and difficulty. Then, it still harder than GC, but get the same performance with Manual memory management, and it have great performance and memory consume benefit compares with GC. So, it a petty good tradeoff of convenient and performance. Now, unless you are considering to support devices under iOS 5, all the project is using ARC.

Like iCloud, Storyboard’s release is mixed reception too. But in my point view, this improvement is great, but not prepared enough.

Storyboard transform entire UI interactions switching processes in the form of a flow chart to modeling, use it right, you will find that the structure of the entire project becomes clearer, and using Storyboard in Universal App you will find it is very convenient.

However, the file format issue of Storyboard (all views information in one file) make code management tool difficult to use in large projects, specifically when you need synchronise or merge. Also, because the transition from XIB to Storyboard too fast, Storyboard can’t perfect support some features of XIB yet. These issues will undoubtedly affect a lot of projects, so that they don’t want to use Storyboard yet.

Screenshot 2014-09-21 19.54.08-18

Storyboard looks like a prototype programming tool

In addition, this generation iOS API also launched a very promising magazine rack – Newsstand, but the digital magazine industry as a whole decline, Newsstand did not ultimately form a big trend.


iOS 6, many specific improvements, but not many new things added. The first is switch from Google Maps Maps API to Apple Maps API. Apple’s map still subject to a lot of criticism, because there are some error and inconvenient, innovations and improvements of Apple were ignored by users. However, it seems that Apple is sure to provide your own map service. So developers can continue to use the official maps API or use Google Maps API. In China the problem is more complex, developers also can choose Baidu maps and AMap.

PassBook could have been the highlight of iOS 6, but unfortunately it has a good start, but slowly flow back to dull, Pass Kit users are not so many now. This strategy largely failed.

Overall, iOS 6 made ​​a lot of detail improvements, and the entire system has become more mature, more stable and fit the user habits. This forms two voices, one is that iOS don’t need big change, change will cause chaos; another voice is iOS developing so many years, there is no changes and innovations, need big change.


Apple chose to change, the entire interface redesigned, UI and UE of this generation is the most controversial. “Apple boom-bust” This old-fashioned view after iOS 7 release also put it up. Countless people from all aspects of argumentation appearance, they think iOS 7 will fail. However, after released iOS 7, the officially results is, users’ upgrade enthusiasm are higher than any previous version.

Many application developers have caught the new operating system benefit, timely introduced new version, some even introduced re-pay new version, got a lot money.


From this generation, iOS applications began to support 64-bit, but for developers, it is completely transparent, most developers do not even need to do any settings to make their application support 64-bit.

In addition, Apple also launched its own 2D game engine Sprite Kit, but since most games have cross-platform strategy, so the Sprite Kit isn’t very popular.


In outsiders’ eyes, iOS 8 SDK is the most bland, because the appearance is almost identical with iOS 7. However, iOS 8 SDK is the largest iOS upgrade in developers’ mind. In this version, Apple for the first time allow communication between Apps in the form of App extensions; supported App extension types include sharing, action, today, photo editing, storage, and third-party keyboard. Among them, action, today and third-party keyboards are most attention.

Many operations, previously limited to iOS iOS platform security mechanism, can not perform elegantly, finally you can do it now.

For example, 1Password, an app widely used by iOS / Mac users, it can be very convenient to use in the Mac, when you use the browser to open a website, you just click on the 1Password browser plug-ins, it can be based on your current browser Web site address should be filled in, automatically match the user name and password. In iOS 8 Previously, users must open a separate 1Password, search needed Web site, and then copy the password, and then back to the browser or a specific application to paste the password, very inconvenient. And in iOS 8, 1Password extension made ​​a motion to elegant solution to this problem.

Third-party keyboard after iOS 8 officially released in China, but also set off a wave of small boom, domestic manufacturers have done IME own third-party keyboard. There are many users see after iOS 8 support third-party keyboards, have said: This is n’t any reason left to use Android and jailbreak.

And from this generation, iOS began supporting Touch ID, Touch ID is Apple’s unique fingerprint authentication technology. Application using Touch ID, you can use a fingerprint to cache passwords after the user enter the correct password, when app requires again password, the user simply gently put finger on the Home button, can be very convenient and very safe. Because the fingerprint information is stored on a dedicated chip, operating system and applications can’t access the fingerprint information itself, can only be obtained if the fingerprint verification is successful.

The fingerprint cached passwords or other information on each machine can be clear, when phone restart, or fingerprint information modified, or just timeout, to fully guarantee safety. Another benefit of this design is that any application using a password, you can easily add fingerprint protection, without the need to modify the design of the entire application logic and use processes.

Health Kit is another major improvement of iOS 8, in fact iPhone 5s start using M7 processor, it don’t consuming CPU to tracking steps and almost don’t cost any energy.

Some people think this is a serious and qualified monopolies very complex market. But I happen to believe that enter the health care market is difficult, and is not necessary, but the health monitoring market in fact is empty, Apple is very easy to enter. Moreover, Apple’s main business is not making health monitoring products, but to provide integrate interface and operator interface. Soon after iOS 8 was released, we found step tracking software started communicate between each other. So you can imagine the future, one day you use X’s blood glucose meter, because their measurement is the most accurate, but you use the Y’s blood glucose monitoring software because their analysis is most intuitive.

Future health field is definitely not so simple as electronic medical, but as we can finally signs on the human body for more continuous, ongoing monitoring, we will be expected to develop exercises, treatment and care programs, based on each person’s symptoms, which far-reaching significance for the future of humanity.


We can see the Apple Watch can monitor and record heart rate data, step data at same time, in this case, the user can perform a long continuous multi-parameter measurements. Then one day you will find that you do not need the guidance of a doctor or health according to the guidelines for exercise and rest, because the system can be based on extensive analysis of your physical features, including the relationship between the frequency of heartbeat between exercise intensity and so on.

Screenshot 2014-09-21 20.02.05-29

While released iOS 8, Apple also released a new programming language Swift, compared to Objective-C, Swift more object-oriented, removed all the burden of the C language, but keep on Objective-C compatibility.

In the API level didn’t modify any call of Cocoa touch, which greatly protects the time and energy costs on the old programmers Objective-C and Cocoa touch framework. Meanwhile, Swift is an innovative design language, is relatively easy to get started, a lot of people because Swift has sparked enthusiasm for iOS development. The language learned a lot from current popular languages. Write code in Swift is easy and convenient. But in order to ensure the safety of memory read and write, Swift proposed a new type of variable “Optional”, this has brought some benefits, such as tedious codes use Swift and Optional can become clear and understandable. But Optional also brought a lot of highly complex and ugly code. Because, Swift has, after all, a new language, and we hope that it will soon mature to give us the ease and convenience.

Another major improvement of iOS 8 is HomeKit. Use iOS device control smart home devices. This interface supports you use Siri to control home appliances, Harry Potter’s world is about to come in your home.

Another interesting API is Handoff, if you have the same application installed on the Mac, iPhone, iPad or using some same system apps, you switch from one device to another device seamlessly.

For instance, your are reading an article use Safari browser on Mac, suddenly you feel a little tired, want to play with the phone lying in bed, then you leave the table, lying in bed, turn on the iPhone screen, you will find an addition Safari icon at lower-left corner of the screen. If you pull this icon to unlock, iPhone will open Safari, then load the link you’re watching on your Mac before. Or, you’re writing a text message on the phone, suddenly felt the phone typing too slow, you can go open the Mac, hold down the Command key and the tab key to switch applications, you will find a list of application icons appear, and a short message icon in front of them, switch to this icon will open the system message application then automatically jump to dialogue before, resume the text that you have already typed. Not only that, Handoff technology also supports you use Mac, iPad to answer iPhone calls, outgoing calls using the iPhone as a router.

Although iOS 8 has just released, its inherent power has not completely been released, but people already are excited. Looking back five years, I think the iOS system has been improved in the forward direction, good rhythm. I hope we can develop more good app for this excellent system.

Use FFmpeg extract images from videos on Mac

I am working on  a mac open source project Wall-E, this project’s purpose is build a video management tools using face to classify videos.

So first step is extract images from videos.

First install ffmpeg, very easy:

brew install ffmpeg

After install ffmpeg, extract image is very easy:

ffmpeg -i xxx.mp4 -r 0.1 -f image2 image-%3d.jpeg


  • -i is for the input filename
  • -r is for how many frame to extract for 1 second
  • -f is for output format

and more can see “How to extract images from a Video using FFmpeg“.

How to adopt the rapidly changing future and why you old dogs can’t learn new trick

Our world, our future is rapidly changing. At the age of the Industrial Revolution, one invention can change the whole world, change the life style of all the people on the earth. But now, there are so many inventions can change our life. So, try to imagine what will happen.

For example, when Steve Jobs first announced iPhone on January 9, 2007, Nokia didn’t believe apple will be a strong  competitor. But many years later, Nokia and Motorola both were acquired by other company.

People can predict it, It is very normal, in an industry, always some companies rise and others fall.

But at the very moment of iPhone birth, was there anyone can predict, because iPhone and other new smartphones rise, digital camera and digital video recorder industry will  fall?

This is just the iPhone, but what next is auto drive car from Google, Dragon spacecraft from SpaceX, 3D printer, Tesla, Uber, Skybox Imaging, and so on. Any of these can change the whole world, so try to imagine all of these, and others we might not know yet.

How to adopt the rapidly changing future?

I think we need: Open mind, quick learn and work hard.

Open mind

After I heard about Uber, I have thinked it over and over.

And I ask almost every friends in the industry, “If 5 years ago you was chosen to improve the Taxi system by government  or a big company,   they and you want make the Taxi system more smart,  have internet connect ability, what would you do?”

And I said,”I  think you might want put some embed system on the Taxi, might chose x86 embed system or arm, and with 3G and wifi support, and have GPS. Did you?”

They usually said yes.

But Uber never need install any hardware on the car, every driver have a smart phone. And smart phone usually better than some kind embed system on you car.

Now let’s change a different perspective, at the age before Uber,  how to organize all the taxi in a Taxi system?

We must build a call center, there are hundreds of agents deal with customer requests. When you call the Taxi company said you want a ride to airport, one of their agents will pick up you call, and send a radio broadcast to all the Taxi driver in the city. No matter how far away a Taxi to you, the driver can receive  the broadcast, Whose dial first, get the job to pick you up.

This system have 3 problems. First is they can’t guarantee the Taxi nearby get the job, it is means you might have to wait a lot of time. Second is once a driver turn on the radio broadcast receiver, he must listen every  broadcast, no matter far or near. Third is the most important one, is this system can’t easy scale up, because the limitation of human resources and telephone lines.

But how do Uber solve this problem? When you use Uber app to request a ride, there is no one pick up your call, just a server side application check your status, find the cars nearby, and send them information, if one of these cars response, then you get your ride. If not, system will send information to more faraway cars. So you are guaranteed get the most nearby car to pick you up.

Ok, I know today everyone can understand Uber and iPhone. But when iPhone just birthed, so many people said, “I will never buy this kind phone, it doesn’t even have a physical keyboard!!! “. But today, there are so many touch screen phone, and where is the physical keyboard? 

We always think something familiar  is normal, think anything unknown is odd, this is a part of our human nature. But this nature is harmful to us in this rapidly changing age.

We need try to put down prejudice to think deeper and think out of box, keep open mind.

Quick Learn

Every technological revolution will tremendously improve productivity, so people are always wondering this will cause unemployment rise. But after times of  technological revolution human race still keep reproduction and development, life on earth is better than ever.

When productivity improved, same job needs less workers, or same workers less work time. So there will be some unemployment. But people can get cheaper product and work less time. So, when people have more free time, they need entertainments, need social interacts. These needs  give people the opportunity to develop entertainment industry and catering industry. And when these industries rise, they need workers, so unemployment problem is solved.

So, look at a very short period, you will think technological revolution will cause unemployment, but in a long period view, technological revolution only will cause labor redistribution. So, everyone lost jobs in the  technological revolution age, isn’t because he can’t find any job, is because he can’t find a job he can participate in. He just don’t have the skill or learning ability.

Because 3D printer, auto drive car, this time, all the work relate to manual work will be replace by computer. So there will be very large unemployment, but at same time, factories and companies will need more and more programmers and operators to deal with the new computer system.

It will be a disaster, if you can’t learn anything new, and it will be a huge opportunity, if you can quick learn.

Work Hard

This isn’t need to talk a lot.

Talk is easy, but why you old dogs can’t learn new trick?

Everybody think himself, “Open mind, quick learn and work hard”, But there are not so many really are.

At 2009 when I first learned Objective-C and write my iOS app, it took me two weeks. I thought this was slow, but later notice that at that moment in Beijing, maybe only 20-100 people can write Objective-C code.

Three years later, I ask some of the people, they try again and again, but never learn how to write  Objective-C code, “Why can’t you learn Objective-C?”

Someone said,  “Mac is too expensive.”

Someone said, “I think Objective-C is too hard, I really can’t understand [object method]”

Someone said, “I need mentor, but I just can’t find one.”

And someone said, “I need be supervised.”

Then after some years, when swift come out, they said “I finally will learn how to write iOS app”, But I don’t think so.

Maybe swift is easy than Objective-C, but swift is odd too, if you can’t open mind to Objective-C, I think you can’t open mind to swift either.

No one will supervise you, if you want learn quick, you must learn how to self educate.

And, work hard is no meaning before you start.


Yesterday, I just randomly bought a movie call “The Secret Life of Walter Mitty”. After 5 minutes, I was shocked by the coincidence in my life and this scenario. I have a account too, and when I saw a girl I like, I just can’t send wink either, I think human relations and feelings are just too complex to me.

And when I finished watching the whole movie, I found more and more coincidence.

Walter Mitty is 42 years old, and I am 35.

He worked at Life Magazine for 16 years, and I am in IT industry for 13 years.

He left the “Been There, Done That” section in blank, and just before this year, I never have a long holiday, never have a travel to anywhere.

He worked hard for a magazine, but he still been fired, last year my company was in big trouble, I had to fire almost all my employees to keep the company.

And I like daydream too.

If we aren’t in trouble, we never will think about life.

What is the life? What is I am looking for? I don’t really know, I don’t really understand.

So I try to break some invisible lines in front of me, some invisible boundary around me.

I started walking, and lost 44 pounds.

I flied to HongKong, to Xiamen, Guangzhou, Zhuhai, Wuhan and so on.

I started write this blog.

I still have a lot of to figure out, but I think I made a lot of progress.



I really like the view of Greenland and Iceland, I will travel to there to see it.

The real cover of the last issue of Life Magazine is this. Found in google books.


How to build global radiation monitoring network?

Joi Ito

This photo is Joi Lto (伊藤 穰一), he is a Japanese-American activist, entrepreneur, venture capitalist and Director of the MIT Media Lab (from his wikipage).

March 11, 2011, when the 2011 Tōhoku earthquake and tsunami happened, he was just chosen to be the new director of MIT Media Lab, but his wife and family still in Japan at the very moment. He wanted to know the status in Japan eagerly, but despaired by the government and media. They just couldn’t  provide enough information , immediately and accurately.

Screenshot 2014-07-08 10.44.19

So he went to Internet try to figure out how to measure the radiation by himself, and found a lot of other people just wanted to the same things. Then they loosely formed a group call SafeCast, they measure the radiation and public the data to everybody else.

Screenshot 2014-07-08 10.54.14

Now after 3 years, Safecast have 16 million data points, these data mainly from Japan.

Screenshot 2014-07-08 11.23.43

And rest from a lot of other countries.

Screenshot 2014-07-08 11.22.04

And you can see these is not so many data in China yet.

Screenshot 2014-07-08 11.25.00

From the map and data you can see most of Japan is very safe just like other countries, Because I have a trip plan to Japan, I am very glad to know it.

How to build global radiation monitoring network?

If you ask government, they will tell you this need a lot of money and time, and after some very long time, they maybe can provide you some just hundreds of points just in one nation and will cost a lot of money to maintain these stations forever.

What is the different? Internet.

Internet make the information can free transfer, so people in different place in different country can cooperate with each other to do great things.

At his speech, he talked about a lot of other useful and interest informations, so please enjoy this speech:

TED: Joi Ito: Want to innovate? Become a “now-ist” – Joi Ito (2014)

My first impression of HealthKit

TMI alert!!! Because I am a type II diabetes patient,  I really care about the thing so call health, because I already lost a lot of it.

And for your information, I just watched the video about HealthKit of WWDC, I haven’t write any code about HealthKit yet.

Why Apple developed HealthKit?

Everyone have some theory about this,  and I think I really need HealthKit.

I have Nike FuelBand, and I have two, and lost them both. Then I use Nike+ Move on my iPhone 5s, I use them tracking my walk, and lost 20 kg with help of them. I track my blood glucose sometime 3 times one day. I track my blood pressure every morning. And I bought a wifi  body scale just after first product of this kind appeared. And I have a GYM membership. All these things cost me a lot of money, but I just love them. Because they all help me live health. And they all can connect to HealthKit.

My impression

1.  iPad don’t have HealthKit.

This is a shock. When I watched the video, some girl from Apple write some code demo how to use HealthKit. And She said, “We must check HealthKit existed, before we use it, because some device don’t have HealthKit, like iPad.”

In fact I was laying myself in bed watch the video, I immediately stood up find my iPad and check. My iPad have iOS 8 beta 2, and really don’t have the Health App!!!!!!!!!!!

I can’t understand why, and I talked this with my two friends, they are both very good iOS programmers, and they can’t understand it either.

2. You can’t use HealthKit share your health data with your family and your doctor directly.

All your health data from health related apps, from some device connect to your iPhone, will save in your iPhone, maybe have iCloud backup, But can’t directly share to your family and your doctor use HealthKit. But I think you can make app to do it.

3. HealthKit support 3 kinds of apps.

HealthKit support 3 kinds of apps:

  • Statistical analysis apps (Graphs, and trends)
  • Apps to enter related information
  • App from Health providers

Apps can creating data, saving data and asking data.

4. Apple provide unit convert function.

Health data in different country use different unit, like in China and a lot of other countries, blood glucose monitor use mmol/L, and in USA use mg/dL. Lucky dirty jobs already were handled by Apple, you don’t need worry about how to convert them.

5. HealthKit can merge data from different device.

If you use two or more different devices tracking same kind health data, HealthKit can merge them, when you let HealthKit help you do some statistical work.

6. Strong privacy and permission policy

When app want use user’s health data, every type data need user’s permission separately, and user have separate read and write permissions.

You can ask multiple authorisations at same time.

Screenshot 2014-07-05 09.20.26

And some thoughts:

I was using  Nike+ Move to track my walk. And a few days ago, I found out my scale’ app “Withings”, add step tracking function. You know I use iPhone 5s, iPhone 5s have M7 chip, Nike+ Move and Withings both use the step tracking function of M7.

I can compare two apps with same data source do same jobs. I think Nike+ Move is far more better than Withings. But I can use both a week or more to figure out which is better which is worse.

HealthKit like a hub, getting all the health data from wear devices your bought,  and share data to all the analysis or tracking apps your want to try. So if you are not device provider, you still can have business here. I will continue to use my scale from Withings, but I can use other app to help me to the tracking and analysis jobs.

My first impression of Swift

Just after apple announced swift at WWDC 2014, I downloaded Xcode 6 beta 1, but since then I didn’t have time to really learn swift. Today, I watched the WWDC Session videos about swift (Introduction to Swift, Intermediate Swift, and Advanced Swift).

Why apple make Swift?

There are so many theories about this. In the WWDC keynote, Craig Federighi said, “Now Objective-C has served us so well for 20 years. We absolutely love it. But we had to ask ourselves the question what would it be like we had Objective-C without the baggage of C? “.

Screenshot 2014-07-02 20.46.10

Objective-C is a great programming language,  but it still is a very old language have so many baggages.

What is Objective-C without the C?

If we think from the angle of programming platform, I think  Objective-C platform include:

  1. Language: Objective-C language.
  2. Development tools: Xcode, Interface builder and instrument.
  3. Runtime library: Objective-C Runtime.
  4. Framework: Cocoa and Cocoa touch.

Swift just change the language, but still use the same development tools, runtime library and framework. So Swift can change syntax, but must have so many same  structure with Objective-C underneath. So developer familiar with Objective-C can learn easy and fast, and use their old experiences.

At WWDC session I noticed speaker said swift have 3 key design point: safe, modern and power.

So combine all the above, I think design swift is try to create a new language, safe (strong type), modern (convenient, easy to learn and use), power (not loss any functionality from Objective-C), don’t have any baggage from C, and can be fully supported by Apple’s development infrastructures.

My first impression of the language

1. Swift use strong type, but syntax looks just like weak type.

Strong type language is faster and safer, but need more codes and looks more complex. Weak type language is convenience, easy to learn and use, but more slower and not very safe. At swift you can just  declare type of variables explicitly, like this:

var somestring: String = “this is a string”

You also can declare type of variables implicitly, like this:

var somestring = “this also is a string”

When you don’t explicitly declare type of variables, complier will automate inference type of variables.

2. Swift don’t use single root class.

Java and Objective-C both use single root class. In Objective-C your class normally need inherit from NSObject directly or indirectly. But Swift don’t use single root class, you can inherit from any class or just never inherit anything.

I think this because at the moment of design of Java and Objective-C, there is so many functionality can not very easily implement by complier, so just put them to the root class. Now this kind functionality can implement by language.

3. You don’t need use  class member variables and properties separately

In Swift all class member variables are properties, call stored properties. And if you want a property has some setter and getter, it is a computed property.

4. You don’t need alloc memory for you object

Yeah!!!!  Complier will do it for you.

5. Structure can have computed properties and methods

But structure still have some different with class:

  1. Structure can not inherit from other structure.
  2. Structure is passed by value, Class is passed by reference.

6. Extension can extent any classes, named types even build in types

Extension just like category of Objective-C, can use to extend other classes, but in Swift extension even can extent build in types.

It is convenience and may be dangerous.

Screenshot 2014-07-02 21.18.46


7. Optional and Non-Optional type

Optional type give you the ability to safe checking the variables, make sure they are valid, and it provide a easy and convenience way to do it.


Ok, there are more and more syntax and features in the books and the WWDC session videos. But I just want talk about these, which is easy to learn and may have some different with other languages.

This is already a long article…

Leadership makes people to cooperate, authority only makes people afraid

People always mix up leadership and authority, like someone in MasterChef, because he win a competition, so he was given the authority to be the team leader of next competition. But he didn’t have any leadership, any ability to cooperate with his teammates.

Screenshot 2014-07-02 13.40.57

But when a team of people didn’t have leader, they could hardly to do some complex works need cooperation. So, finally some other guy stood up become new team leader , he didn’t have the authority from the judge of this show, but he have the leadership to make his teammates union.

Screenshot 2014-07-02 13.49.08

People always think something, someone or some company associate with computer, software or network, are some kind of rocket science. But in fact, technic team also need teamwork, need leadership.

I have ever worked with some good software teams and some bad teams. There isn’t always bad engineer in bad teams. Some bad teams own some all star team members. Some of them have great program skills, have a lot of experiences. But at the bad team always have some fight, from what framework to use, to how to start or push forward.

People need cooperation, when we can cooperate with others, we can produce more and achieve something we can never do alone.

But sadly in China, people find hard to trust others, if you want to eat health even just eat safe, you need cook by yourself. I can’t imagine our future.

And please enjoy this TED speech:

Simon Sinek: Why good leaders make you feel safe

An inspiring TED speech about binary data visualisation method

How to quick find the specific kind data from a lot of unreadable binary bytes? If you want to hack some system or quick find some import or relevant information, this kind method may have some use for you.

Chris Domas provide a method to visualise binary data, in this method music data looks like this:

Screenshot 2014-07-01 10.52.59


Code looks like this:

Screenshot 2014-07-01 10.54.23


These are English text, Russian text, Photograph, Clipart, ARM Code & x86 Code look like:

Screenshot 2014-07-01 10.56.20


I think this is a great method. When smart people do something, they will try and try, try hard to find a smart way, an easy way, so I think that is why they can do it better and better, and finally let others think this is a magic.

Enjoy this speech.

The world is one big dataset. Now, how to photograph it …

This is a very great TED speech:

The world is one big dataset. Now, how to photograph it …

Why USA is the most great country in the world, I think is because the freedom, because sky is the limit, any people want to change world can try to, this country give people chance to try, to fail, and try again.

Make this kind private satellite in China is unthinkable, government will think you as spy. Make SpaceX government will think you try to make some weapon toagainst them. And some business man try to cooperate with government recover petroleum, but when the oil field really start to produce, local government force acquire these private petroleum company’s property.