Scala development on Windows

I have a nice opportunity which I’d like some advice about.

I have the opportunity to teach a 2-week programming course to gifted high school students in Mississippi (the US state where I grew up) (13 to 16 year old students probably from poor families). I applied for this position with a proposal to teach functional programming using Scala.

They accepted my proposal, but (unfortunately for me) the IT infrastructure will be an all-Windows platform. I have no experience doing software development in MS-Windows.

I plan to use IntelliJ and share code using GitHub.

Are there special things I have to do using IntelliJ from Windows that are different from Linux and MacOS?

For example, does the concept of USER work the same? Installing ssh keys to avoid typing passwords 1000s of times? What about Windows funny end-of-line weirdness? What about git push/pull/confict-resolution using IntelliJ? I usually disable all git-interaction from IntelliJ as I use other unix based tools. Are there other gotchas that I need to inform myself about before facing the students unprepared?

1 Like

Good luck with using windows to develop something.

IntellIJ should be enough for compiling and running the code, but not sure about all the other things.

You may want to ask if you can use the WSL, that is what I use at work (with vscode + metals).
If you can’t, you may want to use git-bash for windows.

Hi Jimka,

I have been using Eclipse, Intellij, SBT and git on a Windows server vm for about a year and it works fine.
We always install Cygwin. If it’s on the path you can run ssh, df, etc from the Powershell prompt.
Powershell also has a lot of aliases named after the Linux equivalent, like ls.

btw: I grew up in Grenada MS.

Steve

2 Likes

I think you just need to install https://git-scm.com/downloads and https://www.jetbrains.com/idea/download/download-thanks.html?platform=windows&code=IIC
intellij bundles JDK and Scala plugin bundles sbt which can be used from intellij interface.
I’d use git via intellij too, as it’s probably too much to fit in the same course otherwise.

1 Like

the ScalaBridge folks have had good luck getting beginners up and running with the IntelliJ Scala bundles: https://github.com/JetBrains/intellij-scala-bundle

Jim: I linked to this thread on Gitter at https://gitter.im/scala/scala?at=5e593741376d882250bf0da2 , you might like to read the discussion that ensued, though perhaps folks will come say the same things here

3 Likes

For example, does the concept of USER work the same? - usually everything can be done from a limited user, you don’t need access to super user
Installing ssh keys to avoid typing passwords 1000s of times? - git bash has the same commands as everywhere else
What about Windows funny end-of-line weirdness? - intellij defaults to LF
What about git push/pull/confict-resolution using IntelliJ? - it’s great

2 Likes

thanks Seth. That’s a great idea to post the message over there.

I have worked for some time on Windows using IntelliJ, Scala, SBT and Git.

You need Java, both for Scala and IntelliJ. On Linux, you were probably using OpenJDK, and on Windows, you will probably be using Oracle’s JDK.

Instead of Bash, you will probably be using PowerShell, but command line tools like scala, sbt, ssh and git work pretty much the same. Setting up ssh keys on Windows requires different tools, but the fundamental concept is the same.

Git, by default, will adapt line breaks. So, if some one codes on Linux and has Linux line breaks (LF), and then pushes it and you pull it on Windows, all the LFs will be converted to Windows line ends (CR-LF). In my case, this broke unit tests that contained string literals with line breaks. Most text editors will tolerate either line breaks.

When you save text files, I would recommend to make sure they are encoded in the more standard UTF-8 rather than some Windows-specific encoding.

File paths look different, with different root(s) and a different separator between directories. Also, the PATH environment variable, which contains a list of paths, is using different characters to separate these paths from each other.

It is a good exercise to write your code in a way that is platform-independent.

Windows is fine for development. If you still miss Linux, there is CygWin and Bash for Windows.

3 Likes

That’s nice to know. Thanks

Any chance you can use Virtual box? I use a Windows box to do some development, and I do so using a Linux desktop hosted in virtualbox.

Brian Maso

1 Like

Hi Brian, are you suggesting I install a virtual box on my Mac and run windows in it, and experiment with what the development environment is like? Or are you suggesting the other way around, to install a virtual box on the students’ windows machines and run unix under that?

The second option: run Unix client under Windows host.

Brian Maso

I’ve been developing Scala on Windows for about 4 years now, and have been using Windows as a dev machine before that as well (I actually have no Mac experience at all).

If your students have access to Windows 10, then I would highly recommend using WSL for linux-like utilities. The WSL environment has access to the normal windows drives, so you can save your projects on the windows file structure and access them from WSL.

However, if the students lack prior Linux experience, it might be worth considering not using any shell at all. It really depends whether you want to teach them something beyond programming in the limited time of 2 weeks.

This goes double for git. It might be worth to facilitate code sharing via simple folder sharing on the same network, which I believe the IT team could help set up? In any case, I find that SourceTree is ideal for git on windows (as a free tool), especially for those not experienced with git nor with shells in general.

I’m using IntelliJ for Scala, but perhaps vs-code is ideal for your use-case. I haven’t used vs-code for Scala so I can’t say how smooth that experience is, but I did use it for other projects and it is faster and simpler than IntelliJ overall. IDEs in general are not trivial for newcomers, so it might be worth considering vs-code for your students.

Hi Eyal, thanks for the suggestions. I’m suspecting that most of the students haven’t used unix before. Maybe there’ll be one exception if I get a little hacker in the group, all the better.

Let me be careful to understand your suggestion. Are you suggesting TO NOT attempt to use the git interface in IntelliJ under windows?

If they haven’t used unix then I’d suggest not introducing it to them, unless that is part of the curriculum. And the same goes for Git. I believe it’s possible to experience programming and simple projects without those (that’s how I started).

As for git in IntelliJ, I’ve only ever used it for file history (looking / comparing older versions of the file open in the editor). For most of the common operations I use SourceTree, and when I need a git shell for non-trivial operations I use the git bash (part of the standard git installation for windows).

I’d say it’s also important to consider what machines they will be working on. They might very well be using a much weaker machine than the average professional programmer machine. That could mean that heavier applications such as IntelliJ and SourceTree are better avoided.

1 Like

With that age group and that length of class, I’m very skeptical that there is any way to improve on “install the IntelliJ Scala bundle and use it for literally everything”.

(At least, unless you ditch the idea of doing local development at all and just do everything using Scastie or ScalaFiddle. Have you considered that? There are cons as well as pros, but the pros are substantial, especially on day 1.)

I acknowledge that IntelliJ has a bewildering large array of functionality available, but you can guide students to the parts they actually need, and alternatives involving anything command-line based, or any additional software at all besides IntelliJ, just increase the complexity and the potential for confusion, IMO.

1 Like

Seth, yes I’m leaning toward just using IntelliJ for everything. I’m supposing that the Scastie or ScalaFiddle approach won’t allow any sort of graphical output such as plotting functions or drawing colors. I haven’t looked into the “IntelliJ Scala bundle” yet to see what it contains, but I intend to do that.

In my experience, part of the frustration with IntelliJ was that I didn’t know anyone else who used it, and I didn’t have anyone to ask simple questions to about it. It was difficult to formulate questions on forums about IntelliJ because I didn’t know the names of any of the widgets or concepts. When I learned emacs, many years ago, I did so sitting among other emacs users. I hope the students will find IntelliJ palatable because I’ll be able to help them with perceived difficulties.

As I don’t easily have access to a windows computer, what is the use model of the IntelliJ Scala bundle? Do I unroll the bundle, and then update everything to latest? Or do I always keep everything at the version in the bundle? Typically whenever IntelliJ offers me an update, I accept it. Maybe that would be a mistake in the model you’re referring to.

It is possible that they will be confused with how IntelliJ handles file saving; i.e, it saves files automatically. This can be configured but not all that trivial. I know it confused me at first, given how any other (offline) editor I’ve used before – be it for code, text, sound, image, etc – expected users to save their files manually.

1 Like

It is hard to remember which things we found difficult when we were learning.

1 Like