Swift not needed?

Original author: Jeff Johnson
  • Transfer
I keep wondering - what are Apple's plans for Swift and Objective-C? When Swift appeared in 2014, its creator Chris Luttner claimed that the two languages ​​could coexist indefinitely. From the mailing list to Xcode users:
June 3, 2014
McLaughlin, Michael P.
Does anyone know if Apple is really going to stop supporting C and C ++? Fortran is no longer supported, although there is still a lot of code on Fortran, and relatively new, as in MultiNest.
Please say that this is not so. Not everyone believes that “experienced users” are those who simply create full-length cartoons. Many of them are scientists and engineers.

Hello Michael,
We did not make plans for anything like that. Swift is just a new development option for the platform. We are not going to stop supporting either C, C ++, or Objective-C. If you are developing in one of these languages, you are free to continue to use it.

- Chris.
The original text of the letter
> On Jun 3, 2014, at 5:45 AM, McLaughlin, Michael P. wrote:
> Does anyone know, for real, if Apple intends to stop supporting C and C ++?
> That's what it sounded like. They already do not support Fortran even though
> there is a * lot * of Fortran code out there, even fairly new code like MultiNest.
Quoted1
>> Please say it isn't so. Not all of us consider “power users” to be just those
> who create feature-length cartoons. Many are scientists and engineers.

Hi Michael,

We have no plans to do anything like that. Swift is a new option for developing
on the platform. We have no plans to drop C, C ++ or Objective-C. If you're
happy with them, please feel free to keep using them.

-Chris


The fact is that no one believes in this. Chris Luttner has long left Apple, and if his statement is false, he will not be able to accept criticism on behalf of the company. In general, the developers agreed that Apple would eventually abandon Objective-C, and Swift would be the only "first class" language for developing Cocoa applications. The words "first-class language" matter because there is no reason to stop supporting the compiler for Objective-C or to remove it altogether. The compiler supports many programming languages, including underutilized and old ones. So Lattner’s statement may be formally true, but that’s not the point. The question is in choosing a language for developing Cocoa applications for iOS and macOS.

The developer community is probably right. I agree that Objective-C and Swift cannot continue to coexist indefinitely. However, I'm not so sure that the future is with Swift. What if this is so? I would like to devote this article to this scenario. First, let me tell you why Swift and Objective-C cannot coexist peacefully.

New Hope?


Neither Swift nor Objective-C are nearly used outside of Apple platforms. This may change in the future, but at the moment it is a fact. So if you want to develop applications for the Apple platform, you need to study either of them, or both. “Which language to learn?” Is a rather difficult question for a beginner. If you take one language, then the standard tip is Swift. Although I do not agree with him, but I admit that he is standard. Smart heads will offer to learn both languages. But here lies the snag. If you need to learn both platform-specific languages ​​just for writing applications, Apple platforms lose their appeal to developers. Developers liked Swift because of its “modernity” and “familiarity” than Objective-C. But if you still need to learn Objective-C, then what is the advantage? Third-party developers have adopted Swift,(in the original, it turned out a pun, Swift = “fast” - approx. per.) - Apple was told to jump - they jumped. Like Apollonia in Lake Minnetonka. Swift has become very popular. This has created huge demand for Swift resources. In mailing lists, forums, blogs, Stack Overflow, twitter, and everywhere else, developers want to know about Swift and discuss it. Swift has influenced the technical publishing industry. It even influenced the labor market - many companies intentionally, either because of the fashion for the language, or simply because of illiteracy, only hire Swift developers. Many developers for Apple platforms do not know Objective-C. And many Objective-C developers choose to use Swift exclusively, to the extent that they begin to forget Objective-C and have difficulty if you have to come back to it again. Swift's craze, the demand for it among developers, threatens to drown out Objective-C. These two languages ​​can coexist “officially” in the minds of Apple but can they coexist informally in anyone else? Can there be double - in each language - letters, blogs and wikis? What about open source projects - Objective-C or Swift? And, if the labor market moves almost exclusively to Swift, developers have no other choice but to go in the same direction.

Empire strikes back


Judging by the above arguments, Objective-C is doomed. More and more developers are choosing Swift. However, not everything is lost, because not the developers control the Apple platforms. The only place where Swift still does not dominate is, no matter how ironic it sounds, Apple itself. The company is developing Swift very slowly. To date, Apple has implemented surprisingly little Swift code. A good analysis of this can be found in one blog.. Several explanations have been suggested - many may call this an apology. For example, Apple frameworks cannot use Swift because it has not yet reached ABI stability (or even source stability, for that matter). Whatever the explanation, the fact remains: Apple's internal Swift code base is relatively tiny, while the Objective-C base is most likely the largest in the world.

If Apple has to abandon one language right now, which one? Refusing Swift will be extremely painful for third-party developers. On the other hand, for Apple itself, it will go almost unnoticed - too few Swift code will have to be converted to Objective-C. Of course, Apple made a lot of effort in Swift, especially with regard to Xcode, however, this is a sunk cost. Apple will not throw money down the drain. A lot has been invested in Objective-C, and these costs are even more irrevocable than Swift. It matters not the price that has already been paid, but the price that will have to be paid in the future. Apple have nothing against sunk costs. According to rumors, they have invested a huge pile of money in a car project for which there is nothing yet, and that it was mostly postponed.

Apple can rewrite all of their Objective-C code to Swift if they wish. Of course, they have resources for this. The volume of liquid assets that they own is simply stunning, unprecedented in history. However, their current corporate culture suggests that they cannot or will not carry out this transformation. There are several factors behind this. First, Apple switched to an annual release cycle for all of its major OS versions. Indeed, the company reportedly hit the Agile software development philosophy. This approach leaves too little time for complete rework. And we have already seen how quality declines and functionality is lost when Apple rewrites a technology or application from scratch.

Secondly, Apple take pride in hiring the “best” engineers. I know a lot of experts both from Apple and not, so I consider this a myth. But regardless of whether this is true or not, this is the company's point of view, and therefore, they are unlikely to be able to hire a huge number of people and throw all the resources into rewriting Objective-C code.

Thirdly, based on the previous points, I will say that the number of knowledgeable Objective-C is reduced. Even if Apple wants to transfer a bunch of people to this task, where will they find them? If you need to rewrite Objective-C in Swift, of course, you need specialists who understand both languages, without knowing Objective-C, the whole idea will turn into a disaster.

Apple's internal research also indicates that if Sophie had to choose (means a difficult choice - approx.per. ) between the two languages ​​today, it would definitely not be Swift. If you are a third-party developer who has completely plunged into Swift, this thought should at least scare you. And ask yourself, if today the pendulum swings in this direction, how much time must pass, and what must happen in order for it to swing back? At what time, in what year will it be more painful for a company to abandon Swift than Objective-C?

Perhaps you are grumbling right now, they say, Apple cannot betray developers like that by abandoning Swift. How do Apple executives sleep at night? I suspect on mattresses stuffed with cash. They will not think twice. They can even praise themselves for their courage. If you look at the history of Apple’s relationship with developers, you’ll see a chain of denials of support, disappointment, suffering and unrestrained promises. Objective-C garbage collector, 64-bit Carbon, Cocoa-Java interface, Yellow Box for Windows, Dylan. Should I continue? I could. Apple evangelists will tell you that Swift is the best programming language, and then change their minds and say that they have always been against Swift.

Prequels


When Apple decided to create Swift, what was their plan? I see three options.

  1. They really intended to support both languages ​​for some indefinite time.
  2. In the end, they planned to abandon Objective-C and switch to Swift, which the developers believe in.
  3. They did not have a concrete plan, and indeed were not sure that Swift would even fire.

The first option is not suitable for the above reasons, so you can immediately sweep it away.

If the background was valid, I would really like Apple to express it openly. A message from Luttner is at least misleading. If Swift is the future, why not be frank with developers and share your plans with them so that they can adapt to them? Uncertainty is the worst that can be in this regard. We can agree that Swift is our future if we have no choice. But if Swift is Apple's choice, and they feed us with the illusion that there is still a choice, then some of the developers may make the wrong choice, which is detrimental to everyone.

I believe the third option is true. I know, many people think that Apple is working in accordance with some grandiose, secret, megabig plan. Does Apple have long-term plans? Undoubtedly. Are these plans specific? I doubt it. In the technical field, you can make long-term plans, but do not expect that you can stick to them. Technology is changing ... fast. You need to be flexible (not just like Agile, but just flexible). You must be able to respond to what your competitors are doing. For example, Lettner’s departure - was this in Apple’s plans? Plans are changing. They must change. Third-party developers immediately attacked Swift, but Apple also had to consider the possibility that it would pass unnoticed by them. Hoping for the best, plan the worst.

Outcast One


By all accounts, the Swift project was secret even inside Apple. Only a select few knew about him. When it was announced openly, for most Apple engineers it was as much a surprise as for developers. Apple employees were not ready for this. And this is the biggest challenge for Swift: internal conflicts between development teams at Apple. The Swift team, with leadership support, touts Swift as the future of Apple app development. But the Swift Team cannot just sweep away the present and put the future in its place as an established fact. The real thing for Apple is Objective-C. Lots of Objective-C. Decades of Objective-C, accumulated before the purchase of NeXT. The entire Objective-C code base cannot just disappear as if by magic. You represent Swift to a group of Apple teams that are limited in time and in resources, all they do is send you to hell. They may like the idea itself, but WWDC is close and a lot of work needs to be done. Maybe in a year ... Or in two.

How can Apple reconcile these competing interests? They want to secure the future for Swift, but there is also a ton of Objective-C code, and they want to continue their flexible software development, while employing only the best engineers. Yes, and maintain the quality of the software. (I hope we can assume that they still care about quality there.) Something will have to be sacrificed. Meanwhile, third-party developers will make greater demands on Swift resources. The API descriptions are probably pretty automated, so a double stack will not be a big problem, but Swift developers will need documentation and code examples. If Apple's official position is to support both languages, do they write double documentation and double code examples? And how much effort do they put into updating the old Objective-C documentation?

What is the community response to this problem? People who think Apple will abandon Objective-C - how do you think they can handle it? Some will assume that Apple will abandon the external use of Objective-C, but will continue to use it internally. However, I think these people underestimate the problem. Given the size of the Objective-C code base and the limitations Apple is working with, switching to Swift will really drag out. In your opinion, how long will the company support all the tools for Objective-C? If your answer is not 5 years, not 10 years, and even not more than 10 years, I think you can’t imagine the volume of the whole problem. It seems extremely unlikely to me that Apple will devote separate resources to developing and supporting the internal version of Xcode, the internal Objective-C API,

Episode C


Let me refute possible counterarguments to the above by me. The counterargument is that Apple is already pulling a double technology stack: Objective-C and C. Foundation and Core Foundation. Therefore, the addition of another language is not something new and unknown. This objection at first glance seems convincing, but there is a gap. Yes, Objective-C and C are two different languages, but you cannot draw an analogy with Swift, because Objective-C is essentially an add-on to C. If you study Objective-C and study well, you know C also. It doesn’t matter that many take up C and then Objective-C. In fact, I followed this particular path, and would advise following it and others. But learning C and then Objective-C is not the same as learning two programming languages. Actually, it's just a two-step study of Objective-C. Everything you've learned about C applies to Objective-C. It just works, so to speak. But Swift is not concerned. Of course, there are some intersections, because Swift was developed by people who operate on Objective-C, but in no case is one of them an add-on to the other. Swift and Objective-C are incompatible much worse than, say, C ++ and C, which are very close, but not quite compatible.

In addition, C is not an application development language for iOS and macOS. Can you create a pure C application? Perhaps, but certainly not easy. The C development API was not Cocoa, but rather Carbon, and Apple largely abandoned Carbon. There are several supported APIs for C on Apple platforms, but still C is not as close to developing iOS and macOS applications as Objective-C and Swift.

Some kind of revenge


These are just my suspicions, but it seems to me that Apple did not expect Swift to become popular so quickly. This whole strategy would have made more sense if Swift had developed slowly over the years. A double stack is advantageous if the developers are distributed equally between the two camps. Apple and third-party developers would have had enough time to rewrite existing code from Objective-C to Swift. Swift may be our future, it may be the only development language, but it is a distant future. It may turn out to be a mistake in planning or a game of imagination that Swift may suddenly overwhelm Objective-C in the thinking of developers. And now Apple is faced with a difficult choice. How do they cope with the unexpected popularity of Swift outside the company when they are not ready for it inside?

I suspect Apple will back down from Swift. I think Lettner’s resignation makes this opportunity even more likely. Many developers put all their resources on Swift. It might have seemed like a good investment at the time, and perhaps it will pay off. It will probably pay off. What if not? Suddenly there will be a change of management, or will the mood inside the management simply change? What if Apple suddenly decides that their internal constraints are harder to overcome than they expected and changing the language is not profitable? Can you rule out this possibility? I'm afraid many are not ready for such a cruel world. If this happens, there will be many tears and screams. But not among the developers of Objective-C, who will laugh and have fun, as if in the yard 1999. In an extreme case, 2001.

Only registered users can participate in the survey. Please come in.

What do you think is the fate of Objective-C and Swift?

  • 9.3% Will Remain Objective-C 50
  • 36.1% Will remain Swift 194
  • 31.6% Objective-C and Swift will both remain and will evolve in parallel 170
  • 22.9% Objective-C will remain only for the internal needs of Apple 123

Also popular now: