Friday, April 29, 2016

Dart in Education: Interview with Prof. Dr. Nane Kratzke

Nane Kratzke is a professor of Computer Science at the Lübeck University of Applied Sciences in North Germany. He conducts cloud computing research at the university’s Center of Excellence for Communications, Systems, and Applications (CoSA).

He also gives Computer Science courses — one of which uses Dart as a vehicle to teach web programming. We asked Nane about this.

 

[Off-topic] Is it true you were researching network warfare at some point in your past?

Yes, that is true. I was enlisted in German Navy as a Navy Officer and during my military time I studied Computer Science at the University of Federal Armed Forces in Munich, Germany. For about six years after my studies, I was involved as a software engineer, team leader and project leader in several programs for command and control systems of German frigates.

After that, I worked as a consulting software architect for a German think tank consulting mainly the German Ministry of Defence. I did some research with the University of German Federal Armed Forces, Munich, concerning network-centric warfare (especially agent-based simulations) and consulted the German Ministry of Defence in questions of network-centric warfare and enterprise architecture management.

You lead a web technologies course in Lübeck. How did you design this course?

I would not say that the current course is ‘designed.’ It was more like an evolutionary process.

It started as a really standard course focusing mainly on HTML and server-side programming using PHP. Forms encoded in HTML, server-side form handling and that kind of thing. This setting is very limiting in terms of designing some fun or challenging tasks from a teaching perspective. No student ever told me that, but I am afraid this course was very boring.

I decided to let the course evolve by concentrating more on the client side using JavaScript. It turned out that focusing on the client side is much more interesting and challenging for students. It simply provides much more flexibility to create interesting tasks for students. Like developing a game for instance.

One year later Dart comes into my focus of attention. And Dart seemed to be a great language for a web technology course. I decided to give it a try.

The primary intent of the course is to let students develop something fun by applying some useful concepts of software engineering. Furthermore, the course is designed in a problem- and project-oriented way of learning and teaching. All theory lectures about web technologies is more like an introductory crash course on the very basics - just to draw the big picture. The students have to understand the web technology concepts in detail on their own, and by solving a concrete problem as a team. So, an educational theoretician would likely categorize the course as a problem-based teaching approach embedded in a project-based context (or something like that).

Games are a good combination to do this, in my opinion. Games let students forget that they are studying and that they are applying a lot of "boring stuff" like logic or modeling concepts. Notwithstanding, they learn a lot about using:

  • patterns (they get to know in their 3rd semester),
  • modeling (game logic, which is a lot of formal logic — of which students are often afraid),
  • applying object orientation (they get to know it in their 1st and 2nd semester but don’t have the chance to apply it in a more complex setting),
  • separation of concerns,
  • and so on.

If learning can be fun, it should be. This is not possible in all computer science courses of course. But in web technology, there is a clear opportunity.

Your course introduces students to HTML, CSS, DOM, HTTP, REST, ... and Dart. Why not the more obvious choice — JavaScript?

The very basic idea dates back to my own studies of computer science. In my first semester, we had to attend a programming course. Some of us could already program. Some of us not. Our professors decided to ground us all. We learned to program using "non-obvious" Haskell. None of us even heard of that language at that time (nowadays, Haskell is much more well-known, even for students).

All of us had to start at the beginner level due to that. Looking back, this was one of the best decisions. Taking a non-obvious choice of a programming language makes your students more equal. Grading is fairer because you do not grade how good a student is in a specific programming language. Instead, students get graded for their general understanding of programming and software development. Knowledge of a specific programming language does not say so much most of the times, from my experience.

How does Dart fare as a programming language for education?

I would not say that Dart fares better than any other language. Each language has its strengths and weaknesses. A preference for a programming language is a very personal point of view. I like Dart, I love Ruby (but it would be cool if Ruby had an optional type system ;-), I would like to do more with Haskell after decades of abstinence, and I am no real friend of Java (although I teach it in introductory programming courses).

But there is no objective reason for my preferences, and these are personal preferences. It is simply not worth to fight these "language wars" in my eyes. A programming language has to fulfill a purpose.

So, the main reason for me experimenting with Dart was its "non-obviousness", to ground all to the same level. Besides that, there are some further and maybe objective benefits:

  • You can use the same programming language on client and server side (which is a major advantage for web technology courses — you don’t need to introduce two or even more languages, which tends to be very time intensive).
  • You have a working dependency management system (pub). This solves a lot of nitty-gritty problems you have in a JavaScript course. Yes, there are solutions to do same in JavaScript.
  • Dart is inspired in a lot of aspects by Java and Java is our teaching language in 1st and 2nd semester.
  • Dart is a class-based, object-oriented language and therefore much more familiar to most students (compared with the prototyping style of object-oriented programming known from JavaScript).

What are some ways in which Dart could be better at this?

Of course, more tutorials would be helpful for students. Especially in the German language.

Dart has some strange concepts (from a student perspective) like inherent interfaces and a missing "protected" access modifier for methods and data fields in object-oriented programming. So Dart might be not the best choice in these details. Also, concurrent programming and isolates are not easy to use from my point of view. I would really appreciate some more pragmatic concepts for parallelism in Dart, like a parallel map for streams. I even wrote some time ago a blog post about that.

However, I am afraid there never will exist a perfect programming language. ;-)

From a teaching perspective, it is very sad that the Dart team has stopped the development of the Dart Editor. It was simply great to install an IDE with all dependencies working out of the box. Of course, the recommended IDE — WebStorm — is a great IDE as well. It provides much more features. There are good reasons that the Dart team does not want to concentrate on supporting and developing an IDE. However, for a beginner, this introduces starting obstacles. A student not known to Dart or even web programming has to install an IDE, install the Dart SDK and get the IDE configured to work with the SDK. These are no severe obstacles, but it was much easier to do the same with a one click Dart Editor install. Students were instantly ready to program Dart.

Of course, there is the online IDE — DartPad — which is a great starting point for diving into Dart. But as a teaching institution, we need an offline capable IDE installable on our machines at our labs and home on students’ laptops or desktop systems. A solution must work even if the network connection is down due to whatever reasons. It would be really great if there would be a one click installable desktop version of DartPad. I love JetBrains — the makers of WebStorm and a lot of other great IDEs. But it is never a good feeling for a teacher to wonder whether the academic and classroom licenses might be still for free in the next semester. I do not think JetBrains would drop its support for education. However, I like to have my courses autarchic and not relying on outside support and goodwill.

For those students who have had an experience with another language (but who are — presumably — still junior), what is their approach to Dart?

Our students learn to program using Java in their first and second semester. So, the transfer to Dart is quite smooth. But inherent interfaces and a missing "protected" modifier are for some students a bit hard to accept.

Some confusion arises with the optional type system at the beginning of each course. A lot of students know dynamically typed languages like PHP or JavaScript and of course, all students know statically typed languages like C or Java. Because Java is our teaching language in the first and second semester, students are used to programming in a statically typed way.

The Dart code of my students makes it evident that their programming style changes over time. They start with a lot of static types and, week by week, the types disappear more and more - almost completely. But at the end of the course types reappear in method definitions.

It is a fascinating process from a teaching perspective. This Dart style of coding is not requested for the course and is not considered for grading. It just happens by insight.

Another aspect is asynchronous programming. Because the code is still arranged in a sequence of lines it is hard to understand for many students how async methods are working at first. This feature is not as widespread in other languages. So, a lot of students can not transfer the async concept from another language to Dart. Which makes it tricky for them to understand. However, using exactly this feature to implement action handlers for DOM-tree events is astonishingly intuitive for most students. This is still a bit weird for me because students use a feature intuitively without understanding its concept. I think the reason might be, that Dart API is designed very carefully and with programmer’s intuitions in mind. But I do not know how much is intentionally designed or just API designers’ "luck." However, it works for most students.

Part of the course is applying skills by building a simple, DOM-based web game. Why a game (as opposed to, say, a TODO app)?

I think a game is a great object of investigation for a computer science student. You have a non-trivial logic, which I think is much more complex than in a TODO app. You need an elegant user interface, hiding all irrelevant complexities of the game logic. And you have to separate these kinds of concerns.

Of course, you can develop a TODO app. But no one "loves" a TODO app. Almost everybody loves gaming.

I do not think that my students would share their TODO apps. But they are proud of their games and share them with their friends, family and via social networks. I started a hall of fame for the best games of every semester in my last course because I was asked to do so by my students. They simply want to share their game outcomes.

So, students are simply much more motivated when implementing a game. I have absolutely no clue how to motivate with a TODO app.

How many students do you have each semester? What is their feedback on the course?

There are about forty to sixty students each semester (steadily increasing over the last years). We have three or four corresponding practical classes and teams of three or four students within these courses. Each team has to develop a game which is often inspired by classic arcade games like Tetris, Boulder Dash, Pac-Man and so on. The teams can choose the game concept they want to implement.

As a supervisor, I only have a look in five sprint meetings (concept, general architecture, alpha, beta, final) to assure that all games across all teams have comparable complexity and are on track.

The course is very well accepted despite the fact that developing a game is hard work, and you have to apply all of your software engineering skills to build a good game. I think the students do not see the work as intense, thanks to the fact it’s a game they’re making.

I have a habit of asking each team spontaneously in their final presentation of the game whether they could add an additional feature before release. They only have one or two days left at that time. I check that way how extendable and resilient their architecture is. It is a bit like the real world where your customer has a new idea although you were so happy to finish the project in time. The students do not have to do that. But most teams take the challenge. They are really motivated. Some of them even solved the problem at the time of the final sprint meeting. That impressed me because it shows that they not only built a game, not only solved a problem, they know how to build software in an extendable and resilient way.

What would you recommend to other educators who are thinking about teaching web technologies (or programming in general) with Dart?

Personally, I think Dart would be a great language to learn programming. But a lot of curricula in computer science depend on statically typed languages for freshman students. That might be why most study programs rely on Java, I think. So, I am afraid there is little acceptance of such an approach.

To use Dart in a web technology course is much more practical for a teacher. The simple reason is that you can work with the same language on the client and the server side. And the language is intentionally designed to support both sides. As a teacher, you do not have to introduce two or even more languages.

Especially in web technology there is a lot of previous - but heterogeneous - knowledge of technologies among all students. Some students are PHP wizards, other students are capable of programming, but have no experience in any web technology at all. This difference in skills is really challenging for a teacher. However, at the end of the course, all students should have somehow the same level of skills. I do not know any other course in a computer science study program (with the exception of introducing programming courses) where this issue is so distinctive.

A general recommendation is to keep the experienced students motivated by providing something new for them. This can be done using the "non-obvious" Dart instead of the well-known PHP/JS language combination. And let experienced students share their knowledge with the more inexperienced students. Project-based learning is a great way to do this.

However, I am afraid over the years Dart will get more and more widespread. The first students are coming in my courses and have already programmed in Dart. So, it might be that I have to find a new, non-obvious language in a few years ;-)