Swift as a First Language

Aaron Block wants to (eventually — perhaps soon) use Swift to teach introductory computer science:

For those who haven’t used Java or Python before, those two languages are at one end of the “memory management continuum.” In these languages, you never explicitly delete a memory reference. Java and Python run “garbage collection” routines that remove memory when they are no longer necessary. On the other end, C and C++ require developers to explicitly destroy memory allocations. Swift uses a technique called Automatic Reference Counting (ARC) that lives in the middle. Under ARC, developers do not explicitly destroy objects but instead must correctly organize their memory references and classify them as “strong”, “weak”, or “unowned” so that they can be automatically destroyed without needing to run an additional memory management process. While ARC doesn’t require developers to directly manage memory, it helps students learn how to organize memory and think about how objects are stored in memory without harassing them about the details. (Students should still learn explicit memory management, just not in their first year.)

My beef with Java as a learning language is that it’s so verbose and ungainly. Python is a much better choice. Why not use a language that can be fun and elegant?

(I’m glad I went through college before Java became entrenched as a teaching language. Drexel’s introductory computer science courses in the early ’90s taught Pascal — a language that, now that it’s fallen out of favor, no longer gets the credit it deserves.)

Thursday, 27 August 2015