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

joejoejoe

macrumors 65816
Original poster
Sep 13, 2006
1,428
110
I've read all there is to read on Apple's website, but being that I'm not a developer, I still don't concretely understand the real world benefit here.

Are there a few people from the developer community out there who can explain the change to us as if they're talking to a 5 year old?

I'd love to grasp the impact in a more concrete way.

Apple developing a new programming language that's "simpler, faster, easier" etc sounds great and sets off fireworks on the blogs.. but I'm trying to really gauge exactly what the jump is.

Thanks
 

C DM

macrumors Sandy Bridge
Oct 17, 2011
51,390
19,458
Are you talking about the specifics of the language and the benefit to developers or more about just what the overall benefit of it all to the consumers might be?
 

Armen

macrumors 604
Apr 30, 2013
7,405
2,274
Los Angeles
I've read all there is to read on Apple's website, but being that I'm not a developer, I still don't concretely understand the real world benefit here.

Are there a few people from the developer community out there who can explain the change to us as if they're talking to a 5 year old?

I'd love to grasp the impact in a more concrete way.

Apple developing a new programming language that's "simpler, faster, easier" etc sounds great and sets off fireworks on the blogs.. but I'm trying to really gauge exactly what the jump is.

Thanks

They demoed this at WWDC. Showed how what would have taken 5 lines of code before could now just be done with 1 line of code and the tools also allow a developer to preview the changes he made to his app on the spot in a preview window.

So basically it would be easier and less time consuming for a developer to create/change an app.
 

screensaver400

macrumors 6502a
Jan 28, 2005
858
46
You're not actually 5, so I'll give you a little bit more. Not all necessarily 100% accurate, but it should help you get the gist of it:

When you "compile" code (convert it from raw code understandable to humans to code understandable to computer processors), there are ways to optimize compilers to produce faster executable programs.

Objective-C has its foundations in C, which is a fairly old language. Because of how C is designed, a lot of optimizations can't be used.

By creating a new language that doesn't have that C baggage, you can use more compiler optimizations, which produces faster programs on the same hardware.

(This is in addition to the benefits described by others, like the ability to accomplish the same task with fewer lines of code.)
 

FatPuppy

macrumors 68000
Jul 14, 2012
1,709
151
If feature apps will use Swift, does this mean that old idevices like iphone 4 will perform better in 3rd party apps?
 

CutterSlade

macrumors regular
Mar 13, 2014
161
0
Istanbul, Turkey
If feature apps will use Swift, does this mean that old idevices like iphone 4 will perform better in 3rd party apps?

Not really. At least not in most apps. Probably the ones that are computation-intensive will if the charts Apple showed are correct. It still depends how efficient the developers write code.


As a developer myself, I don't see the point of introducing another language. When they said "we've added great things for developers" at WWDC, I expected a huge update to XCode and the other dev tools but instead all we got is just another language which we're gonna have to learn.

I've gone through most of the Swift language guide and yet to find something that can make me say "now that's a great feature, I should use that!". It has some nice features that's for sure but I don't think that they're worth spending the time to learn another language with an alien syntax. Personally, I'll continue to use Obj-C since its C based syntax seems much more natural to me and I can already do whatever I want to do with it easily.

The problem here is that they're now gonna divide the community. Some people will continue to use Objective-C, and some others will immediately start to use the "new hot thing". And since Apple is gonna push people to use this new language I expect their documentation will suffer from this fragmentation as well.

----------

Yeah but apps will be updated to Swift and they will require ios 7, right?

No one's gonna waste any time converting their codebase to Swift, but some devs might develop their new apps using Swift.

And yes, even though there is no definitive information about that, the apps written with Swift will probably require iOS 7+ even though they could have made it support even iOS 5.0 if they wanted. One of the developers working on Swift has posted a tweet about it
https://twitter.com/jckarter/status/473539096065736705
 
Last edited:

FatPuppy

macrumors 68000
Jul 14, 2012
1,709
151
Not really. It still depends how efficient the developers write code.





As a developer myself, I don't see the point of introducing another language. When they said "we've added great things for developers" at WWDC, I expected a huge update to XCode and the other dev tools but instead all we got is just another language which we're gonna have to learn.



I've gone through most of the Swift language guide and yet to find something that can make me say "now that's a great feature, I should use that!". It has some nice features that's for sure but I don't think that they're worth spending the time to learn another language with an alien syntax.



The problem here is that they're now gonna divide the community. Some people will continue to use Objective-C, and some others will immediately start to use the "new hot thing". And since Apple is gonna push people to use this language I expect their documentation will suffer from this fragmentation as well.


Yeah well... bad idea, people should move one, use new things, you can't use that language forever.
 

CutterSlade

macrumors regular
Mar 13, 2014
161
0
Istanbul, Turkey
Yeah well... bad idea, people should move one, use new things, you can't use that language forever.

That's not like buying a new device. I don't see any point in moving to something what won't help me do anything faster or better just because it is new. I might switch in the future if the majority of devs in the community starts to use it, but not now.

Btw, you CAN use that language forever if you want. Most of the APIs in iOS are developed using either C or Objective-C, so none of them will go anywhere in the future. Again, this is different than updating to a new version of the OS. People have invested in Objective-C and have years of experience with it. It's not feasible to throw that away immediately.
 

Stuntman06

macrumors 6502a
Sep 19, 2011
961
5
Metro Vancouver, B.C, Canada
You're not actually 5, so I'll give you a little bit more. Not all necessarily 100% accurate, but it should help you get the gist of it:

When you "compile" code (convert it from raw code understandable to humans to code understandable to computer processors), there are ways to optimize compilers to produce faster executable programs.

Objective-C has its foundations in C, which is a fairly old language. Because of how C is designed, a lot of optimizations can't be used.

By creating a new language that doesn't have that C baggage, you can use more compiler optimizations, which produces faster programs on the same hardware.

(This is in addition to the benefits described by others, like the ability to accomplish the same task with fewer lines of code.)

I'm about decades out of date with programming language ever since I finished university. I learned C in university and have read up on C++ a little later. I understand that there are other languages that are based on C like Objective-C or C#.

Is Swift something totally new and different from C like how C is different from Fortran or BASIC?
 

wolsoncpa

macrumors member
Jul 19, 2013
75
0
This is probably a stupid question but is iOS8 written in Swift? I know next to nothing about programming but I assume it would be.
 

WestonHarvey1

macrumors 68030
Jan 9, 2007
2,773
2,191
I've read all there is to read on Apple's website, but being that I'm not a developer, I still don't concretely understand the real world benefit here.

Are there a few people from the developer community out there who can explain the change to us as if they're talking to a 5 year old?

I'd love to grasp the impact in a more concrete way.

Apple developing a new programming language that's "simpler, faster, easier" etc sounds great and sets off fireworks on the blogs.. but I'm trying to really gauge exactly what the jump is.

Thanks

Objective-C is now 30 years old.

If you're coming in from a C or C++ background, it's a boon. It's much nicer to work with than those two languages. If you're coming from a more modern language background, it's a big step back in ease of use and safety.

Objective-C 2.0 made a lot of progress making it a more modern language - but because Objective-C needs to maintain full backwards compatibility with C, a lot of the modernizations have really awkward implementations.

Swift is a very modern language that takes inspiration from a variety of languages - Python, Rust, C#, Haskell etc. It's going to attract a lot more developers to the OS X and iOS platforms.

As long as you're going force your platform developers into a language, you might as well make it a good one.
 

stuffradio

macrumors 65816
Mar 17, 2009
1,016
6
This is probably a stupid question but is iOS8 written in Swift? I know next to nothing about programming but I assume it would be.

iOS 8 is probably still written with C or Objective-C or a combination. xCode 6 was written to support compiling Swift applications.

----------

I'm about decades out of date with programming language ever since I finished university. I learned C in university and have read up on C++ a little later. I understand that there are other languages that are based on C like Objective-C or C#.

Is Swift something totally new and different from C like how C is different from Fortran or BASIC?

You're lucky, in my University they made us learn Java.
 
Last edited:

CutterSlade

macrumors regular
Mar 13, 2014
161
0
Istanbul, Turkey
It won't matter if an app is written in Swift or Obj-C. They compile to the same binary. It will matter if an app uses iOS 8-only APIs.

Unfortunately, that's not the case here. See my message above.

----------

This is probably a stupid question but is iOS8 written in Swift? I know next to nothing about programming but I assume it would be.

No, it's being developed with C and Objective-C. No one can know whether they're gonna switch to another language or not in the near future.
 
Last edited:

dejo

Moderator emeritus
Sep 2, 2004
15,982
452
The Centennial State
No, it's being developed with C and Objective-C. I don't think that they're gonna switch to another language in the near future.

How do you know that for sure? Perhaps some of the new parts of iOS 8 are written using Swift. If it's been in development for four years now, I wonder if they would start to incorporate some of it in order to start "cutting their teeth" with it.
 

CutterSlade

macrumors regular
Mar 13, 2014
161
0
Istanbul, Turkey
How do you know that for sure?
Even the new APIs in iOS8 are written in Objective-C, so that's one reason.

----------

*shrug* so far it's been the case for me with OS X binaries at least. I can execute my Swift apps on my other dev tools untainted Mavericks machines.

I tried the same thing with a very simple app in iOS 6 and it worked, but I don't think that it would have worked if I had used some additional libraries written with Obj-C.

I guess we'll find out a definitive answer soon enough.
 
Last edited:

PBG4 Dude

macrumors 601
Jul 6, 2007
4,270
4,479
I've gone through most of the Swift language guide and yet to find something that can make me say "now that's a great feature, I should use that!". It has some nice features that's for sure but I don't think that they're worth spending the time to learn another language with an alien syntax. Personally, I'll continue to use Obj-C since its C based syntax seems much more natural to me and I can already do whatever I want to do with it easily.

So you skipped over tuples and multiple return types then? Case statements that allow if statements as part of validation? While not show stoppers in Obj-C, I've certainly coded around shortcomings that won't exist thanks to these new features.

Besides, the real time investment is learning all the APIs involved with iOS and OS X, as well as the MVCS design pattern, delegation, target-action, and notifications. Swift or Objective-C is just different string used to tie API objects together.
 

mamcx

macrumors regular
Mar 13, 2008
210
28
A programming language is similar to any other kind of software, in the sense that it have users, uses cases, pro/cons. From the language POW, we are the end-users. But not necesarily, the *targetted* end-users.

INSTEAD of regular software, it have very strong lock-in. Not only are constrained by platforms (ie: You can't use java in iOS, not cleanly), but also, by their syntax (how write & read it, and this is a very problematic issue: The syntax is a huge deal because it constrain how you can use the language) by style (functional, procedural, object-oriented, declarative, concatenative, etc: All of them different, and some are the opposite of the other), by their performance, and a lot of little & big details.

The lock-in show up in that is expensive to write, document, understand, debug, maintain source code, run the actual software (ie: Some languages create software that demand more memory, so in a web server, you could need a more costly hosting) and other stuff.

A lot of software is build on top of languages with very bad "end-user interfaces" (like C, C++, JavaScript) that cause HUGE amount of problems, and waste of millons $$ and time. Unfortunally, "fix" a language is serious bussines, because, as I explain, the lock-in is damm hard: Nobody wanna to re-write the code to solve anything. Is like write a novel, then 2 years later better "words" and "prose" is discovered then go back and rewrite it...

A lot of the stories about software security problems, software hacked, software crashing, etc is directly tied to the issues that C, C++, JS and others have. They demand not only *skills* but a lot of discipline.

Programming is VERY frustrating.

Unfortunally, the mayority of the developers are resistant to change (and the worse? Hardly aknowledge that change is necesary in first place. Denial in everything you can think of, is the norm baby!), and worse, the jobs available are largelly about continue to use what is in use rigth now, than to move to something better. Is like a company that use Win 3.11, and deny as much as possible to move to something better. But worse: Probably can't move even if want to!

Not help at all, that learn new languages is hard (some naive people think that you can do it in a week. Very naive...) and because the past software is done in X is easier to use what the past software use than try to convert to Y.

Like trying to use Pages when before you use Word. Not only you need to learn a new software, but also the data (the document) not traslate well (sometimes, not at all, or WORSE: corrupted) and what have pages is not exactly what have word. Or you depend in that task X was fast before, but now is slow -except if ALL THE OTHERS things are fast, you don't care because your use case is doomed!-

So even if some language is better than another, it will not necesarily allow to translate the same concepts (ie: Not even can you do the same thing) cleanly, neither the same data (the source code or even the actual binary interface), neither have the availability of resource, libraries, documentation or man-power.

So, all of this to finally answer:

I'd love to grasp the impact in a more concrete way.

To make a example. A language is like a serie of magic spells. So you say:

PHP:
myAge = 20

And your probably expect that it mean: "Something called myAge is a number exactly 20."

So, you wanna to check if you can buy beer:

PHP:
canBuyBeer?(age (is a number)):
  if age > 20
     return NO PROBLEM
  else
    return HA! HA!

ShowOnScreen: "Can I buy beer with the age I put in myAge ?" canBuyBeer?(myAge)

And your probably could think: canBuyBeer decide that if the age is more than 20 then yes, instead no. This also mean that for this to work, age must be a number. And you probably imagine that the language is not stupid and it validate that age MUST be a valid number, like when registering to a website and checking your age, you can't say you born in 20 B.C

Unfortunally, a lot of languages have the Billon dolar mistake, that say that age, even if I instruc to the language that it must be a number, can be also a NULL, just because. And a NULL could crash the software, and cause death, loss of property, and other real issues. And really, I'm not exagerating (much).

Is like a web form where it say "Give me your email" and you can put a photo there, or upload all the game of trones season.

Here swift solve it because it guarantte: 1) All objects are initialized before it first use 2)If something could be NULL, then is because the programmer, not the stupid compiler, say so. And it need to be handle the case where if something expected to be something instead is NULL.


This sound a lot stupid? And this design mistake was introduced in 1965 That is how hard is to solve things in programming. And the worst? This problem WAS solved long time ago (similar to how swift do things now) but unfortunally, C, C++, JS and similar are more popular than better, saner, more productive alternatives invented decades ago.

So the signficance of swift is:

1- It solve a lot of stupid litte things that are stupid, mind you, and already solved years ago by the way
2- It have a lower barried to interface with the "old" objective-c/coccoa software, not only in meaning (can do almost the same) but also in binary interface (can use the same old software, cleanly) almost perfectly
3- It reduce the necesity to write a lot of boilerplate code that add noise
4- It introduce several real neat things that are unknow to a lot of developers that have never used all that better, sanner, still fast, languages, without being to alien and hard to understand. Things like more mutable/inmutable control, functional coding, pattern matching and other stuff that probably will be unapreciated at first for some people, but, that are just better.
5- At whole, would produce better code, without sacriface too much.

A lot of people think that this kind of language is only to attract the stupid or total noob developer. But really, it let good developers to not waste time and not-so-good developers to not do too bad

Eventually, this must lead to better quality of the apps. Unfortunally, this will take a long time (remember, people are dealing with bad stuff introduced decades ago, unfixable in old languages) and brave (or naive!) developers that embrace better tools and ideas.

And is very important that:

6- Is possible to still use the "old" obj-c, because honestly: Swift is too young, too beta rigth now, so is a very hard sell to do a full move in one step.
 
Last edited:

D.T.

macrumors G4
Sep 15, 2011
11,050
12,460
Vilano Beach, FL
I've read all there is to read on Apple's website, but being that I'm not a developer, I still don't concretely understand the real world benefit here.

Are there a few people from the developer community out there who can explain the change to us as if they're talking to a 5 year old?

I'd love to grasp the impact in a more concrete way.

Apple developing a new programming language that's "simpler, faster, easier" etc sounds great and sets off fireworks on the blogs.. but I'm trying to really gauge exactly what the jump is.

Thanks

I’ll take a swing, without getting into technical details :)

(quick background: developer/architect for ~22 years, enterprise, mobile, dozen or so languages/frameworks)

Some languages allow the introduction of “unsafe” code easier than others, which can result in errors that the end user sees as a bug (a crash, the app locks up, etc). Swift is [should be] better at preventing bad code during development, which means less issues in production (when you’re running the app on your iPhone).

There’s also complexity from the actual language syntax. Less code to perform the same function, can improve readability (to a point ... looking at you Perl ... :D ). If the language is easier to read and [apps] easier to maintain, the developer can spend more time improving and polishing the end result.

An easier to use language will likely attract new developers, who might have great ideas, but were deterred from learning a C derived language (that is notorious for being difficult).

Swift should have better optimizations - meaning, better performing applications with less effort (vs. Obj-C), so the developer can focus on features and functionality.

One of the big technical upsides: the language is compatible with existing Obj-C code, so developers can start using it for new development and capitalizing on the benefits, without having to go through the effort to recode existing work.

WestonHarvey1 had some great points about adding language features to a language that wasn’t designed for them, making the implementation +ugly+ for developers. Swift allows these features to be implemented elegantly, since they were considered up front.

Kind of a side discussion, that I don’t think will be too brain melting:

So much of a language is about understanding the frameworks/APIs for the platform (i.e., an iPhone). For example, if you create a button in an iPhone app, there’s a bunch of existing code (supplied by Apple) that you invoke. You say in your code, “Apple library that draws buttons in the UI [UIKit], give me a button that’s this height, width, color, location on the display”. The programming language is really just the connecting logic between lots of pre-existing frameworks (that are still written in Obj-C, but compatible with Swift).

Quite a few languages are general purpose, and they simply provide all the common language components like control flow, variables, logic statements, constructs like arrays, some simple output methods to write to the console. It’s the frameworks that provide the platform, or domain specificity - so for developing iOS (or OSX) applications, you use a general purpose language like Obj-C or Swift, combined with the platform specific frameworks (Cocoa/Cocoa Touch).

Anyway, don’t know if that was helpful or just more confusing :D
 

Cassady

macrumors 6502a
Jul 7, 2012
567
205
Sqornshellous
When you "compile" code (convert it from raw code understandable to humans to code understandable to computer processors), there are ways to optimize compilers to produce faster executable programs.



...



By creating a new language that doesn't have that C baggage, you can use more compiler optimizations, which produces faster programs on the same hardware.


Sincere question: to a real-world user, what does "faster programs" mean? Would an app that is written in newer code, perform its functions "quicker" than if it were written in an older language - or are you simply saying that the front-end, designing/programming part is quicker?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.