7 ms·
Why I want Swift to be your first language
- r3bl 11y agoWhy I don't want Swift to be your first language (from a student's point of view): 1. Where am I going to test my applications? Not all students have Apple's products (I never had any of them). On the other hand, if I use Python, or Java, or C/C++, I can test my application wherever I want. 2. As far as I know, Swift will be open source (at least, that's what Apple said). But Swift is not open source _at the moment_ (please correct me if I'm wrong). 3. Swift is a new language. If I type "Swift tutorial" on Google, and I type "Python tutorial" on Google in a second tab, I'll get much more relevant results for much more platforms when I type "Python tutorial". I don't care how good the syntax is. If a programming language is not currently available on like every platform and if I can't build my application using whatever I want to use (including a text editor and a compiler), it's not a good choice for students no matter what you say.
- ra88it 11y agoAt the end of the article, the author gives several reasons why he won't be teaching Swift to students yet. He includes each of your points. (With the assumption that eventually they will be moot.)
- r3bl 11y agoNope. He lists that there's no Windows IDE, which is far from being able to run the program everywhere and using whatever I want to use to build it (as I have said it). I also think that .NET languages (like Visual Basic .NET and C# .NET) are not a good starting language, even though one of them was my starting language thanks to my high school and my college (both taught me Visual Basic .NET for one year). Plus, he states that Swift is open source at the moment, which, as far as I know, is not true. He didn't mention any of those three points I made. EDIT: Replaces .NET with .NET languages.
- dragonwriter 11y ago> I also think that .NET is not a good starting language Well, that's sort of obvious, in that .NET is a platform for which many languages (VB.NET, C#, F#, Python, etc.) are available, not a language.
- r3bl 11y agoIt came out wrong, but I was thinking about Visual Basic .NET and C# .NET. Not sure about the others since I never tried them. Thanks for pointing that out, I'll edit my comment.
- Apocryphon 11y agoOnce it's open source, isn't it logical to conclude that there will be open source runtimes that run on non-Apple products? Give it a year or so.
- gorena 11y agoNot even a year, about a month. Swift for Linux will arrive with the release of Swift 2.0, which will coincide with the release of Xcode 7, which will coincide with the release of iOS 9 ... which will coincide with the announcement of the next iPhone, which should be around late September, as usual.
- Apocryphon 11y agoHm, do you think it'll only take a month for it to be ported to Windows?
- gorena 11y agoI'm not an LLVM expert, but Swift is an LLVM frontend, so once it's open source, I think it should work for the various backends? Right now the issue is library support - swiftc can already just spit out LLVM IR: https://github.com/kripken/emscripten/issues/2427 https://github.com/kripken/emscripten/issues/2427 The stdlib would be included in the open source release. Linux boxes would fulfill "non-Apple product" though. Unixy programming languages like Swift and Python have always been weird on Windows.
- deleted 11y ago[deleted]
- incepted 11y ago> I can test my application wherever I want. And if you are using Java, not only can you test your application wherever you want, you can also write it wherever you want. Languages that don't offer this multiple flexibility will have a tough time becoming a main teaching language in schools.
- mwcampbell 11y agoSwift isn't actually open-source yet, is it? Once it is, I think the reasons explained in this article for using Swift as an introductory language make sense.
- wlesieutre 11y agoMaybe after they open source Swift they'll have some free time to work on Steve Jobs' announcement that FaceTime would be an open video calling standard. Swift is not open source. It might be in the future, and if they do follow through, the release is slated for "later this year." I hope they do, but I also can't blame anyone who decides to wait and see.
- wlesieutre 11y agoA source on that: http://appleinsider.com/articles/10/06/07/apple_announces_open_standard_facetime_video_chat_for_iphone_4 http://appleinsider.com/articles/10/06/07/apple_announces_op... By now, 99% of people have forgotten that FaceTime was ever supposed to be more than video calls between Apple devices. I'd hope they won't try and pull the same thing on the developer community who tend to be more in the loop.
- oddevan 11y agoThat's a fair point. IIRC, FaceTime actually ran into patent trouble that kept it from being a P2P protocol, so they couldn't really open it up.
- mikeash 11y agoI have also heard that the first time the FaceTime engineers found out the protocol was going to be open sourced was when Steve announced it live on stage to the world. I'm not happy with what happened to FaceTime but I don't think Swift is in the same boat. It seems to have the backing of all the relevant parties and shouldn't face any hurdles like the patent stuff that sank FaceTime. And they gave a hard deadline for themselves to stick to. I'm pretty optimistic about it happening.
- 11y ago
- pmelendez 11y agoWith the exception of "Named parameters, a life sentence." every argument work for a Lisp based language as Racket for instance.
- edgyswingset 11y agoI'd also argue that a super simple language like Scheme (or stripped-down Racket) would be pretty close to ideal for a pure intro class. Introductions should be about learning how to reason about abstractions, and how to transform problem-solving from what's going on in your head into code. When you start out with something so rigid like C or Java you really confine a student's ability to reason about a problem because there's so much syntax to keep track of.
- coldcode 11y agoA Lisp-like language will only help you if you stay in the lisp world. A C-like will help you with most of the world's current languages in the Tiobe list.
- pmelendez 11y agoThat's so not true in my opinion. There is a whole generation that was raised with Scheme as first language (and SICP ), I am particularly grateful that I was part of that and today I program (or had programmed) in most of the top languages in the Tiobe list as you say.
- pavelludiq 11y agoBoth Common Lisp and Racket have keyword arguments, and even Clojure kind of has them(it cheats by using map destructuring). Common Lisps in particular are very powerful and flexible, see http://www.gigamonkeys.com/book/functions.html http://www.gigamonkeys.com/book/functions.html
- gorena 11y agoStrict type system?
- kwhitefoot 11y agoIt doesn't look like a particularly radical change from any other so called modern curly bracket language to me. It also doesn't seem to have any native multitasking/multiprogramming features, at least none were mentioned on the Swift2 summary page. Anyway, what sort of students are we talking about here? If they are physics or engineering students then they will have to learn whichever language that the tools they use needs, if they are CS students then surely the language itself is one of the objects to be studied in which case there ought to be more than one.
- gress 11y agoIt doesn't need multitasking/multi programming as a language feature because these are provided by GCD as a library.
- wvenable 11y agoSwift is inherently tied to the OS X / iOS APIs (just as Objective-C is). It's a one platform language and will never be (and never intended to be) a general purpose language for all platforms.
- jayvanguard 11y agoNeither are "inherently tied" to OSX or iOS. They may be practically tied due to who drives them and their competitors lack of incentive to ever invest in them, but from a pure language point of view they are agnostic.
- wvenable 11y agoAlmost the entire OSX API is built on the Objective-C object dispatch model. Swift and Objective-C are built for this model specifically. It doesn't make sense to run Swift (or Objective-C) without the underlying platform API. You can do it (and Apple does; iTunes for Windows is built with such a shim) but it's not practical. The only reason Swift even exists is that no other language (other than Objective-C) fit with the object model of the OSX API. So they had to make their own. As much as other languages don't interface well with OSX is as much as Swift doesn't interface well with every other platform.
- mcphage 11y ago> So they had to make their own (again). Objective-C wasn't created by Apple or NeXT.
- ThrustVectoring 11y agoThe article is missing what I think is the zeroth skill to teach beginning programmers - a love of hacking on things and getting results. It's why I think Javascript is the best language to teach beginners. Yes, it's an ugly language. Yes, it has significant structural problems. Yes, it will bite you in hilariously difficult to find ways. But that doesn't particularly matter compared to teaching them that they can futz around with code and get interesting stuff done.
- mcphage 11y agoProcessing is also pretty good, for a similar reason.
- markhahn 11y agoThe article was a reasonably persuasive argument for why Python should be your first language. Maybe someone should write "Why I want Swift to be relevant to non-Appleheads".
- oddevan 11y agoExcept for the part where he specifically mentioned Swift's ARC as something to expose Intro students to vs. Python's garbage collection?
- zxcvcxz 11y agoIsn't ARC almost exclusive to "Apple languages"? It seems like GC is much more relevant.
- AlexeyBrin 11y agoNot necessarily, C++11 has smart pointers which have reference counting.
- gorena 11y ago- Python does not implement nullability as an ADT. - Python does not have a type system worth mentioning.
- AstralStorm 11y agoNullability is an interface, not a data type. Python objects can always be None, as per duck typing. Python has a strong dynamic typing system, with metatypes, type rewriting and so on. You couldn't be more wrong. What it is missing is an easy way to declare interfaces - the idea is to use duck typing and handling exceptions when something goes wrong.
- spion 11y agoIf its None, it neither looks, acts nor quacks like a duck.
- afandian 11y agoThe static-void-main-string-args argument is trotted out so often and to me is the most facetious. Every language has some syntax to learn and with any learning process it will need to be handwaved away. Basing any kind of decision on such a trivial thing seems odd to me.
- jdavis703 11y agoWhen I here this argument made as to why one shouldn't use a language, you're right it is trivial. But when you're trying to find the right language to teach someone, the first impressions and learning curve matter deeply.
- incepted 11y agoTrying to discourage the use of a language because of `public static void main` is as absurd as trying to sell a language because it lets you write `println("hello world")`. Don't believe anybody who uses either of these tactics.
- spinningarrow 11y agoDiscouraging the use of a language, and discouraging the choice of a certain language as the first language non-programmers are exposed to are two very different things.
- vvanders 11y agoLost me when he mentioned that ARC is better to teach than GC. I'm the least fan of GC as anyone else but needing to have intro students worry about cycles seems like the last thing you want to teach first.
- glhaynes 11y agoOn the other hand, a student would likely be quite far along with an ARC language (well beyond intro) before they'd need to understand anything about the subtleties of it or even its existence. Until then, they can just treat it as though it were GC. One might even argue that if they're going to eventually learn manual memory management, ARC's subtleties might act as a good intermediate step. I think it's about a wash.
- deleted 11y ago[deleted]
- Someone 11y agoI don't see him state that. His argument seems to boil down to: 1) I want to use a single teaching language. 2) We need to teach them about memory management. 3) C style manual memory management is too hard for beginners. If you accept #1 and #2, you can't start with a language with the full 'magic' of garbage collection, as it would have to be the only language, and you cannot teach #2 with it. If, in addition, you accept #3, ARC makes sense to me. You can have your pupils implement quite a bit of advanced data structures such as trees and tries before you hit your first cycle, but there are 'real' data structures that use them, so you won't have to make up some artificial example to find one. Until that time, you can let your pupils think that the machine reuses memory as soon as it is no longer referenced. I think his arguments make some sense, but I am not sure I'm fully behind #1.
- AstralStorm 11y agoWell, look at it this way: Python used (still uses?) very standard reference counting. It can go very far into the design. What he's wrong about is that the choice is C style, ARC or full GC. There's another intermediate step which is achieved by using C++11 smart pointers - manual reference counted memory management.
- guelo 11y agoThe semicolon thing had me scratching my head. Are people teaching Java without an IDE that shows syntax errors very visibly?
- fernandotakai 11y agohell, i work with python using vim and i can see syntax errors on it. it's really a basic feature when you are writing code. also, swift has syntax that can bite new developers just like any other language.
- PeterisP 11y agoAt this point of time, being cross-platform (at least the 3 of win,mac,linux) is a basic 'hygiene factor' for programming languages. I mean, even experimental niche tools and hobbyist systems are expected to do that and almost all of them do. I have access to all kinds of systems, but this is not a consumer item, and it should work everywhere; a mac-only requirement is just as unacceptably limiting for general purpose computing as a windows-only requiremet.