Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

srkmish

macrumors regular
Original poster
Feb 10, 2013
216
0
Hi All,

I am starting grad school this fall and one of the courses is Ios app programming. But this course is in objective C. I am very interested in the course. However, i am confused whether objective-c will get outdated and swift will replace it. In that case, will my learning be any use?
 
Hi All,

I am starting grad school this fall and one of the courses is Ios app programming. But this course is in objective C. I am very interested in the course. However, i am confused whether objective-c will get outdated and swift will replace it. In that case, will my learning be any use?

Part of this depends on your goals. If you are looking for a job using ObjC, then it'll be of value at least for a while.

If you are developing for yourself or a small team of partners, then it can be of value for as long as you want.

Most iOS code is currently in ObjC, tutorials, libs, current apps, etc... Currently Swift is commonly listed as "nice to have" on the side of ObjC. This may change over time.

If you are looking for a job, most companies don't jump on something new just because it's new. If a company has a complex app now, it's probably written in ObjC, moving over to Swift has no business advantage to them.

New apps can be written in either ObjC or Swift, ObjC is known to be harder to learn but has a large support base. In addition, the programming language is only a part of an app.

Apps include: artwork, design, APIs, language code, etc...

The business of apps include marketing, user base, etc...


All things considered, you have to look at your personal goals to determine the best path.

One other note, if your goal is a job, you should understand the "number of years" problem:
When a platform or language comes out, those that jump in at the start have number of years advantage over those that wait.

Example: 1 year after your done, you'll have 1 year in while others that started 4 years ago, will have 5 years in... You'll never catch up.

The job market a few years ago was asking for 1 year exp, now they ask for 2~3 years, next year maybe 3~4 years.

Look at the job posting for C programmers, some ask for 10 years exp... Do you want to spend 10 years waiting for that job?

Much like starting to learn anything where you are looking for a job at the end, you have to compete with other that have been doing the same thing but started before you.

Having said that, number of years is a very poor indication of skills, in the end, skills matter. Not everyone that knows how to write can write a great novel, not every programmer can debug a complex program or come up with a creative solution that works.
 
Objective C will not be outdated by Fall (Apple will still have way too much code written in Obj C and C). Knowing Objective C will also be quite helpful in reading example/legacy code and learning all the iOS frameworks and concepts needed to develop apps, even if you decide to switch to Swift for developing apps in the future.
 
You don't need to be fluent with writing it, but you do need to be able to read it.
 
Objective C is here to stay for at least 5-10 Years. Most Big Applications Like For Example Office and Photoshop for MAC are Written in Objective C, Most Big Companies are not going to switch because it will cost Millions of Dollars to Re-Write Code.

Everybody thought C++ Will be dead when C#Sharp arrived on the scene in 2000's with .NET. But C++ is still used today because most developers are lazy and don't want to spend money if they do not have too.
 
Plus Objective C is a strict superset of C. And C isn't going away either. You can still write a high-performance iOS app in 95%+ C (plus OpenGL), inline with Objective C and armv7/arm64 assembly.
 
All excellent points. Also, unless Swift offers something great enough beyond what ObjC offers, it could lose demand.

Remember, just because Apple says something will be, doesn't mean it will. Most every company has a flop and Swift doesn't seem (at this point) to offer much above and beyond what can be done with ObjC.

As more and more user base make more and more routines in a given language, the hard it is to unseat. I haven't heard any solid arguments for someone to select Swift over ObjC other than just easier to learn. Don't forget the easy to learn part is subjective and only takes once to learn.

I've been studying ObjC runtime, and it's very robust, I don't know if Swift offers the same level of power or not, but power becomes more of an issue as apps become more advanced.

I've also heard that Swift makes some jumbo apps for downloading, which is an issue for people with limited space.
 
... I haven't heard any solid arguments for someone to select Swift over ObjC other than just easier to learn. Don't forget the easy to learn part is subjective and only takes once to learn.

I'm not convinced it's really easier to learn. It may be easier to learn the basics, or to get far enough to do some things. But that doesn't mean advanced things are necessarily easy.

For example, see the code from this post in another thread:
Code:
class func jsonAsUSDAIdAndNameSearchResults (json: NSDictionary) -> [(name: String, idValue: String)] {
        
        var usdaItemsSearchResults: [(name: String, idValue: String)] = []
        var searchResult: (name: String, idValue: String)
        
        if json["hits"] != nil {
            let results:[AnyObject] = json["hits"]! as [AnyObject]
            for itemDictionary in results {
                let name:String? = (itemDictionary["fields"]? as NSDictionary)["item_name"] as? String
                let idValue:String? = itemDictionary["_id"]? as? String
                if (name? != nil && idValue? != nil) {
                    searchResult = (name: name!, idValue: idValue!)
                    usdaItemsSearchResults += [searchResult]
                }
            }
        }
        return usdaItemsSearchResults
    }
In particular, note the extensive use of ? and ! as required syntactic elements. Is the meaning and purpose of every one of them clear? That is, is the reason for them plain from the context?

Or consider another question: who would be able to write this in the first place? Does it take an expert, or lots of trial and error? Is that expertise or experimentation inevitable, or is the language contributing to the problem?

C gets criticized because of its liberal use of punctuation marks as necessary syntax. But I'm not sure Swift isn't subject to similar criticism once one gets past the simple cases.

Another thing to note about the linked post: There are small but important differences between the "Solved" code I posted and an earlier post's code that incompletely solves the problem.
 
I haven't heard any solid arguments for someone to select Swift over ObjC other than just easier to learn. Don't forget the easy to learn part is subjective and only takes once to learn.

An "easy to learn" language can increase the population of programmers learning a particular language. The more programmers, eventually the more code and stuff to learn from and borrow. Swift looks more suitable for a REPL than Objective C, which some say makes for an easier to learn language.

But the big advantage of Swift is not ease of learning, but optimization and safety. Swift constructs make it easier for the compiler to figure out certain optimizations, but more importantly, easier to find certain kinds of bugs and potential exploits, without slowing down the optimization of the entire language (as do various forms of "safer" programming languages that depend on GC and VMs and other layers of cruft).
 
I don't know if it has changed since I was last using it, but when I was writing Swift over the summer, it was not possible to do OpenGL in swift. - I'd say if you wanted to start learning a language, learn Objective-C AND whilst you do it, learn swift! By looking in the documentation see if you can work out how to convert your Objective-C into swift. This way you learn two languages and will be able to use either when you feel it is appropriate. If you get stuck, the Apple developer community are friendly, so I'm sure someone will be willing to help you out :)

Good luck learning to program!
 
An "easy to learn" language can increase the population of programmers learning a particular language. The more programmers, eventually the more code and stuff to learn from and borrow. Swift looks more suitable for a REPL than Objective C, which some say makes for an easier to learn language.

But the big advantage of Swift is not ease of learning, but optimization and safety. Swift constructs make it easier for the compiler to figure out certain optimizations, but more importantly, easier to find certain kinds of bugs and potential exploits, without slowing down the optimization of the entire language (as do various forms of "safer" programming languages that depend on GC and VMs and other layers of cruft).

So does Swift make more optimized code than ObjC or is it easier to make optimized code with Swift?

In other words, is there any code in Swift that can't be written in ObjC?

Is there something that Swift does better (faster, less memory) than ObjC can?


The argument about greater population of programmers creating more code because of ease of learning, is the same as saying I have a faster car, but I'm starting further back in the race.

Consider: two types of programmers: new vs advanced.
If the new programmer starts with an "easier to learn" or "less time to learn"
but doesn't have the skill set, advanced knowledge, historic code base of solved problems... then the "less time to learn" doesn't have much advantage (if any).

The advantage of "we'll get there because more people on board" assumes that those on board will have the skills to make up for the KNOWN advantage of a historic code base of proven solved problem.

ObjC is like a city that already has street, lights, plumbing, buildings...
Swift comes in and says: We have no city, no streets, no lights, no plumbing, no buildings... BUT they are easier to build from scratch.

By the time all the code base is written from scratch, debugged, etc... those using ObjC have already written the code, used proven code, sold the app, own the market, spent the money and are off to their next project.

Who want to go back to the starting line in the middle of the race just because they have "faster shoes" ? Who do you think will win the race, when the race is well underway and some are going back to the starting line?

----------

I'm not convinced it's really easier to learn. It may be easier to learn the basics, or to get far enough to do some things. But that doesn't mean advanced things are necessarily easy.

For example, see the code from this post in another thread:
Code:
class func jsonAsUSDAIdAndNameSearchResults (json: NSDictionary) -> [(name: String, idValue: String)] {
        
        var usdaItemsSearchResults: [(name: String, idValue: String)] = []
        var searchResult: (name: String, idValue: String)
        
        if json["hits"] != nil {
            let results:[AnyObject] = json["hits"]! as [AnyObject]
            for itemDictionary in results {
                let name:String? = (itemDictionary["fields"]? as NSDictionary)["item_name"] as? String
                let idValue:String? = itemDictionary["_id"]? as? String
                if (name? != nil && idValue? != nil) {
                    searchResult = (name: name!, idValue: idValue!)
                    usdaItemsSearchResults += [searchResult]
                }
            }
        }
        return usdaItemsSearchResults
    }
In particular, note the extensive use of ? and ! as required syntactic elements. Is the meaning and purpose of every one of them clear? That is, is the reason for them plain from the context?

Or consider another question: who would be able to write this in the first place? Does it take an expert, or lots of trial and error? Is that expertise or experimentation inevitable, or is the language contributing to the problem?

C gets criticized because of its liberal use of punctuation marks as necessary syntax. But I'm not sure Swift isn't subject to similar criticism once one gets past the simple cases.

Another thing to note about the linked post: There are small but important differences between the "Solved" code I posted and an earlier post's code that incompletely solves the problem.

Excellent point!
 
So does Swift make more optimized code than ObjC or is it easier to make optimized code with Swift?

In other words, is there any code in Swift that can't be written in ObjC?

...

The advantage of "we'll get there because more people on board" assumes that those on board will have the skills to make up for the KNOWN advantage of a historic code base of proven solved problem.

(3) And that's exactly what happened when Obj C became Apple's preferred language for app development. It jumped up the TIOBE list to displace many previously popular programming languages (and the entire historic code bases of Symbian, WindowsCE, and PalmOS stuff). That may be Apple's plan for Swift over the next 2 to 4 years, given Swift's rapid climb up the list, even when it was still a very broken Beta.

(2) No. Given that a highly skilled programmer can always drop down to hand-tuned C and even inline assembly within Obj C's subset, a great coder can create some highly optimized stuff in Obj C.

But he typical coder? Not so good. There's a plethora of slow buggy Obj C code in the App stores. Swift will eventually allow the Xcode compiler tools to make that more typical coder's output (around 98% of the stuff in the App stores) faster and safer. That's simply because Swift was designed by the people who write the LLVM analyzer and optimizer; they get to see ALL the crash dump analytics; and thus they know what Xcode currently isn't doing enough of given the existing Obj C code base in the App Store.

(1) As for current optimizations, for worst case performance reasons, Apple currently recommends not using any OO Obj C code inside real-time code such as audio unit callbacks. They will likely start recommending Swift for that in the next year or so, due to Swift's OO vtable dispatch optimizations, and etc.
 
I'm not convinced it's really easier to learn. It may be easier to learn the basics, or to get far enough to do some things. But that doesn't mean advanced things are necessarily easy.

In particular, note the extensive use of ? and ! as required syntactic elements. Is the meaning and purpose of every one of them clear? That is, is the reason for them plain from the context?

That's not necissarily typical, or a requirement in the language though.
 
One other issue is that Android NDK uses C/C++.

So if someone writes routines for their iOS app using C/C++, then those routines can be (might be) usable on their Android app.

I don't know if this is a worthwhile advantage, but the fact is that C/C++ are still very common vs Swift which is supported nowhere but iOS.

I don't know when these Swift/ObjC question will be answered, I've seen so many product come and go over the years that it's really hard to know what will take and what will die.

Large companies have produced so many "better" answers to questions that have already been answered that only time will tell.

Trying to move a large number of iOS app developers off a language that's already working and supported a market that went well past flooded is a long shot.

Pretty soon (if not already) the market for phones and tablets will have the same problem. Right now MS, BB and Amazon are trying to convince people to dump their iOS and Android, yet as they keep trying, Apple has record sales with a new version of theirs (iPhone 6).

MS and BB have a chance if they play their cards right and come up with an excellent reason to dump Apple, but it's more of a long shot as time goes on.
 
Thanks for all the replies :). So im getting a positive vibe that my objective c learning wont be in vain. Some other doubts that have crept up are

(i) I will be using a Windows laptop and accessing maconthecloud.com for ios development. Is the site reliable ?

(ii) Is learning object oriented programming necessary for writing good ios apps? I have done some basic level OOP coding in undergraduate.
 
(ii) Is learning object oriented programming necessary for writing good ios apps?

Yes.

You can't even use most of the iOS Cocoa Touch framework without a basic knowledge of object messaging syntax. And you won't be able to properly refactor your code and debug your mistakes without an even greater understanding of OOP and MVC.
 
You can be a computer scientist, or you can be a code monkey. A programming language is a tool and a good computer scientist should have many tools in their tool box and will choose the best tool for the job.

For example you can do something in 5 lines with python that you need about 50 lines in C++. You could probably do the same thing with Perl in 1 line, but Perl is the work of the devil and is evil, so let's not talk about it.

A good computer scientist should be able to read any modern language and get the gist of what is going on. Again, I'll include the caveat of Perl, since it is the work of the devil.
 
And the Good Thing about Learning Objective C is that once you learn 1 programming Language, Its easy to learn another.
 
And the Good Thing about Learning Objective C is that once you learn 1 programming Language, Its easy to learn another.

This is one of the things that's overlooked by most companies. Most just like at do you know this language, yet once you've learned one, another is much easier and the value of knowing computer programming or complex problem solving is often overlooked.
 
Thanks for all the replies guys. A tangential qs - How is the current Market for ios developers in usa? I was planning to apply for internship in Mobile app companies after my first sem of grad school (after I finish the ios course).
 
Thanks for all the replies guys. A tangential qs - How is the current Market for ios developers in usa? I was planning to apply for internship in Mobile app companies after my first sem of grad school (after I finish the ios course).

Pretty high demand, but the number of years they are asking for keeps going up. As with any tech market, as the market ages, they ask for more years of programming. However, they usually ask for an app, so a complex app can make all the difference.

I'm sure the enterprise level will continue to add jobs as more companies adopt mobile as a viable business platform. Enterprise mobile is expected to catch up to gaming in market share.

Many will adapt older client/server/PC based systems over to cloud/mobile with signs of rapid growth as companies are looking for better ways of doing business.

Game dev and speciality development like health care won't slow for quite a while (IMO).

Interfacing with devices is also going strong, bluetooth and other.

If your newer to this, I'd focus on advanced usage of OO, blocks, runtime, using core data for state restore/save, etc... look at some of the advanced books and make an advanced app. Look at some of the latest offerings in the app store and figure out how they do what the do.
 
I don't know Swift, and I absolutely love Objective-C, so if that doesn't tell you how biased I am I don't know what will ;)

I am a fan of C based languages in general. As firewood mentioned above, Objective-C is a strict superset of C. This means that if you want to write high-efficiency code in C, Objective-C will get out of the way and will run your code as fast as possible. But if you are a new developer and don't know C, it is very easy to just learn Objective-C and use that as your base.

Yes, Object-Oriented programming is absolutely fantastic, but (as with everything in life) it has its limits and shouldn't be used for everything. There are some diehards out there that will rail against object oriented languages because it isn't perfectly suited to THEIR specific project in massive academic neural network simulations (or whatever), and since it doesn't work perfectly for them in that one situation it must mean it can never work well in any situation ever. Obviously, this is an incorrect conclusion.

If it weren't for object-oriented programming, we could still make most of the apps we make today but it would take a lot longer and would be a lot more grueling.

While it isn't technically required to know Swift, a lot of iOS libraries out there are only written in Objective-C. While a lot of the big libraries (ie. Parse) will work with Swift, a lot of the lesser-known libraries won't. This may not seem important now, but when the rubber meets the road you may one day find that you absolutely need to use one of these libraries and knowing Objective-C is critical.

In short, it's a bit too early to abandon Objective-C if you want to be a commercial iOS developer. I am definitely interested in Swift though and I myself will begin learning it soon.

----------

You can be a computer scientist, or you can be a code monkey. A programming language is a tool and a good computer scientist should have many tools in their tool box and will choose the best tool for the job.

For example you can do something in 5 lines with python that you need about 50 lines in C++. You could probably do the same thing with Perl in 1 line, but Perl is the work of the devil and is evil, so let's not talk about it.

A good computer scientist should be able to read any modern language and get the gist of what is going on. Again, I'll include the caveat of Perl, since it is the work of the devil.
Agreed! It is a well known fact that Perl was created by Satan himself.

----------

Thanks for all the replies guys. A tangential qs - How is the current Market for ios developers in usa? I was planning to apply for internship in Mobile app companies after my first sem of grad school (after I finish the ios course).
An internship would be very good. I myself decided not to go that route and just jumped right in to freelance work and I have been loving every single minute of it. I've been doing well enough to quit my day job ;)
 
Thank you so much Axo and Karl.

I am glad u like objective c. Im learning it now but the syntax seems like from hell. Im wondering why it is framed in such a complicated manner. Maybe ill see the big picture later.

I plan to create a medium complexity app in 2 months and 10 days. Do you think its possible to do that. I want to impress my professor beforehand so that i can get assistanship in second semester.
 
Thank you so much Axo and Karl.

I am glad u like objective c. Im learning it now but the syntax seems like from hell. Im wondering why it is framed in such a complicated manner. Maybe ill see the big picture later.

I plan to create a medium complexity app in 2 months and 10 days. Do you think its possible to do that. I want to impress my professor beforehand so that i can get assistanship in second semester.

I can't say I'm a big fan of ObjC syntax. In fact, I don't understand the need for all the different languages. Those that understand programming, understand the 3 basics:
Loop, iteration, selection.

I don't understand the reason for Repeat Until, Do While, While Do, and every other verb they want to use, it's just a dam loop.

Passing parameters in the middle of a function (method) call is different and takes getting used to, but that's the way someone decided it should be.

One thing that helps and is a good programming practice, is to write routines of your own that have the least amount of code in the call and the complex code within your function (method).

In other words, take the language and write routines, classes, methods, ... that do most of the work, while you later just make calls to those routines.

Decades ago, I wrote a routine that would display any data table I passed to it. It was a big complex function that would understand the structure of the table and display it based on parameters.

After it was complete, my work got much easier or at least I was able to do more advanced work.

In order to get past the beginner stage, you need to write classes and routines for whatever path you'll go down.

Many ignore the true benefit of object oriented programming and just write code that follows the rules and gets the job done. Others make more advanced classes and routines that handle things better. What I've noticed about most app developers is that then simply look for the easiest way to get what they want.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.