4 ms·
Dang, while I'll appreciate your one compiled and one interpreted language way of life (pragmatic!), this makes me sad: > Swift: I’m not an Apple person. I'll
by auto 8y ago
Dang, while I'll appreciate your one compiled and one interpreted language way of life (pragmatic!), this makes me sad:
> Swift: I’m not an Apple person.
I'll admit, if I wasn't a professional iOS code slinger I probably never would have approached it, but at this point it's by far my favorite language to write (especially prototype) in.
- klohto 8y agoI'm on verge trying it. Would you like to share your opinion on why do you consider it good?
- auto 8y agoI wrote C++ in college before I started with iOS/Obj-C around 2010, and 75% of my work from then until Swift launched was Obj-C, the rest was Java. So, just from a readability and writing standpoint, verbosity (or lack there of) was a huge win, however that's a bit subjective and more of an aesthetic reason. 1. I really like the let/var system, combined with the let/guard conditional assignments. It might not work for everyone, but I write cleaner code because of it. I also love optional chaining, and I've really molded my thinking around it, as it often encapsulates large chunks of logic in a single line (essentially, do we go past here or not, based on the state of the data and whether things are set/valid). It's null checking that doesn't feel bolted on. 2. Swift has made some big changes from release to release, sometimes breaking existing code, but my largest codebase is ~70k lines, and it's taken me at most a few hours to get rolling again (FWIW, the auto updater did not work for me on 2.2->3 I believe it was). That said, the changes are worthwhile. JSON (De)/Serialization built in via the Codable protocol was a big upgrade for me, removing a vast amount of boilerplate, as well as my reliance on a 3rd party library (although big thanks to NerdRanch for FreddyJSON, it served me well). 3. Speaking of 3rd party libraries, CocoaPods has treated me well. Easy to use, not too difficult to create your own custom libraries and manage them from your own git repos. 4. I know I don't use them to their full potential, but the higher order functions: https://medium.com/@abhimuralidharan/higher-order-functions-in-swift-filter-map-reduce-flatmap-1837646a63e8 https://medium.com/@abhimuralidharan/higher-order-functions-... are a real game changer. Those operations, combined with my own drive over the last ~5 years or so to write more tightly coupled, functional, code has resulted in far more maintainable, easy-for-humans-to-parse systems. Granted, it's not all daisies and roses. I hate how it handles strings, and they can't seem to settle on an internal representation/manipulation mechanism. The safety of the whole ecosystem makes working with raw byte representations/pointers a bit of a hassle when you need to do it, but it isn't terrible/impossible. I'm by no means an expert, and just by the nature of my work and my responsibilities (especially in other domains) I don't feel that I've had the chance to truly dig into the language for all it's worth. For instance, when I watched this video: https://www.skilled.io/u/swiftsummit/server-side-swift-from-scratch https://www.skilled.io/u/swiftsummit/server-side-swift-from-... My mind was blown, and I didn't realize just how much I was under-leveraging the type system, and I hope to have some time to do a few personal projects to really integrate some of the more core pieces of the language into my workflow soon. This is already huge and ranty, so if you have any pointed questions I'd be happy to take a stab.
- nivenhuh 8y agoI am a big fan of Protocol-oriented development. It allows you to do component-style programming, where it's very simple (swifty) to extend functionality onto struct/classes in a easy to understand, reusable way. Additionally, language features like guard/optionals/etc... allow you to deal with error states & control flow easily. Two good videos I'd recommend on protocol-oriented development: Protocol-oriented programming in swift (part 1): https://developer.apple.com/videos/play/wwdc2015/408/ https://developer.apple.com/videos/play/wwdc2015/408/ Protocol and value-oriented programming in UIKit apps (part 2): https://developer.apple.com/videos/play/wwdc2016/419 https://developer.apple.com/videos/play/wwdc2016/419
- kbenson 8y agoI'm always interested when it comes up, especially when I see info on its progress for usability on non-Apple systems, but the last time I remember seeing info on that (multiple months ago, admittedly) was that it was coming along, but there wasn't quite parity with the Apple ecosystem and some (core?) libraries were different/not as good? The impression I got (from comments of here trying to use it) was sort of an early Mono .NET type of situation (maybe not that forked, but still). It's hard to put any effort behind learning a language when it feels like you would be a second class user. I spent way too much time and effort being the guy trying out the experimental Linux support for projects inthe late 90's early 2000's, and I have less time now, so my explorations need to be a bit more directed. It came down to Swift or Rust for learning a new language a while back for me, and I picked Rust for the reasons above. I've yet to do anything with it (and I'll have to brush up on it yet again when I do), but at least I don't feel like I'm getting second class support from the language. I wouldn't mind being mistaken or having this already been addressed and Swift's port to other systems is at parity with Apple's. That would be nice. I wouldn't mind spending some extra time on it then, it does look to be an interesting language.