What can make scala more popular?

Show me code with lots of receiver functions. Will it be only about mutable DSLs?

I have discussed a lot that question in other topics, so I would prefer not to repeat it here.

I have not thought much about it. We need better

  • scope managment
  • builder pattern

So no publicly available code to discuss? Then it doesn’t seem receiver functions are popular.

There are a lot of examples in other topics.

It seems so for scala users :frowning:

But kotlink users sometimes troll me :))

1 Like

All I see is mutable HTML DSLs harassed over and over. HTML is easy. Show me how do you deal with CSS with receiver functions :slight_smile:

Immutable type-safe HTML DSLs should be doable using type unions (available in Dotty), e.g.:

object HtmlDsl {
  type HtmlChild = ElemHead | ElemBody

  type HeadChild = ElemMeta | ElemTitle

  type BodyChild = ElemTable | ElemP

  def html(items: HtmlChild*): ElemHtml = ???

  def head(items: HeadChild*): ElemHead = ???

  def body(items: BodyChild*): ElemBody = ???
}

IDE should be able to suggest matching methods in auto-complete, i.e. IntelliJ already sorts method in auto-complete putting methods with correct result type first.

Here you have your killer feature :slight_smile: In FP form (immutability oriented) instead of typical OOP form (mutability oriented).

I have never said that it is killer feature for FP. I have thought it is obvious.

I have not seen simple scope management here.

Show me an example where it is not sufficient.

http://www.scalafx.org/

Yes you can make it somehow without delayedinit.
Just show me the way you can do it such way which can fit our company standards of simplicity…

Which classes in ScalaFX use DelayedInit?

Let’s not repeat half year of discussions on loop.

I completely agree with it.

So it’s just one class inside ScalaFX that inherits from DelayedInit. Without DelayedInit we need to change:

object ScalaFxApp extends JFXApp {
  // some lines of initialization code
}

to

object ScalaFxApp extends JFXApp {
  def delayedInit(): Unit = {
    // some lines of initialization code
  }
}

Not a very big deal. At least not big enough to be convinced by it that DelayedInit makes Scala noticeably superior. I wouldn’t expect dozens of JFXApps in a single project. With few ones the saving are also small.

No, it does not.
But take into account:

  • DelayedInit is a bad alternative of kotlin reciever function and Scope Functions
  • if main task is view and the view code may contain 70% of markup code then kotlin will be just better.

So we have two camps in our company. Ones write controllers in the first camp, and others write views in the second camp. The second camp people just dream about kotlin sometimes. It is very good kotlin advertising ;).

There are many good illustration in history that something can be very, very good,but being a little bit worse is absolutely enough to remain in history.

But absence of more better dsl for view’s markup just do kotlin more desirable…

I think that supporting Scala on Android would do a lot to make Scala more popular. Right now, Scala-on-android is stuck at version 2.11, but I was recently looking at the d8 project which allows people to use java 8 features and then compile their Java 8 bytecode to dex bytecode. I don’t see why this can’t work for Scala. In fact, it looks this person with tag @LolHens has already started working on a prototype sbt plugin to support d8 https://github.com/LolHens/sbt-android-d8, and also talks a little bit about it here.

That could be a pretty low hanging fruit, and allow Scala to compete better with Kotlin, but I have never developed for Android and so don’t know much about it.

1 Like

Agreed. However it’s been pointed out that it also needs to be made official. Unless Scala is officially supported and marketed for JVM, Android, JS, and Native, Kotlin has a big advantage over us.

I’m all for getting official support for Android and Native (assuming JS is already “official” isn’t it)! How it would be funded on the other hand I don’t know…

1 Like

I would prefer to complain about kotlin. Why they have made more better language for dsl. My life would be more pleasure if they had not made scope and reciever functions.

:))

Before I write this story, let me say I am willing to help with the documentation and will try to contribute soon. Please listen and take this with a grain of salt as constructive criticism coming from a person new to Scala who has learned ~ 7+ programming languages over the last 10+ years, Java 1.4 being the first which I taught myself.

This is my perspective as a new user to Scala.

I chose Scala not because I thought it would be fun or cool to learn, but because of AKKA, KAFKA, SPARK etc. and the fact that I spent over a year researching and designing a new app that is very complex and needs these tools. I had not really even looked into Scala until reading Designing Data-intensive Applications by Kleppmann while doing research on how to architect the app. I could have used Java (it’s ironic I am verbose but hate java), but it is so verbose I could write 3 books before finishing the app. I looked at RUST, GO, KOTLIN and more before choosing Scala for this project. So it is purely out of necessity that I am learning Scala.

I know a lot of people complain about the documentation, for many reasons. I really feel that improving the documentation in the following ways would help in getting more people using Scala.

Label the Documentation

When I type PHP Documentation into google the top link is directly to the documentation. When I type Scala Documentation into google the top link is to a page on docs.scala-lang.org which has links to this, that and the other, which one does a new user choose since none say Documentation? Tour of Scala is the closest I have found to documentation. The tour of Scala needs to be renamed “Documentation” to make it clear that is the documentation. This frustrated me beyond belief when first trying to learn Scala. I kept searching google for Actual documentation, I kept saying this can’t be the documentation it is too light, where are the facts.

Allow Comments

One of the best things about the PHP documentation is it lets users comment directly in the documentation. Allowing users to communicate directly in the documentation allows them to share their findings with other users, thereby saving other users COUNTLESS HOURS OF SEARCHING. Many pages of the PHP documentation have tons of relevant, helpful comments. Check this out PHP documentation Look at all of the user contributed examples in the comments. Notice how users inform other users of things like changes between PHP versions etc. This style of documentation saved me countless hours while learning and working with PHP.

Sure comments would need to be monitored, but is that anymore work than viewing a pull request? Also people use links to these in there resume, like they do for stackoverflow questions.The best thing about allowing comments in the documentation, is it allows me to go to a part of the documentation when I am having an issue or want to use something new, and I can quickly see others have had the same issue and find an answer more quickly than having to google and dig. Maybe allow users to login via Stackoverflow in order to comment, this would tie into their real world reputation and help prevent many garbage comments.

Give us the Facts

With Scala it is not just the fact that the syntax is complicated and you have to learn many new concepts, it is that the beginner is left searching and googling and digging for answers to the point you keep asking yourself WTF am I even doing this for??? When you are not given the facts about the structures of a language upfront it makes it way more confusing when you see people using them in code and examples you see later. Hence people complain about the complexity of Scala syntax. It’s kind of like teaching kids words, but not teaching them how to structure a sentence. Then throwing them a book and saying “here you know words now read this book and write a report”.

What are the facts about Traits, where are the facts listed. I don’t want to waste more time digging while learning! The Scala tour only gives a brief overview. For example I think much of what is Alvin Alexanders post should be in the Scala documentation itself Traits simple information like this " In a trait, define a field with an initial value to make it concrete, otherwise give it no initial value to make it abstract:" Basic facts about the language like that should absolutely be included in the documentation. I am willing to help add this information as I get time.

Broken information

The getting started with Scala and Intellij guide didn’t work for me, there are missing steps. If you miss a step then there is no option to create a Scala Class listed in the IDE drop down, which requires more googling to figure out why? You have to add Framework support and something else I’ll have to dig back into it, I’ll figure it out and do a pull request for the documentation.

I remember reading the Odersky Programming in Scala book using vim and the command line, that worked pretty good. Then I got a big surprise when trying to do the Getting Started with Scala IDEA and had to spend a good bit of time figuring out what the problem was, why no option for Scala class or package. It is a small thing, but in the end it is the small things that give new comers their first impression.

I know this probably sounds negative and critical, but I really feel this is why Scala is not more popular. It’s not the syntax as much as it is the lack of Information that is so frustrating to me and I can’t be the only one. I know from reading online that many people complain about the documentation. I have a feeling the docs are light because adding to them takes time and most people who are donating their time to the docs are busy with a life and work. Also documenting something can be harder if you already know it than if you don’t, because it is easier to leave out steps and pertinent information.

I’ll do a pull request soon with changes to the Getting Started with Scala in Intellij first. To a new user it’s discouraging when you can’t even follow a Hello World example and see something work. If trying Scala in Intellij from that link is the first thing a user tries after learning Scala from the command line or it is their first time experimenting with Scala then they get discouraged.

I like Scala. I love it’s capabilities, it’s power and even it’s quirky complexities. I like that it allows OOP and Functional programming to coexist. I’ve actually been printing the current doc pages and making notes on them in binders. I’ll try to start contributing to the documentation where I can as soon as I can.

Open Source Projects

Another thing I think that helped make programming languages like PHP so popular was all of the small open source projects people created such as Wordpress and the many open source social networking apps like elgg etc. I have not googled and have only been learning Scala a few months, so I have no idea if there are any such current Scala projects around. What happens is small time developers see an opportunity to make plugins for these apps and sell them on websites like HotScripts or Envato. So putting out something such as a simple open source Social Network written in Scala would bring much interest.

As a web developer I was surprised how easy the Scala Play Framework makes creating an app. I’ve been amazed at how much I can accomplish with so little Scala. In ways it is easier to create a Web App with Scala/Play than with PHP/OtherFramework. Not having to install and configure a separate web server with Play Framework is a huge BONUS.

The base of my app is a social network. I am considering releasing that base as an Open Source project to the Scala community. I think having a large example of a working app that people can inspect will help them learn Scala much more quickly. The reason I chose Scala for this app is because the tools like AKKA, KAFKA will allow me to code the app in a nearly 100% modular fashion much more easily than other languages and even add capabilities not imagined. I like the DSL abilities too.

I’ll start trying to contribute to the docs soon. It will probably take a few months, but I am determined to release an open source social network. Something super basic other people can add to and improve etc. Something that gets a community of new people involved and generates interest.

If you read all of that God bless your heart, I am sorry. Remember Java is too Verbose for me. LOL
Thanks.

3 Likes

Actually, while I think you’ve identified a problem, this is exactly not the solution. The Tour of Scala probably ought to be labeled something that makes it sound less like “documentation”, because it isn’t – it’s a fine high-level overview, but is quite incomplete, and isn’t trying to be otherwise. It’s intended to be digestible, not comprehensive. My experience from helping folks on the Users Forum is that people tend to think the Tour is the documentation (and is therefore reasonably complete), and wind up pretty confused as a result. Putting the label of Documentation on it would, I think, make this far worse.

The thing is, there isn’t official public documentation for Scala in the sense that you are looking for – as far as I know, it doesn’t exist. There is the spec, but that’s basically unusable for most people. And there is the book Programming in Scala – which is in many ways the actual documentation (reasonably clear and complete, and written by the right people), but it’s not a free website.

That’s not an unreasonable state of affairs, nor an unprecedented one (for instance, the documentation for the C language was, for all intents and purposes, Kernigan and Ritchie’s book), but I think it may be contrary to current expectations. I’d say it’s worthwhile for the community to think about this point…

4 Likes

Bajillions of them, actually, but you may well be right that they’re too hard to find.

If you haven’t come across it already, I commend Scaladex to you – that’s the fairly-complete index of open-source libraries in the Scala ecosystem. That’s a step in the right direction, but AFAIK it doesn’t cover the open-source applications written in Scala, of which there are probably far more. I’m not sure the community has ever considered a similar index of applications, but it’s an interesting idea…

On difference being that “Programming in Scala” is about three times as long as “The C Programming Language”.