Alexito's World

A world of coding 💻, by Alejandro Martinez

🔗 Linked post

Check out the linked article.

Swift as a good language to learn Software Development

The author of the linked post gives some reasons on why Swift is a good language for an introduction to computer science class. I’m really interested in Swift being a good language to teach and I found the post really interesting.

So let’s take a look at some things that he says:

...object-oriented programming is a tool in algorithmic reasoning. It's better to learn algorithmic reasons first so you can understand why object-oriented programming is necessary.

Really interesting thought on the place of OOP in the process of learning. I totally agree. OOP is just another tool in our tool belt, some may argue that it’s not even a good one. But you need to know what are the problems and think on how you could solve them before always employing OOP. (although what we learn by OOP is sometimes not what it was mean to be, but more of that another time, or you can read some ideas now.)

I had the luck to learn the basics of programming without OOP, well at least for some months. But even after that, all the algorithmic exercises that I did were in C, so it was a really good way to learn what problems are and how to approach them before answering always with objects.

Students should still learn explicit memory management, just not in their first year.

I disagree on this. I think that knowing how things work behind the scenes of a high level and memory managed language is a really good first step to understanding how everything works. Without understanding how things work there is no way that you can accomplish great things, with any programming language. You can grab a vague idea of what you are doing, but until you go deep down the rabbit whole you can’t understand what you are doing.

I like the middle point where Swift resides here, but I would still think that going to a much lower level after the first weeks it’s absolutely a good thing. That’s why I wouldn’t discard C as a language to learn early on. Yes, really.

my biggest complaint about Swift is that it lacks Python's simple input() and read() commands

Hell yes! That’s one of the biggest issues that I found when trying to teach programming with Swift. Playgrounds are cool, but in my experience a good way to start teaching programming is with the typical exercise where you run the program and it asks some question and gives some answer. It lets the student create it’s own data and experience some first simple ways of manipulating that data. And in reality, that’s what is all about.

I can work around this by providing students with a library that would include my implementation of these two methods. The downside is that now I'm teaching the students my code and not a technique they can apply outside of the classroom. While this would work, it isn't ideal.

This is how I learn programming in Java. With a library that the teacher give us that let us write some code hiding all the stupid things of Java and, if I remember correctly, it was even written in Catalan. The result, people didn’t know how to do basic operations in Java, because they used that library during the whole year.

So I would say, if you must do it, do it only for a couple of weeks. Not more.

...Because we want students to have the same language for their entire first year...

This is another thing that I disagree with. In the University you should learn how to think and how to program, not any specific language or even paradigm. Maybe is worth it to stick with a language in the first weeks, but one entire year is to long. I would vote to expose the students to at least 2 languages in the first year. In my case was Java and C.

I would love to keep reading how people is using Swift to teach. It’s one of its more interesting aspects.

If you liked this article please consider supporting me