Proposal: Simplifying the Scala getting started experience

Except real people mostly don’t behave like this.

IMHO
May be you are right.

But for me a language is like a tool. if I have a task I will take appropriate tool whether it is pliers or a screwdriver it depends on a task.
I just have noticed that it may be impossible to make a good\simple hammer from pliers.

If you really enjoy such things ok, just do it.
But I think
if a pro does such things it can be very beautiful. But when you teach such things students it can be the way to really big dissapointments.
I have seen many such disappointments.
I do not think such simplicity is very good, but if somebody like it it is not my deal after all.

What I really dream about it is a mode which allow to write right scripts in scala.

  • When you just do not need a build system at all
  • where there are no binary incompatibility problem.
  • When a single error in some unimportant file do not stop compilation at all.
  • when you can simply call a method to usual scala code

It is a real key to simplicity :wink: (when all you need is vi editor and installed package)

it would be cool if there were a real simple scripts. There were a real big communities on such tasks and so on.

1 Like

A language is easy to learn if it is governed by simple rules.

For example, “All code resides in methods, and all methods are part of an object” is a simple rule.

If you enable one-line apps but complicate the rules, you are not helping beginners.

Have you asked casual beginners about that?

Turning Scala into a duck-typed language will obviously fail. It would be analogous to turning Python into strongly typed language that rejects programs with type errors. Scala compiler depends a lot on types, for example all implicits are type driven. Scala without types would be a very different language.

Scala scripting is not about fundamentally changing the language, but rather removing the need for structuring source code within a file, and files within a project. You can do scripting in strongly typed languages like Java (JShell), C# (PowerShell), Scala (non-standardized yet?) and so on.

Performance and memory usage have lower priority than developer friendliness and productivity when it comes to scripting. Python has low performance and high memory usage, but it’s (the most?) popular language for beginners simply because you can finish the task sooner.

In general Scala is a bad language for scripting because of high compilation overhead, so insisting on using Scala scripting in e.g. production wouldn’t be sensible. Instead Scala scripting should be oriented towards beginners (who only start to explore Scala), to make Scala more popular. Scala doesn’t need to be a language for everything.

It is just a dream . But there are nothing imposible. For example, scalajs is certainly dynamic typed.

It’s that it gives users an instant reward.

programming is not a drug :wink:

Actually compilation overhead is very important in dynamic evaluation. So, we cannot use groovy for that purpose either.
But groovy is very good in some web framework in the area where dynamic is more important than runtime speed.

We also have areas where I would prefer to use groovy if I had no scala controllers.

IMHO

Really I do not understand the desire to advertise scala in the area where scala is really weak. I think it is a bad publicity stunt

It is not.

@AMatveev I think you have sufficiently made your point. Yet apparently most other participants in this thread disagree with you. Please respect that take that into account.

To everyone: this discussion needs to be refocused on the initial topic of how to improve the getting started experience, instead of whether we should even care about the getting started experience.

1 Like

Ok, may be I have used bad terms, but it is over javascript so it should use “dynamic invocation”.

It seems you are right and I have made some off topic. I am sorry.

I’m not sure what is a casual beginner. I have had team mates over time with very little coding experience who often asked me for help. Does that count?

1 Like

So let’s define one low-experience, casual coding group as people who can write an excel formula. They can enter numbers into cells, and enter formulas in other cells to compute derived values. But perhaps haven’t yet done any excel macros.

Let’s define another group as undergraduate students with no prior coding experience on day 1 of their programming practical. This first prac will inform their view of if coding is for them or not, and if that language in the lab is difficult or not.

And lastly, lets’s think of somebody who once a month or so has to generate a report from some data, and for that day writes some throw-away python scripts small enough to fit on a screen without scrolling. They forget most of what they know between each scripting day, and have to in effect mostly relearn it each time.

Let’s see how a hello-world looks like in the most popular programming languages.

I’m not an expert in judging what are popular languages, but I’ve heard people referring to the TIOBE index in the past, which currently starts with (1) Java (2) C (3) Python (4) C++ (5) Visual Basic .NET (6) C# (7) JavaScript (8) PHP (9) SQL (10) Objective-C

It doesn’t exactly confirm the hypothesis that short hello world programs make a language popular.

= = = (1) Java = = =

public class HelloWorld {
public static void main(String[] args) {
System.out.println(“Hello, World”);
}
}

= = = (2) C = = =

#include <stdio.h>
int main()
{
printf(“Hello, World!”);
return 0;
}

= = = (3) Python = = =

print(“Hello, World!”)

= = = (4) C++ = = =

#include

using namespace std;
int main()

{

** cout << “Hello World!”;
return 0;**

}

= = = (5) Visual Basic .NET = = =

Imports System
Public Module Hello
Public Sub Main( )
Console.WriteLine(“hello, world”)
End Sub
End Module

= = = (6) C# = = =

using System;
namespace HelloWorld
{
class Hello
{
static void Main()
{
Console.WriteLine(“Hello World!”);
}
}
}

= = = (7) JavaScript = = =

alert( ‘Hello, world!’ );

= = = (8) PHP = = =

echo “Hello World!”;

= = = (9) SQL = = =

BEGIN
dbms_output.put_line (‘Hello World…’);
END:
/

= = = (10) Objective-C = = =

#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]) {
@autoreleasepool {
NSLog(@“Hello, World!”);
}
return 0;
}

Cool. And of those, people who code who aren’t coders write python, js and php.

Ok, I’m imagining an Excel user. Why would they even code anything, if not macros?

To the undergrad student on their first day of coding ever - does it really matter that much to them whether their first app is one line of six lines? Beginners rarely complain about boilerplate, it’s usually the advanced users after they had to write it a hundred times.

It is usually the experienced coder who writes code to process data. Others import their data into Excel.

This is going to be my last reply on this topic. I want as many people as possible to use scala, from people engineering critical business components through to people who write a bit of code half way through working through their end of year accounts, and I want as few people as possible to be put off from using scala when they first try it out. I’ve watched people walk away from coding before they even really start because their first experience involved barriers to entry. And I’ve seen people take to it right away because they could type a sum into the javascript console in their browser, and right away get the computer to do fun things. You get casual adoption by making the casual experience rewarding. That means getting rid of everything you can that delays gratification or gives an opportunity for mistyping boilerplate to make it fail.

4 Likes

PHP exists to put server-side logic into web pages, so whoever uses PHP definitely needs to know HTML first. The hello world program in PHP is in itself absolutely useless, because you could just put the string directly into the HTML.

JavaScript exists to put client-side logic into web pages. If you want to do in JavaScript anything other than filling the log or opening alert dialogues, that would be manipulating the DOM, which would be quite tricky for people without much coding experience.

The only language in the list that (a) is easy on beginners and (b) has a hello world app shorter than Scala is Python.

1 Like

Allowing users to type a sum? We can do that in Scala:
**Welcome to Scala 2.12.8 (OpenJDK 64-Bit Server VM, Java 1.8.0_191).
Type in expressions for evaluation. Or try :help.

3+4
res0: Int = 7**

if you have this main.scala

println("hello")

and you use:

scala main.scala

it works. why do we need more?

1 Like

The hypothesis is not that brevity of hello world is strongly correlated with language popularity, i.e., that it is the most important, or only important, variable that affects the popularity of the language.

The hypothesis is that for any given language, the ease of starting is an important variable that affects its popularity. That is, whatever its popularity is as influenced by other factors, having a better getting started experience will increase its popularity relative to itself, and having a worse getting started experience will decrease its popularity relative to itself.

That’s not something you can falsify with a popularity ranking of languages. (Without getting into the flaws that have been pointed out in the TIOBE method.)

1 Like

Great question. I think the answer is that there’s too big of a gap between that and a compiled program. You can’t use them together.

1 Like