This course has already ended.

The latest instance of the course can be found at: O1: 2024

Luet oppimateriaalin englanninkielistä versiota. Mainitsit kuitenkin taustakyselyssä osaavasi suomea. Siksi suosittelemme, että käytät suomenkielistä versiota, joka on testatumpi ja hieman laajempi ja muutenkin mukava.

Suomenkielinen materiaali kyllä esittelee englanninkielisetkin termit.

Kieli vaihtuu A+:n sivujen yläreunan painikkeesta. Tai tästä: Vaihda suomeksi.


Frequently Asked Questions

Sections on This Page

Dealing with Acute Programming Problems

I’m stuck on an assignment; what can I do?!

You can talk to one of the teaching assistants at the lab sessions You can also post a question in Piazza or Telegram (see Chapter 1.1). Please do. We are happy to help.

Two channels that are not suitable for this purpose are the end-of-chapter feedback forms and e-mail.

I got an error message that says [something]; what does it mean?

In some cases, looking up the error message online helps. If it doesn’t, try the lab sessions, Piazza, or Telegram (see Chapter 1.1).

This Ebook

What’s the significance of a gray-bordered box (or a green one, etc.) here in the ebook?

See Using This Ebook.

How long will this material be available online?

The ebook will be available online for the foreseeable future. You’ll be able to return to it later, even after the course is officially over. The auto-grader’s feedback will continue to be available as well.

Programming Tools

May I use different preference settings in IntelliJ than the ones suggested by O1?

Yes, if you want to and know how to.

May I use a different programming environment than IntelliJ?

At entirely your own risk, yes. There’s nothing in the programming assignments that absolutely necessitates the use of IntelliJ. However, IntelliJ is the only official programming environment in O1, and O1’s staff probably won’t be able to help you with any complications or technical problems that may arise if you use a different toolkit.

Using IntelliJ is particularly recommended because of its A+ Courses plugin, which makes it convenient for you to fetch and submit O1’s programming assignments, along with some other minor improvements to IntelliJ’s user experience.

What if IntelliJ’s A+ Courses plugin doesn’t work on my computer or I don’t want to use it?

A+ Courses has been created as an open-source student project. If you experience any problems, please let us know via O1’s feedback channels or directly at the A+ Courses plugin’s web site.

One option is to use IntelliJ and A+ Courses through Aalto’s Open OnDemand service, which enables you to run IntelliJ in your web browser, without installation. For more information, see the gray box in Chapter 1.2.

Alternatively, at the bottom of our IntelliJ page, you’ll find instructions for downloading and submitting assignments without the plugin. This is not a convenient option, however.

At the bottom of our IntelliJ page, you’ll find instructions for downloading and submitting assignments without the plugin. This is not a convenient option, however.

How can I share my Scala app so that others can run it?

See the big gray-bordered box in Chapter 5.4.

Deadlines and the Course Schedule

I forgot to fill in the mandatory end-of-chapter feedback. Did I irrevocably lose the points for the chapter?

No, you didn’t.

If it happens that you forget to submit the feedback form before the deadline, just submit it later. In individual instances that’s okay, but please be more careful next time.

If I fail to submit some assignments by the deadline, can I still submit them just to practice?

Yes. You won’t score points for any assignments submitted after the deadline, but you will receive the automatic feedback.

Why are the deadlines at 6 p.m., not at midnight?

The reality is that wherever we place the deadline, rather too many students will be working on assignments near that time — in more or less of a hurry, and often needing some assistance.

With a deadlines during the day, we can provide lab sessions and other support just before it.

Moreover, even though studying late at night is permissible, we’re disinclined to encourage it.

Why are the deadlines so frequent?

It occurred to me that it’s great to have a deadline every week. If we didn’t, I’d probably keep postponing the assignments further and further and then I’d really be up against it. Even now, I tend to do most of the work close to the deadline... but at least there’s not so much to do that it kills you.

Many years back, we used to have fewer deadlines that were more spread out, with more to do per deadline (night). It didn’t work.

Automatic Assessment and Grading

My program works absolutely right, but the auto-grader won’t give me any points! What’s wrong?

It is very likely that what happened is not an error in automatic grading as such but a bug in the code that you submitted.

The auto-grader counts any deviation from requirements as an error. Even a small deviation may prevent the auto-grader from fully assessing your program and result in a low score. Sometimes, even what seems like a mere formality may be significant (see the next question below).

Please read the feedback from the auto-grader carefully. Please re-read the task description carefully. Check your code for spelling errors, including those that involve upper- and lower-case letters.

Ask the assistants to help you at one of the lab sessions or post a question in Piazza or Telegram (see Chapter 1.1).

Of course, it can happen that our grader is faulty. We’ll be happy to fix the graders if the need arises; if it does, we’ll give you additional chances to resubmit or add points for you manually later.

I wrote the classes exactly right; I just changed some method names. Why didn’t I get full points?

Many assignments ask you to define variables and methods that are part of a class’s public interface. The names (and parameter lists) of those variables and methods are also part of that interface, since any user of the class needs to know them. You cannot change the names without affecting how the class is used. Code written to such a specification is not “exactly right” unless it conforms to the specification, names and all.

In O1, your classes are used by the grader program. The grader cannot use them unless you use the specified names. Don’t change the names of any public variables or methods; don’t even add any such public members.

You are free to name the private members of the classes. You are also free to add any private members that you deem necessary or useful.

Is it an error to add extra methods or variables to a class?

See the previous answer.

Not all of O1’s automatic graders penalize you for adding public members on a class, but you should still avoid doing that. In some assignments, the graders do check that you haven’t added public members beyond those specified.

I got full points for an assignment but I know my program works wrong on certain inputs. Will I lose points later?

You won’t.

The automatic assessment isn’t perfect. We kindly ask you to report such cases so that we can improve the graders; you can use the chapter’s feedback form, for instance.

Deliberate attempts to mislead the graders are forbidden, of course, and may result in a loss of points.

You can solve some of the assignments [in the early chapters] by just copying the given code and seeing what the answer is. That’s not great, is it?

Those small assignments, too, give you an opportunity to learn. Admittedly, they also give you an opportunity not to learn.

We’ve tried to design O1 so that most students will be motivated to make the most of the former opportunity. In any case, such assignments don’t count for much in the grand scheme of O1’s assessment.

Transferring Credits

Can I substitute for O1 with the other Aalto course, Basics in Programming Y1?

No. That other course (CS-A1113 / CS-A1111) doesn’t come even close to covering what we cover in O1.

Can I transfer my credits from another intro course that I took and thus substitute for O1 in my Aalto degree?

Maybe. For the credits to be recognized by Aalto, you need to: a) submit an application via the Sisu platform; and b) demonstrate that you’ve taken a course — or a combination of courses — whose contents correspond to O1’s.

Please note that Aalto requires the contents to be similar. It is not enough to just have taken some programming course that gives the same number of credits. For similarity of content, the programming language is not decisive, either; what matters is whether your earlier studies taught similar concepts and skills; for example, the basics of object-oriented programming must have been taught comprehensively.

If you do submit an application, note the following:

  • Provide details about the contents of your previous studies. Include your own explanation of how well you believe those contents to be similar to O1’s. (Our Learning goals page lists O1’s main contents. Take a look at the rest of our course materials, too.)

  • The first programming courses in other Finnish universities tend to be both different and less demanding than O1 — at least most of them are, in which case they do not alone suffice as a substitute for O1.

  • If you have taken multiple programming courses at another university, but the first course alone is not close enough in content, you might be able to substitute for O1 with a combination of courses.

Finally: We recommend that you take O1. Many students who do have prior experience from a programming course or otherwise have reported that they have learned a lot from O1, especially once we get past the first few weeks. We particularly recommend O1 in case you are planning to take some its follow-on courses at Aalto.

Can I substitute for O1 with work experience, success in programming competitions, or similar prior experience?

Here’s the Computer Science department’s general policy about this (translated and paraphrased):

“We encourage students to program competitively, and we are happy to award credits for skills gained while so engaged. For instance, students might get credits for CS-E4590 Competitive Programming or another optional course. They may place such credits in their elective studies, and I [head of the CS degree programme, professor Jukka Suomela, jukka.suomela@aalto.fi] can take care of awarding such credits.

However, competitive programming alone cannot substitute for our key programming courses (e.g., Programming 1, Programming 2, Programming Studio 2, Data Structures and Algorithms), because success in typical programming competitions alone is not enough to demonstrate the core skills taught in these courses. Aalto’s rules for credit transfer are strict (“equivalent contents”), and competitive coding could be said to have an equivalence mainly with CS-E4590.

The same goes for work experience: having a programming job is not alone sufficient proof of all the skills that we target. The main vehicle for receiving credits for work experience is the course code SCI.harj/SCI.khar, which also goes into elective studies.”

So a simple substitution is out. Doing course assignments is the main way in which students demonstrate their learning, and that’s why we require it. For someone with plenty of prior experience, the assignments will take less time. See also the answer to the previous question; O1 can be educational to non-beginners, too.

However, if you a) are vastly experienced, b) have taken a look at O1’s entire contents, and c) are confident that you’re already fluent in everything or almost everything that we teach (including, for example, matters related to code quality and functional programming), then you may contact O1’s teacher (see Chapter 1.1). Describe your skills in detail, and we can consider if there is some alternative way for you to pass the course.

Natural Languages

I know Finnish, but I’m using the English version of the ebook. Programming terms sound unnatural in Finnish. Programmers speak English, right?

Please see the corresponding section in the Finnish version of this F.A.Q..

The Scala Language

Is the Scala language in widespread use?

Compared to a random programming language: yes.

Compared to the most commonly used programming languages in the world (such as Java, JavaScript, C, and C++): no.

The language is used by many leading companies and other parties, such as Twitter, PayPal, The Guardian, Zalando, Reaktor, Capital One, Blizzard, Netflix, Disney, LinkedIn, Intel, Samsung, Spotify, Airbnb, Morgan Stanley, Goldman Sachs, Duolingo, various computational scientists, etc. Some of them are listed on Wikipedia.

Some O1 students may be interested in reading Li Haoyi’s blog posts, in which he

There are articles elsewhere describing why Duolingo and Zalando, for example, went for Scala. (The articles may not be impartial, but anyway.)

Various attempts have been made to compare programming-language popularity. I’m not sure if any of the attempts is exceptionally good, but here’s one anyway: RedMonk Programming Language Rankings.

Why did you pick Scala for O1?

There’s no one reason that clinches it. The choice of Scala is based on a combination of criteria. Not all of those criteria concern O1 alone but the first-year programming courses and degree programmes at Aalto more generally.

Below is a list of some of Scala’s attributes. The point of this list is not to say that these features are unique to Scala. Some of the individual items in the list are better realized in some other languages. However, this combination made Scala the most attractive choice.

  • Scala is a multi-paradigm language that can be used for different kinds of programming.

    • Scala is well suited for learning functional programming (which is one of the goals of Aalto’s first-year spring courses especially and relevant in O1, too).

    • It is also well suited for learning imperative object-oriented programming (in O1, for example).

    • The programming courses in our curriculum have a variety of learning objectives and switching languages mid-year would be less than optimal.

  • Despite not being one of the most common programming languages, Scala has plenty of street cred. It’s used by many people both in academia and in the software industry.

  • Compared to various other programming languages, Scala has relatively “clean” concepts. (As an example, Scala’s implementation of object-orientation is purer than that of, say, Java or Python.) This is nice for beginners, professionals, and others in between.

  • Many things are relatively simple to express in Scala. Many other languages require more code to express simple things.

  • If you know Scala, it’s relatively easy to learn the commonest programming languages such as Java. (The bigger challenge may be to motivate yourself to use a more limited language after Scala.)

  • The language is statically typed, which is a good fit with our first-year learning objectives and enables better programming tools. Scala’s type inference ensures that static typing doesn’t “get in the way” like it does in some other languages.

  • With Scala, it’s possible to design pedagogically effective courses that take one careful step at a time but that nevertheless reach deep, challenging topics.

  • Our programming courses are taken by students with variable prior experience. Scala suitable for teaching beginners (if used right). Moreover, many of Scala’s features are familiar to students who have previously worked with Python, C, Java, and the like; those students can thus build on their prior knowledge when they use Scala. Scala may tempt those experienced programmers to develop new perspectives on programming (such as transitioning from the imperative to the functional paradigm).

  • Scala operates on a high level of abstraction, as befits a modern introductory programming course and much of modern programming. As a couple of examples of this, the language has a rich arsenal of collection types and provides automatic garbage collection so that there’s no need for manual memory management.

  • Using a REPL is ingrained into the programming culture around Scala. It’s a great tool for beginners, too.

  • Many specific details of the Scala language are potentially helpful for learning to program (e.g., singleton objects; val vs. var; etc.)

  • Scala’s libraries are wide and varied (in part because we can use Java libraries, too; Chapter 5.4).

  • The available programming tools and documentation are adequate. (This is a partially problematic issue, though.)

  • Scala is efficient and convenient in parallel computing, data science, and server-side programming, among other things. This adds to its appeal in various follow-on courses.

  • The teachers of our introductory programming curriculum like Scala.

  • We want to offer you, dear students, something fresh and a little bit different.

At Aalto, we’ve used Scala for introductory programming since 2013. It’s worked well. Scala 3, which was released in 2021, further boosted the appeal of the language for us.

Lund University in Sweden adopted Scala as an introductory language in 2016. You may wish to read what they said about their reasons.

Is Scala designed specifically for beginners or students?

No. Scala is designed for demanding professional use.

In fact, it’s relatively rare to use Scala in an introductory programming course. One reason is that the language hasn’t been established for very long; traditional teaching languages aren’t easily dislodged, and there isn’t a wealth of beginner-friendly material on Scala out there.

A second reason is that many introductory courses at different institutions have goals that are either more modest or otherwise different than ours in O1, so other languages may fit the bill better.

And a third reason may be that since Scala is so versatile, it takes particularly meticulous pedagogical design to harness it for introductory use.

On some web sites, Scala looks different than in O1’s examples. Is this about language versions or what?

Yes, you may have run into a different version of Scala.

A major update to the language, Scala 3, was released in 2021. Programmers are gradually migrating to the new version; in O1, we’ve used Scala 3 since 2022. Some web sites and books already feature Scala 3, but older ones especially use Scala 2.

Code written in Scala 3 looks slightly different from Scala 2, but all the most important principles remain the same. The most visible change involves the curly brackets { and }: whereas Scala 2 required programmers to write them around various blocks of code, the brackets are (largely) optional in Scala 3 and usually omitted. You’ll find a little bit more info about this in our style guide.

Apart from the changes in how code looks, Scala 3 brings a number of other improvements. Most of those aren’t too relevant to a beginner learning the basics of programming, though.

Can Scala be used for web programming?

Yes. See Scala.js and Play, for example. See also the next question below.

What kinds of things can Scala be used for? What kind of libraries are there for Scala?

Scala can be used for a variety of things, in various ways. For a list of libraries for different purposes, see Scala Awesome.

Feedback

Credits

Thousands of students have given feedback and so contributed to this ebook’s design. Thank you!

The ebook’s chapters, programming assignments, and weekly bulletins have been written in Finnish and translated into English by Juha Sorva.

The appendices (glossary, Scala reference, FAQ, etc.) are by Juha Sorva unless otherwise specified on the page.

The automatic assessment of the assignments has been developed by: (in alphabetical order) Riku Autio, Nikolas Drosdek, Kaisa Ek, Joonatan Honkamaa, Antti Immonen, Jaakko Kantojärvi, Niklas Kröger, Kalle Laitinen, Teemu Lehtinen, Mikael Lenander, Ilona Ma, Jaakko Nakaza, Strasdosky Otewa, Timi Seppälä, Teemu Sirkiä, Anna Valldeoriola Cardó, and Aleksi Vartiainen.

The illustrations at the top of each chapter, and the similar drawings elsewhere in the ebook, are the work of Christina Lassheikki.

The animations that detail the execution Scala programs have been designed by Juha Sorva and Teemu Sirkiä. Teemu Sirkiä and Riku Autio did the technical implementation, relying on Teemu’s Jsvee and Kelmu toolkits.

The other diagrams and interactive presentations in the ebook are by Juha Sorva.

The O1Library software has been developed by Aleksi Lukkarinen and Juha Sorva. Several of its key components are built upon Aleksi’s SMCL library.

The pedagogy of using O1Library for simple graphical programming (such as Pic) is inspired by the textbooks How to Design Programs by Flatt, Felleisen, Findler, and Krishnamurthi and Picturing Programs by Stephen Bloch.

The course platform A+ was originally created at Aalto’s LeTech research group as a student project. The open-source project is now shepherded by the Computer Science department’s edu-tech team and hosted by the department’s IT services. Markku Riekkinen is the current lead developer; dozens of Aalto students and others have also contributed.

The A+ Courses plugin, which supports A+ and O1 in IntelliJ IDEA, is another open-source project. It has been designed and implemented by various students in collaboration with O1’s teachers.

For O1’s current teaching staff, please see Chapter 1.1.

Additional credits appear at the ends of some chapters.

a drop of ink
Posting submission...