Is Swift getting too complicated? - Chris Lattner on Swiftly Speaking

Поділитися
Вставка
  • Опубліковано 18 лис 2024

КОМЕНТАРІ • 49

  • @vell0cet517
    @vell0cet517 4 роки тому +47

    I love Swift, especially all of the safety that the compiler brings. The problem is that clever people who read/write very clever code are the ones steering the boat. Their idea of readability is very different from mine. I would rather have a dozen lines of simple, clean code that anyone can follow, than one line doing a dozen steps chained together in a manner that takes 3 Stack Overflow visits to figure out. The big problem I see is how terseness became synonymous with readability, and the trend towards omitting labels and keywords and overloading things makes looking up code difficult/impossible, whereas if it’s an unfamiliar keyword, a simple trip to the browser can sort out any confusion. Also no one wants to be the guy/girl who says “I don’t get it.”

    • @Wishwader
      @Wishwader 4 роки тому +4

      Exactly. Couldn’t agree more. I wish the terse advocates would stick with Perl out of the way. Unfortunately property wrappers is turning Swift into an opaque mess at the whim of whatever quirks Apple decides to add. Watching this years Stanford course on iOS shows how property wrappers get ugly real fast, requiring workarounds, to get the most basic things done.

    • @michaellee2786
      @michaellee2786 4 роки тому +3

      I've found that the programmer ego is getting in the way of simplicity. It's not okay for us to call the language complex, because the moment we do, our peers will either; assume we don't know it, or use this opportunity to assert that they have deeper understanding. The conversation always derails.

    • @indieshack4476
      @indieshack4476 2 роки тому +2

      This.

    • @bobweiram6321
      @bobweiram6321 2 роки тому

      Learn Ada.

    • @ronaldbell7429
      @ronaldbell7429 Рік тому +2

      I'm writing this 2 years after the fact, so probably no one will read this but... What I wish is that Xcode would have a "verbose" mode, to sort of de-simplify some of that extra-lean code. Swift understands all these shorthands, but it would be nice to be able to automatically convert that shorthand to a longhand, especially if you're learning Swift (or learning new features of Swift).

  • @petersuvara
    @petersuvara 4 роки тому +9

    Glad you raised this point Paul. Absolutely we need to contain the complexity. Having so many ways to implement the same thing, brings about decision fatigue as to the best approach to take when solving problems.

  • @spaceowl5957
    @spaceowl5957 Місяць тому +1

    I love this comment section. I finally found my people. The Swift haters.

  • @petersuvara
    @petersuvara 4 роки тому +4

    Especially looking forward to the concurrency solutions.

  • @waoneill
    @waoneill 4 роки тому +5

    I have been a C++ programmer since 1990. I still prefer it to Swift...
    Swift is really just an attempt to mitigate the issues that arise from Apple’s “Closure-oriented APIs”.
    Compared to C++ it feels claustrophobic and limiting.
    I could understand the compromise of flexibility vs safety before SwiftUI, but by implementing SwiftUI using Function Builders they have compromised ALL the safety benefits the language brings.
    Now, we have a claustrophobic language that is very limited, but just as unsafe as the earliest C++ implementations!

    • @petersuvara
      @petersuvara 4 роки тому +1

      SwiftUI seems more of a constrained, declarative subset of Swift. I think you need to be careful when comparing swift to c++, especially when in context of SwiftUI.

    • @michaellee2786
      @michaellee2786 4 роки тому +1

      You say that you feel limited by Swift, can you speak more about that or give us an example? I'm interested.

    • @WouterStudioHD
      @WouterStudioHD 4 роки тому

      @@michaellee2786 C++ is ridiculously powerful. For example variadic templates and fold expression are incredible. Compile time programming is great too and memory manipulation is really easy in C++. For certain types of programming Swift is also not suited, because it is not deterministic enough. For example realtime audio processing is best done in systems languages like C/C++/Rust. It can be done in Swift, but only if you take away all type safety. Then you'll end up with a much worse unreadable version of your program. That's also why frameworks like AudioKit are really just C++ code that is called via Swift.

  • @carlmuller8967
    @carlmuller8967 3 роки тому +3

    Just learning Swift, it seems that 80% of all swift answers from google/stack overflow are lies. Nothing ever compiles first time let alone runs. Code works on one specific version of Xcode and one specific version of iOS and the next year everything is changed. On the other hand code in C++ that i wrote in 1991 still compiles and runs, although it could be improved. Code written in FORTRAN in the 1980s is still used in photogrammetry programs! Apple APIs go from Alpha->Beta->Deprecated without stopping at Production. This is quite different from learning Python for example, even though they keep adding features also.

    • @yes-vy6bn
      @yes-vy6bn 3 роки тому +1

      the real problem is apple's documentation. you can find enough resources to program something simple, but as soon as you want to do something that not every app uses, you're basically fucked. the documentation is so bad even the people that do coding tutorials FOR A LIVING can't understand the docs, so can't make a tutorial

    • @bobweiram6321
      @bobweiram6321 2 роки тому

      Swift's syntax is very dirty and needlessly complex, especially for a language designed and developed by a company obsessed with clarity and ease of use. The ecosystem around it, however, is even worse. The available libraries are poorly documented and are always changing directions. I was shocked to learn about new features in Apple's Developer videos which couldn't be found on any of the scant online documentation.

    • @ngtamphuong
      @ngtamphuong 6 місяців тому +1

      I had two project written in Swift. With every release of Swift, I had to go over it and fix it in order to build, let alone to run properly. All because the APIs, syntax had changed with every release! Now I'm happy with Objective-C++ for native things, and Flutter for everything else.

  • @indieshack4476
    @indieshack4476 2 роки тому +1

    Appreciate the great Paul Hudson's interview with Chris. Unfortunately, Chris's response about Swift getting too complicated that "they haven't spent time with C++" is not for me a valid answer. It's gotten to the point that I'm moving away from Swift iOS dev because readability has become a major issue, coupled with Apple's API which has massive changes on a yearly basis. I get that Swift was open sourced by Apple because initially it wasn't getting much traction (for years and years, Apple declined to specify the percentage of apps being submitted to the App Store written in Swift), but in my view open sourcing it was a mistake - its development has been hijacked by the C++ crowd.

  • @rebelsdeveloper367
    @rebelsdeveloper367 4 роки тому +4

    compare to other. swift and objective c is crazy odd. We spoil to press,type "." dot to auto complete. Swift ui seem like react all weird state..

  • @maxwell4upyours
    @maxwell4upyours 4 роки тому

    I just barely wrapped my head around AppDelegate and SceneDelegate, now Apple has removed them. I pray my workspace compiles correctly in the new Xcode.

    • @michaellee2786
      @michaellee2786 4 роки тому

      Apple has not removed them. You're referring to AppKit, which is not going away. SwiftUI has a lot of chatter around it, but it is not a replacement for AppKit.

    • @pookiepats
      @pookiepats 7 місяців тому

      More misinformation, do be careful kids what you take to heart - everybody has an agenda and sometimes it’s just to spread their own ignorance

  • @いろい-b2l
    @いろい-b2l 2 роки тому +5

    Swift (and its ecosystem, SwiftUI) is unnecessarily advanced, it's unreasonably complex for beginners who just need to build a simple app. Its complexity / inconsistency is one of the reasons why it is not popular. It's compiler-friendly, not programmer-friendly.

    • @yalcinozer4434
      @yalcinozer4434 Рік тому +1

      Exactly. As a person who has 3 year experience with JS, Swift too many new thing to learn. A person who learns it as first programming language will be demotivated, thats for sure. I have been learning it for two weeks. If my thoughts wont change, I will take a look to the Kotlin.

    • @いろい-b2l
      @いろい-b2l Рік тому

      @@yalcinozer4434 I've been doing software dev since 1997, and after using SwiftUI for 3 years, I still don't know how it works, the layout system is confusing, harder than dealing with cypher / security problem.

    • @spaceowl5957
      @spaceowl5957 Місяць тому +1

      It's compiler-*nerd*-friendly not even compiler-friendly based on how huge the Swift binaries tend to be

  • @marlb_oro
    @marlb_oro 2 роки тому +2

    Comming from c# trying to learn swift, swift is the most confusing shit I have ever seen.Trying to be cool by adding closures, lambda expressions to he syntax is the most complicated way with arrows () and symbols makes it not cool but a big barrier for new developers to jump into swift. And for no reason.

    • @yalcinozer4434
      @yalcinozer4434 Рік тому

      Exactly.

    • @pookiepats
      @pookiepats 7 місяців тому +1

      This is just your battle with familiarity, Swift was my first language and it just makes sense, now having learned other (FP) languages you can see where the inspiration for that syntax came from and again, if you think mathematically it just makes sense.
      C# / Java / Objective C are ugly old bags

  • @evergreen-
    @evergreen- 4 місяці тому +1

    Swift IS getting more and more unnecessary complexity. And it shows: it is slow to build, slow to lint and slow to run… and with all this complexity, it is slow to read

  • @andreypopov6166
    @andreypopov6166 4 місяці тому

    It is, unfortunately...

  • @bobweiram6321
    @bobweiram6321 2 роки тому +4

    Swift has one of the ugliest syntax and styling conventions I've had the misfortune of working with. The syntax is oddly sparse in some ways, yet verbose and convoluted in other ways. Swift, for instance, deprecated the ++ operator because the designers feared it may encourage latent bugs, yet the language is loaded with obtuse syntactical structures which hides the programmer's intent. 😊

    • @spaceowl5957
      @spaceowl5957 Місяць тому

      The priorities of the designers seem totally confused. Like making it impossible to treat Strings as a simple list of characters, complicating 90% of string-handling in any code base for the benefit of ... making it a bit easier to display the string length accurately in a text editor? What??!?!?!
      Swift designers are like the dumbest smart people

    • @spaceowl5957
      @spaceowl5957 Місяць тому

      Btw, the "easily displaying character count accurately in a text editor" is literally what Chris Lattner gave as the reason why Strings in Swift are 'Grapheme Clusters' in some interview that I saw. He said it shows how much of a "UX focused company Apple is". What 😂. It's totally ridiculous.

    • @bobweiram6321
      @bobweiram6321 Місяць тому

      @@spaceowl5957 What? Are you serious? That explains a lot! I really wish Apple opened up their platform to other languages. The fact that Swift is the only game in town for developing first class iOS/MacOS apps is really hurting Apple's competitive advantage of having the best user experience. There are few Swift apps on MacOS because most third-party developers would rather use another language supporting a less than stellar foreign UI framework such as Electron, Avalonia, or Flutter. To many, it's simply not worth the extra time and effort to learn Swift for a single platform. Moreover, even if Swift and SwiftUI is used primarily for building the interface along interoperability with another language for the backend, it still a colossal effort.

  • @tenminutetokyo2643
    @tenminutetokyo2643 2 роки тому +3

    This is the messiest BS language I have ever seen. What happened to simplicity + elegance?

    • @spaceowl5957
      @spaceowl5957 Місяць тому

      They killed it for pretty syntax and fancy functional stuff that makes you feel smart without doing anything significant :'(

  • @KK-pq6lu
    @KK-pq6lu 4 роки тому +6

    It isn’t complexity...it is just creating really stupid ways to do things.

    • @michaellee2786
      @michaellee2786 4 роки тому +3

      Creating a different way to do something forces someone that wants to do something to make a decision with one more option than would otherwise exist, and so makes decisions more complex to make. That is complexity.

    • @spaceowl5957
      @spaceowl5957 Місяць тому

      Yeah for example `if let` and `guard let` expressions would literally the exact same thing as a simple `if (value == nil)` or `if (value != nil)` if the Swift compiler was like 2% smarter, (in fact, the TypeScript compiler is 2% smarter and this works) ... buttt they had to unnecessarily invent confusing new syntax

    • @spaceowl5957
      @spaceowl5957 Місяць тому

      ... to solve the problem of optional unwrapping which only exists to solve the "problem" of nullability, which was never actually a problem and they just made that up...

  • @ZoeSummers1701A
    @ZoeSummers1701A 4 роки тому +7

    Swift and swiftui are vile. Functional programming is awful. He claimed swift was to be more readable than a C based language but C languages had sensible rules; swift let’s you obfuscate everything until it’s unreadable. How is that easier to read? Closure syntax is the worst.

    • @petersuvara
      @petersuvara 4 роки тому

      I believe you haven't then used the ASM keyword in C :)

    • @michaellee2786
      @michaellee2786 4 роки тому +2

      I don't necessarily disagree with what you're saying, but it is more constructive and less manipulative to show your work when you say things are bad. There are young minds soaking up your opinions every day.

    • @thuggfrogg
      @thuggfrogg 3 роки тому +1

      Functional programming is a very useful mental model for thinking about certain kinds of problems. As a data scientist, I think about all of my data pipelines basically like function compositions. It's great!
      TBH I never really understood why OOP needed to exist until I decided to code an app as a side project. GUIs lend themselves to OOP. The moral of the story is that certain tools are only awesome *to you* if they improve your life. Functional programming improves mine!

    • @ronaldbell7429
      @ronaldbell7429 Рік тому

      I take it you're one of those people who can only rate things as a 1/5 star or 5/5 star. There's a difference between you not liking sometimes and it actually being bad. It's subjective. Except for functional programming of course. There, you're wrong. Functional programming is extremely powerful for people who can understand it, and extremely confusing for people who can't.