iOS / Mac:
Go programming language
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.
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.
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.
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.
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.
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.
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.
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? “.
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:
- Language: Objective-C language.
- Development tools: Xcode, Interface builder and instrument.
- Runtime library: Objective-C Runtime.
- 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:
- Structure can not inherit from other structure.
- 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.
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…