![]() |
VOOZH | about |
We’re so glad you’re here. You can expect all the best TNS content to arrive Monday through Friday to keep you on top of the news and at the top of your game.
Check your inbox for a confirmation email where you can adjust your preferences and even join additional groups.
Follow TNS on your favorite social media networks.
Become a TNS follower on LinkedIn.
Check out the latest featured and trending stories while you wait for your first TNS newsletter.
Martin Odersky, creator of the Scala programming language has posted a masterful proposal for developers to pursue the concept of “Lean Scala”.
Lean Scala is a coding style that aims to make Scala code simple, understandable, concise, and expressive, Odersky wrote.
Scala has a reputation as a complex language that has a steep learning curve compared to other languages. “There’s quite a lot of complexity there. And that complexity is made kind of worse because it’s built on top of Java and its ecosystem,” Matthew de Detrich, an open source developer at Aiven and a maintainer of the Apache Pekko project (which is written in Scala), told The New Stack in a discussion about Pekko. “It’s quite a lot to learn, but Scala 3 has done quite a good job in simplifying” things, he said.
For instance, in Odersky’s courses in EPFL’s Scala specialization on Coursera, he presents many examples of lean Scala code.
“Scala, and in particular Scala 3, is a very good notation for writing lean code,” Odersky wrote. “It has a smallish, quiet syntax. It has a concise and expressive type system with good type inference that gives type safety and documentation without a lot of boilerplate.”
Another factor in Scala 3 being well-suited for writing lean code is its immutable-first orientation, which promotes software that is reliable and correct by design and provides an expressive toolkit for clean modularization, he said.
However, Scala’s flexibility and expressiveness can also lead to challenges, such as varying coding styles and over-abstraction.
To address these challenges, Odersky proposes identifying a recommended style for writing lean Scala code. The properties of this style include:
“The innovation of Scala allowed me to implement Akka as my vision for the actor model on the Java Virtual Machine,” Jonas Boner, CTO, co-founder and chairman of Lightbend, told The New Stack. “User code expressing its intent has always been central to us in the Akka team, even at the price of more intricate library code in Akka. We nowadays fully support Scala 3 alongside Scala 2 and Java. I’ll follow Martin’s Lean Code initiative and we will revisit our examples to show them in Scala 3 with Lean Scala in mind.”
Lean Scala is but one way to write code in the language, Odersky said. Moreover, lean code can be written in any programming language, but some languages make it easier than others, he said.
“There are situations and whole application areas where you want to deviate from the style and develop your own set of principles and techniques,” he wrote.
Writing lean code can be like writing lean technical prose, Odersky said.
“Lean code is simple and understandable. It is as concise as possible without losing clarity,” he explained. “It avoids lingo, over-abstraction, and obscure features. It does not mislead, that is, it expresses the meaning of a program clearly and without fault. All these properties are desirable for code just as they are desirable for technical prose.”
Odersky achieved that goal with this excellent, “lean” post.
Meanwhile, in other Scala-related news, JetBrains earlier this month introduced a new release of its IntelliJ Scala plugin.
The IntelliJ Scala Plugin 2024.1 release includes numerous improvements and fixes, such as enhanced Scala 3 support, including better handling of specific syntax cases, improved debugger support, and accurate autocompletion, wrote Maciej Gorywoda, Product Marketing Manager in the IntelliJ Scala team at JetBrains in a blog post.
“Sometimes, a lot of work results in only a small number of visible changes, while at the same time, it lays out the foundations for many more improvements in the next release,” Gorywoda said. “But even in light of this, the 2024.1 release of IntelliJ Scala Plugin seems bigger than usual. We worked on many fronts and came up with a long list of fixes and improvements.”
That list of fixes and improvements includes:
Other improvements include new icons, enhanced inlay hint presentation, and the addition of Scala documentation to the settings help page.