Iteration 0: The Development Environment

Deadline

Use the first class to work on the exercises below. No hand-in is required.

Kata

Spend the first 15-20 minutes of the class in plenum discussing...

Blizzard's online card game 'Hearthstone' is played by two players, and a central inspiration for the mandatory project 'HotStone'.


Image from heartstone.blizzard.com

SWEA is rooted in the object-oriented programming paradigm: programs are made of interacting objects, that holds data and operations = "do things to that data".

Consider the visual elements in the above image and try to identify objects to model in our OO program. What data should the objects hold? What operations may be present?

Consider that "the game itself" is an object. What data must it hold? What operations must it support?

Try to draw (parts of) your understanding on the whiteboard, using UML class diagram notation.

When playing cards onto the battlefield, cards may trigger 'actions' or 'effects' which can change all sorts of state/data in the game's objects: add health to a hero or other card, draw a card to the hand, steal a card from the opponent's hand, kill all fielded opponent cards, etc. How can you model that?

"High cohesion and low coupling" is a mantra in programming. Discuss informally what these two concepts are; and discuss if 'low coupling' is possible when modeling the above mentioned card effects.

Important: The above questions are not to be "fully answered" but just to be reflected upon and left open with 'quite a few unanswered questions.'

Exercises

Group forming

Form groups of two (recommended) or three persons and enroll in one of the available groups on BrightSpace. If no free group is available, contact a TA or Henrik Bærbak and we will create one.

Is your Java and/or programming skills rusty?

SWEA assumes some proficiency in programming in Java! So if you are a bit rusty, then start out by reading and coding the prerequisites with exercises that I have designed. If you master these small exercises, you have the skills that the SWEA course requires.

Development environment

This course requires a lot of tools running on your machines and I provide two options for you. Either you use a pre-installed virtual Lubuntu Linux machine that has all tools; or you install the tool stack onto your machine by yourself. Either way, consult the Tools page for what to do. I will recommend using the VM if your machine is an Intel based machine, and has enough juice to run it at acceptable speed: Linux is something you ought to know if you want to become a software engineer.

  1. If you do not use M16, get hold of the starter code for the mandatory project hotstone-tdd-start.zip, and unzip it in some suitable folder, and rename the folder to 'hotstone'; I unzip it in my '~/proj' folder to get the project root in '~/proj/hotstone'.
  2. Test your installation by running gradle test in the root folder of the project. It should output something like
    csdev@m33:~/proj/hotstone$ gradle test
    Starting a Gradle Daemon (subsequent builds will be faster)
    
    BUILD SUCCESSFUL in 879ms
    4 actionable tasks: 4 executed
    
  3. If you do not use the M16, import the HotStone project into your IDE of choice. If you use the course recommended IntelliJ, you can follow the Import a Gradle project into IntelliJ guide.

A warning about CoPilot, ChatGPT, and AI tools in general

CoPilot and AI tools are great tools to increase development productivity. However, in a learning context, they may hinder your learning experience as they "spew out a lot of code": Are you in charge of CoPilot, or does CoPilot take charge of you? You should not use a tool that produces code that you do not have the ability to overview and understand.

Therefore, do not use AI generated code at least until after the Autumn break. You need to learn to master coding before you let AI generate code for you. In the late parts of the course, when CoPilot is a faster way of writing the code you could write yourself, it is OK to turn it on.

It is sadly a recurring reason for failing the SWEA exam, that students with too weak programming and coding experience, has relied too much on IntelliJ 'code completion' and 'intention action' support, and therefore are incapable of producing valid Java code at the exam. I fear AI tools may make this situation even worse. Avoid the trap, become a good programmer before turning on AI tools! At the time of writing, using AI tools is not allowed at the exam.

Screencasting

Several hand-ins will require delivering screencasts. If you have not made screencasts before, check out our group's ability to make such. Consult the Tools page that contains suggestions. If you have others, please report so on the web board, to get everyone going.

Card Games

The course uses a concrete programming project, HotStone, to illustrate central concepts from course curriculum: test driven development, design patterns, compositional design, frameworks, systematic testing, and the Broker pattern for remote method calls.

The project, when finished, will be a framework for designing variants of a card playing game, quite a few simple variants, and one variant that is playable (and approaching 'fun to play'), and includes a functional graphical user interface and the ability to play over the internet.

If you have never played any card games like Blizzard Hearthstone, etc., I suggest that you "play around with them" a bit. Many of them are free games to try out.

I have made two videos (in Danish) about HotStone, if you already know HearthStone, then choose the short one.

  1. Introdution to HotStone game play and user interface (MP4/13 min).
  2. Introdution to HotStone user interface (MP4/5 min).

Another route is to play HotStone directly. You play with a friend using my game server (you will be alpha-tester of the system, so please report issues/defects/crashes on the SWEA forum). Find instructions on hotstone.littleworld.dk:5220. It is a bit tedious to start a game, sorry about that.

Jump into AlphaStone

Start on the Iteration 1 exercises which is next weeks mandatory.