Perspectives on Swift in Education (using a Linux Environment)

Thank you for your response @lukasa. Yes, each student has their own account. While your idea is a good one and works well for students that are only working against one version of a library it becomes unwieldy as the semester progresses and new versions are available. At that point, some of their projects need to point to an older version and others to a newer version. Thus, the ideal solution requires that it be possible to reference a specific version on a per-project basis.

Ah yeah, that's much trickier. Being able to manage these things per project works well, and it's hard to do so without having custom per-project paths. Your solution seems reasonable to me: anything else I'd recommend is likely just a different spelling of the same basic idea.

@total_swiftification Your contextomy of my quote misrepresents my intent. Nevertheless, I would like to address a few points.

A course in computer science is not synonymous with a course in computer programming. Computer science is about algorithms and information processing. It's about understanding the interaction between the underlying hardware, operating system, and application software. It's about breaking down complex tasks into their component parts to gain deeper understanding. It requires developing an understanding of tradeoffs between competing concerns and resources. It also considers the software design process, social and economic implications on privacy, safety, and ethics. Thus, the programming language is one tool (among many) to clarify concepts and gain experience; learning the language is not the goal.

I believe your assertion is that choosing a more established language is always preferred. But if that were the case, then why would one choose to learn C# when C++ is more established and popular? Or why learn Java when C is more popular? Or, for that matter, why would one choose to learn C when COBOL was already well established? Computer languages evolve over time and it's important to evaluate the decision of choosing a language based upon specific constraints. Those constraints may be related to business requirements, available talent, available libraries, etc. I don't believe that a single programming language will be ideal in all circumstances.

The choice to use Swift is based upon its clarity and expressiveness for beginners while supporting an impressive array of features for teaching more advanced concepts (e.g. protocols, error-handling, generics, optionals, etc.) It's a compiled language yet supports a robust REPL. It's a language that has learned from the mistakes of earlier languages.

That said, Swift is a practical language, widely used on Apple devices which themselves are widely used. Students are able to gain industry certification.

Developing a good understanding of the principles of development in any language goes a very long way to enabling students to learn other languages. I'll note that 100% of the students in our program that participated in "bridge-sessions" from Swift to Java successfully passed the AP CS A exam in Java.

Chris Bailey: Myself and the wider IBM team have been involved in the open source Swift.org project since it was announced...Swift is a great technology and one that stands firmly on the shoulders of giants — as a new language it has been designed and built fully in the knowledge of what has gone before and has adopted some of the best aspects of other languages.

It's interesting to recall that Java was developed at Sun Microsystems and C# was developed by Microsoft. Swift is now open-sourced:

On December 3, 2015, the Swift language, supporting libraries, debugger, and package manager were open-sourced under the Apache 2.0 license with a Runtime Library Exception,[34] and Swift.org was created to host the project. The source code is hosted on GitHub, where it is easy for anyone to get the code, build it themselves, and even create pull requests to contribute code back to the project.

I appreciate your opinion; thank you for taking the time to post.

2 Likes

@lukasa Much appreciated. Thank you for taking the time to read and respond.

Well, if learning swift is a part of an early stage of the curriculum than so be it (the more - the better); don't get it though why - if you take into account time that is required for a student to find a position - would it be necessary to learn swift if your students could just be taught java instead.

I meant this

Dont know where you find that c++ is more popular, but my preference for sharp was driven by the diverse set application of that language: there is web, game dev, and enterprise endeavors. So there is already much more to offer, not to say that c# have many things in common with swift, so the transition is easier. By the way, there is a saying that c++ was an act of resentiment-driven revenge, and Bjarne wanted all other people to suffer alike.

Ah, cmon, aside from that it is a press release for scoring gratification points, there is no difference from what any other mainstream language can offer (there is less, in fact).

@Karl: Well said. It's engagement that's the key. Leveraging Linux, Swift, and browser-based animation (using Igis and Scenes) a compelling environment can be created that excites students. Some of these students then spend their summers pursuing additional learning independently and some even write their own games and applications in a variety of languages and platforms including C++, C#, Java, Unity, Go and more.

Thank you for your suggestions @svanimpe . I agree that these are intriguing, engaging, and fun! We've also played with Linux on some of these devices (see ev3dev). However, as you point out, some of these devices, including Apple iPads and Macs, can be quite expensive and out of reach of some students, so the vast majority of what we do is browser-based and requires only a Chromebook.

Hi, I'm actually a student at a high school that teaches Swift primarily. I have taken the Swift courses (although totally unnecessary for me) and have helped my peers and had many discussions about Swift with peers.
Sorry if I'm kinda late to the discussion but I hope I can also answer questions about being on the learning end of Swift.

The way my school teaches Swift is with a one-year course going over programming basics entirely in Swift, then moving to a second year going into more AP Computer Sci topics in both Java and Swift. In these first two years, we learn Swift as a general-purpose language.
There is a 3rd year that is a joint business-programming course (app development w/ latest Swift technologies)
Since my school provides us with heavily locked-down Chromebooks (understandably so), we use a website (repl.it) that provides us with a compiler and LLDB (if I recall correctly). (I was also able to use an amazon ec2 instance + ssh most of the year, but that is out of the question for most if not all students). The school has apple computers in computer labs, and requires macOS for students to have at home in later courses.

About the learning of the language, I think that engagement is the number one thing at the start. It's kinda like going into a cold pool; going in sucks, but once you are in and swimming it's much nicer. I've found Swift to be a much nicer introductory language than languages like Java or C#, the big problem I've found is that Swift isn't yet as general-purpose as it should be for teaching it in classrooms. I've had to recommend to people to learn other languages just to accomplish simple things, and that is very off-putting.
About the OP, I think that teaching so much command line tools, especially with tools like emacs (however good they may be) may be very offputting for many students, who are having difficulty learning simpler programming ideas, and from experience at my school, would probably make taking programming much less common of a class.
My school takes a much different approach to OP's school. We learn solely about the programming language and not surrounding tools like git, CLI, or even lldb. This is a double edged sword, and I have many mixed feeling about this. I am opposed to teaching so much CLI/emacs and the whole package right at the start (as OP's school does), as it can be super overwhelming, especially for kids who have not had to use their brain in this way at all (learning programming requires a new way of thinking compared to traditional classes). On the other hand, learning solely the programming language (as my school does) does not teach basic skills like debugging and git, and so I find it hard to work with other students without having to introduce them myself. I believe that the best way to teach this would be to have an introduction to the CLI, git, LLDB, further into the course, when students are able to understand the basics of the language.

I am no expert on teaching (I've done only a little paid teaching), but I hope that you can understand my side of the process.
Please ask any questions you might have, I am more than happy to answer anything about learning programming, even not really related to this post.

6 Likes

I've had to recommend to people to learn other languages just to accomplish simple things

Such as?

I believe that the best way to teach this would be to have an introduction to the CLI, git, LLDB, further into the course, when students are able to understand the basics of the language.

That would be a great approach. I learned programming in a college where they were careful to avoid getting into those tools much and while I liked that, I now wish they had covered it later, as you say, so I didn't have to learn them even later on my own.

1 Like

I’ve been using repl.it to teach some beginners, especially Free Pascal and Swift. It has full terminal support (emulated), real std-in and std-out, git support, paired/shared programming, and able to expose the running program and code to the world via internet. It has a balance between ease of use and learning of basic programming and tools. Try it out.

Note: I’m not involved in repl.it as company whatsoever, I’m just a happy user.

2 Likes

Laptops with Kali linux 2020.2
Installed swift with visual studio code
When will we collaborate?

Thank you so much for taking the time to respond. I very much appreciate your valuable input. I'd like to better understand some of your statements and thinking.

Was the EC2 instance paid for by the school as part of a school program or is this something that you did independently?

I love your example! :grinning:

Agreed. There's nothing like:

print("Hello, World!")

As opposed to:

using System;
namespace ConsoleApp1
{
    class Program
    {
    static void Main(string[] args)
    {
        Console.WriteLine("Hello, world!");
    }
    }
}

Could you please provide some specific examples to help me better understand?

I appreciate your thoughts. While students are required to use emacs there are very few key sequences that they actually need to learn. The arrow keys are sufficient (yet suboptimal) for movement and in conjunction with "save" and "exit" is enough to "get by". The vast majority of students learn much more on their own, including the recording of macros, because they learn to appreciate the power of the tool.

We do our best to be data-driven and students complete surveys throughout the year that serve to inform our direction. We receive very little criticism of the requirement to use emacs and the CLI. (We receive many more complaints about writing assignments. :grinning:)

I understand how one might think this, but empirically, the demand for the class has nearly doubled since we moved to a CLI/Linux/Swift-based rigorous course. An alternative course, Computer Science Principles, is intended for those who want to gain familiarity with computers and programming yet don't intend to pursue it as a career.

Again, I understand this point of view. But please keep in mind that in this post and forum I'm focusing primarily on the technical aspects of programming using a Swift-on-Linux CLI. In class, students are introduced to and practice many other concepts away from the computer, such as understanding and designing algorithms, flowcharting, etc.

I agree that it's useful to "space out" the introduction of tools over a period of time and that's our general strategy. As an example, students begin using git (and GitHub) as a repository for their essays long before we begin programming. This allows them time and opportunity to understand the underlying concepts of source control othogonally to source code.

Thank you again for your detailed response. I hope you'll be able to find time to continue to contribute to this thread; your input is valuable.

I'll PM you and see what we can do.

I made a new aws account and used the 12 month free tier. Personally, its not something I'd feel comfortable recommending to a new programmer as it does require some setup and configuring.

With the changes that have happened in the last year, my reasons for this are quickly becoming obsolete. But, it was mostly with things like making non-CLI interfaces, or cross-platform apps.

I know that you want to provide an experience with the CLI, and that other web-based Swift environments were suggested, but have you tried Google Colab? I'm with the Swift for TensorFlow team at Google, and we help to maintain the Swift Colab kernel and toolchain.

As you might expect, at Google I see a lot of people who use Chromebooks. With Colab being hosted for you and free (up to certain GPU or TPU use limits), we've found that it's been a very popular environment for developers to explore new ideas, as well as in presenting educational lessons. To date, usage has skewed heavily towards machine learning applications, but that doesn't mean it couldn't be used for introductory computer science.

Colab hosts Jupyter notebooks, which allow you to interweave text, media, and code. Any Jupyter notebook that's hosted on GitHub can be opened directly into Colab (here's an example notebook on Swift value semantics and the link to open it in Colab), so getting students started with a lesson could be as easy as hosting that on GitHub and giving them a Colab link. Swift Jupyter notebooks can also install any Swift Package Manager package from GitHub.

Sorry for the self-promotion, but with our focus on machine learning I worry that we might not have made a broader audience aware of these interactive Swift environments. I'd love to see this be used by students operating on low-cost hardware.

1 Like

You probably saw this already, but I feel like I should say it anyway: have you tried GitPod? I sometimes use it with Gryphon, which is a Swift-to-Kotlin translator, so I know at least these two languages (as well as Git, etc) work reasonably well.

Thank you for sharing this; it looks interesting. On the surface it seems better suited to experienced development teams than first-time students but we'll take a closer look.

This is very sleek and impressive. Much of the documentation and many of the examples appear skewed toward matching learning so I'll need to spend some more time exploring. It definitely opens up some possibilities.

No need to apologize; this is a great reference! Thank you!

I think that what you do is awesome! I think you have a made a lot of very good choises.

Other choises could have been made that would have been really good too, but that does not make your choises less good.

I think it is a mistake to think that stuff like CLI or Emacs are too unfriendly for students and beginners. A large and complex GUI can be really hard to get started on and can be really hard to explain.

Sticking to 1 language is also a sound choise IMO. That allows you to go deeper over time.

As an alternative to Curses I will just say that TermKit exists. I do not know if it is better or fits what your students need.

1 Like

Btw, I just added an Android x86_64 package of Swift last month, which is only good for Chromebooks since nobody uses that arch in Android itself. My Termux packages of the Swift toolchain mean people can now write and run Swift on most Chromebooks, as I think most of them now support Android apps like Termux.

3 Likes