6 ms·
Swift Changes Considered Harmful
- wilde 10y agoIt's always a tradeoff. The io.js mess showed what happens when you try to be too stable.
- deleted 10y ago[deleted]
- routelastresort 10y ago"Considered Harmful" Essays Considered Harmful: http://meyerweb.com/eric/comment/chech.html http://meyerweb.com/eric/comment/chech.html
- quicksnap 10y agoEvery time I see a "considered harmful" title, I groan and think of this. It's a meme at this point, and really detracts from the value of the article for me.
- sverige 10y agoIs There An Alternative to “Considered Harmful” Essays? Absolutely. The most basic alternative is not to write them at all, but to instead engage in reasoned debate without resorting to dogmatic assertions or distractive tactics (e.g., ad hominem attacks and straw man arguments). In those cases where some sort of document is needed outside of the debate, there are a number of superior alternatives. * A description of the strong and weak aspects of one’s own point of view; we might call it a “benefits and weaknesses of” essay. This is a positive contribution to the debate, and allows the debating parties to take the best parts of each view and more readily find a compromise solution. Knowing both the benefits and weaknesses of all views makes it easier to cover the weaknesses in one view with the strengths in another. * A description of the strong and weak aspects of another point of view; we might call it a “perceived benefits and weaknesses of” essay. This allows the author to evaluate what he believes to be good and bad about another point of view. Authors must be careful to avoid slanting the piece too far toward the weaknesses, lest they end up writing a “considered harmful” essay by another name. * An essay that compares different viewpoints in the same piece; in other words, a “compare and contrast” essay. These essays attempt to objectively evaluate multiple views and point out how they are both alike and dissimilar, thus highlighting both common ground and areas that need work. The benefits of such essays are fairly self-evident.
- ktRolster 10y agoThe purpose of the "Considered Harmful" headline was, and always has been, to draw attention. And it's frequently been successful, both in the original attempt and here as well.
- mcbuilder 10y agoMy grief with this sort of "considered harmful" essay or blog post is that it is being applied to such concrete subjects as Swift code migration, not the almost philosophical objects as the original GOTO. "Considered harmful" essays should be timeless to do service to the concept.
- tubehouse 10y agoI don't agree with this. Presumably this is going to be a long lived language. They should fix the problems as early as possible so that generations of developers don't have to keep reliving the same pain.
- BoorishBears 10y agoDisclaimer: I'm purposefully stretching to come to this conclusion, think of it as me transcribing an idle thought I think people are taking out their frustration with C++ on Swift by saying it's fine to churn the language so we don't end up with a mess like C++ because they just despise the way the past of C++ has marred the present by existing, no matter how hard the language is trying to be in the present. They feel Swift should move fast and break things so that we don't have to live with the mistakes of the past like C++ does. The problem is even if we think what Swift is doing is perfect and let it solidify, odds are in the future we'll still come to despise it, and the parts we despise will eventually be old and well used enough they can't reasonably be changed by breaking stuff, and then it will be time for a new language to repeat the cycle. (Replace C++ with Java or some other older language as preferred)
- pvg 10y agoI think that's completely reasonable and maybe the article would have been better with the much more sensible complaint that an official Apple code sample last updated at the end of October last year doesn't work in un-obvious ways today. That's just sloppy and frustrating and shouldn't happen - at a minimum it should be marked (temporarily) obsolete.
- mrpippy 10y agoI think his main complaint is that Apple should stop publishing sample code (which they update sporadically at best) in Swift when the language is changing so much. At WWDC this year I believe virtually all code shown on screen was Swift, but ObjC would have been fine for almost everything. More broadly, I think Apple should have marketed Swift as "beta" until at least v3, to really make clear (especially to managers) what it means to have a language with constant source-breaking changes.
- Animats 10y agoHey, it's "continuous integration". It's moving fast and breaking things. Keep up or be roadkill.
- refulgentis 10y agoAfter 3 years in Swift, the only clear drawback outside compile times, is exactly this. It's a real shock coming from Objective-C. Ad hoc name-spacing by prefixing classes, and a language/core framework that's been stable for 30 years, made it extremely easy to Google and get an accurate answer immediately. Moving to a language that adds major features twice a year, and invalidated large swaths of code by mass-renaming Cocoa in Swift 3, has made it much harder to find correct material
- pvg 10y agocore framework that's been stable for 30 years That's perhaps a little overstated.
- drk4 10y agoIts always a tough decision, either you make no changes but then have to live with a less than ideal situation, or make changes but forces everyone to update their code. Personally I think its ok to make incompatible changes once and then, as long as its not too many changes in one go (like python3), its preferable than later on ending up with inconsistent or overly complex languages.
- coldcode 10y agoI work in Swift 7 days a week (sadly 7) but I am quite happy despite the changes, it's an open source language built entirely in the open by contributions from people who care. What the hell is there to complain about, would you rather work in 50+ year old cobol? I've used ObjC since the NeXT days and despite much of our codebase (not our part) is still in that language I am always glad to be working on our part in a nice modern language. It's only 3 years old. Go is almost 5 (announced like 8 years ago and started 10), Ruby and Java are antiques in comparison at 20+, ObjC itself is 30 years old, C is 40, C++ is around 25. Rust is about the only comparable aged language, and it isn't used in any single environment as large as iOS and OSX. Swift is 3. Yet it's fun and productive to work in (other than compile times which suck, and debugging which is painful sometimes, and Xcode is ugh). Sure often I have to look up what the current syntax is, but it's still lightyears easier than remembering C++ details (another language I spent a fair amount of time in in the past) which also change from year to year. Debugging STL still gives me nightmares. Cyanide is considered harmful. Opinions are just opinions, but calling something harmful when you just don't like it should be considered silly.
- an_d_rew 10y agoNailed it.
- fiedzia 10y ago> What the hell is there to complain about, would you rather work in 50+ year old cobol? I'd rather work on modern AND stable language (I actually do, its not Swift, buy that's not my point). Broken code samples is a good reason to complain. Swift is a moving target, it will be for a while, and this is real pain... but its not a secret. If it bothers someone, why would they choose to use it?
- lordnaikon 10y ago> I'd rather work on modern AND stable language (I actually do, its not Swift, buy that's not my point) Greetings fellow Rust user ;)
- mike_hearn 10y ago
- ktRolster 10y agoIf Apple can't keep its own sample, example code up-to-date on its website, maybe they are breaking things a little too quickly. At a minimum, they should make sure their migration tool works on their own examples, that seems like a basic regression test.
- plorkyeran 10y agoApple has always been very bad about keeping its sample code up to do. They seem to only update it when they specifically get a radar about something being broken.
- drewcrawford 10y agoThis is already being done. Swift 4 (unreleased) has source compatibility with Swift 3 [0], so all Swift code working today should work in the next version, no migrator necessary. Additionally, the goal of Swift 4 is to finalize the ABI. Once that is done, you can mix and match different Swift versions in the same project. The real "problem" here is that Swift wants to be a "big" language, in the vein of C++ or Rust, as opposed to a "small" language like C or JS where you can read one book. (Swift does have a book, it's 1200 pages.) There's a lot of "stuff": a complex typesystem, many basetypes, generics, extensions, both static and dynamic dispatch, programmer-assisted memory management, closures, visibility, ephemerals, optionals, a mutability-based memory model, etc. etc. Inevitably some of that stuff won't be quite right and so you have churn. But ideally you only need 10% of those (it's just that everybody needs a different 10%) and so the amount of churn you personally have to deal with should be low, and can be lower with the appropriate tooling. [0] https://swift.org/blog/swift-4-0-release-process/ https://swift.org/blog/swift-4-0-release-process/ [1] https://github.com/apple/swift-evolution https://github.com/apple/swift-evolution
- Someone 10y ago"Swift does have a book, it's 1200 pages." It is an ePub, so your mileage may vary. On my iPad, it is 1077 in landscape, 892 in portrait (edit: playing with the font size in iBooks, I got it down to 484 pages while still being eminently readable for my myopic eyes) More importantly, that ePub on my iPad shows only 16-ish on a page in landscape mode, 22-ish on portrait. A printed book probably would be around 300-400 pages. In comparison, the PDF I have for "small" language ISO C 2011 has 701 pages, a draft of ECMA-262 for JavaScript 252.
- 0x0 10y agoI thought they announced swift 4 would not finalize the ABI after all? http://mjtsai.com/blog/2017/02/16/deferring-abi-stability-from-swift-4/ http://mjtsai.com/blog/2017/02/16/deferring-abi-stability-fr...
- edblarney 10y ago"Swift wants to be a "big" language" My guess is that it is not ideological. Swift feels like it wants to be 'everything'. Because of this, it's almost too much. I want to like Swift, but I run into a lot of trouble with it. The decision to be compatible with ObjC was one of the big issues: obviously, pragmatically, they felt that they just had to do it. In hindsight, I wonder if it would have been better to just have a clean break.
- mirekrusin 10y agoI don't understand... if those are the problems, write code in objc - it will be good for many years to come. Have some respect. You're looking at open source project, you can get involved yourself if you wish, you can follow design process - you have been given free access to "look into the future" in this area, the future that's being crystallised in front of your eyes - complaining from that position doesn't make sense.
- ebbv 10y agoThis seems like an issue with out of date examples. This same criticism could be leveled against any language that evolves and invalidates past syntax. PHP7 invalidates tons of old examples on the web. Does that mean those changes were bad or harmful? No. Just because we happen to be at a transition window with Swift such that recent examples are now invalid doesn't change that.
- Entangled 10y agoI love Swift and I don't care if they break it everyday. I'll patch everything that needs to be patched while having fun building apps for all devices in the world, desktop, mobile, server, watch, tv, IoT, embedded, etc. Naysayers will naysay, just stay away and let us code. Swift is a beautiful language and it gets better by the day.
- kenshi 10y agoSwift changes are harmful if you are building a product with a budget. I don't have any problem with the fact Swift is churning. I think its healthy for the language to be improved. I think it's great that there is so much open source activity and enthusiasm around it. But I also think Apple have been premature about pushing it for sample code and WWDC talks. And some companies have adopted it too early given their resources, constraints and objectives. Yes it's a lot of fun from an engineering perspective to be on that bleeding edge. It's not so much fun when your boss/client/own business has a tight deadline to ship something, but then you have the extra work to migrate your code to the latest Swift changes. edits: fixed a couple of typos.
- vosper 10y ago> Take a look at the Stack Overflow page again. There’s some good information there, but it’s completely hidden by Swift code that’s no longer relevant. I recently experienced this first-hand with Python, chasing an issue with SSL certificates - my problem (SSL doesn't work on Python 3.6 on OSX unless you follow a post-install step to install certificates) was completely masked by problems some people experienced in a recent previous version of Python, where they had switched on certificate validation by default [0]. There were a number of similar-but-different SO questions, that all linked to each other. I wasted hours before I discovered that none of the results on Google for my exception were relevant. It's hard with SO sometimes - information ends up being stale, and the accepted answer might no longer be the best. Sometimes you find a helpful comment or a new answer that has the right info, but other times it's just out of date or completely irrelevant. Worst, it leads you to mis-diagnose the problem, which is especially easy when it's something you're not familiar with: I know very little about SSL, I just want my API requests to work. [0] Yes, I was astonished to discover that all this time certificates weren't being checked
- pmarreck 10y agoAre we at a point yet where people have realized that mutability is basically an optimization fraught with danger, and that immutability and functional data structures (coupled with some decent GC scheme) are the way to go for the most secure, bug-free code out of the gate? Wake me up when we are, because "UnsafeMutableRawPointer" in sample code makes me nauseous. Meantime, I'm gonna hang out here over in Elixir-land.
- dep_b 10y agoI had a bad time going from 2 to 3. The renamification was pretty smooth but took a few hours of work for a big project. However there were more subtle differences. Example code: var rowID: Int! // Set elsewhere, keeping it short. Also would never declare anything in this way but legacy func someFunc() { let updateUrl = "things/\(rowID).json" print("updateUrl") } The result in Swift 2: things/123.json The result in Swift 3: things/Optional(123).json A ton of subtle bugs not detected by the compiler. Apparently Swift 4 will throw a warning for parsing an optional in a string but this was pretty bad. However I trust the change between 3 and 4 will be less breaking and will bring true or almost ABI stability. Between the 1.x versions and the migration to 2 was already more difficult than the 2 to 3 migration if it wasn't for the renamification and I still consider that a great thing. I would still happily start a project in Objective-C(++) if I would need to integrate a lot of libraries that rely on O-C, C or C++. But Swift is the default for me.