Creating Applications with Scala Computer Programming

in #utopian-io7 years ago

Scala is a free, functional, object oriented programming language for the experienced Java programmer and it is even suitable for programming for beginners.

The great thing is that any programmer can start to understand why that was because this object oriented functional programming language is completely free to download and use.

Obtaining and Installing Scala

The Scala programming language can be obtained from http://www.scala-lang.org. It does not need installing, just unpacking into a suitable directory. However, it will need some system environment variables setting. These are:

  • SCALA_HOME - this must point towards the directory into which Scala has been unpacked
  • PATH - this must be updated to include the Scala bin directory

It will also require the Java runtime to be installed, although it is worth noting that some IDE's (Integrated Design Environments) already support Scala development, and there are Scala plugins for:

  • Eclipse
  • IntelliJIDEA
  • Netbeans

However, all that's actually needed is a console (such as a Linux shell or the Windows command prompt) and a simple text editor.

Starting Scala in Interactive Mode

Once the system environment variables have been set up correctly then Scala can be started in interactive mode by going to the command line and typing:

scala

This will start an interactive session and the programmer can start programming in Scala, in this case to create a simple "Hello World" object:

object Hello {
def main (args: Array[String]) {
println ("Hello World")
}
}

In this example Scala will respond that it's "defined module Hello", and then the programmer can run the code:

Hello.main (null)

And the text "Hello World" will be displayed on the screen. It's worth noting at this point that Scala is case sensitive, and so the following will result in an error message being displayed:

hello.main (null)

Of course, regardless of the case of the letters, this is an impractical way of developing a full Scala application. It is only really suitable for testing and training purposes. In programming Scala, therefore, the programmer must look at other ways of running the code.

Compiling and Running Scala Code

If the code for the "Hello" Scala object is saved to a file named "Hello.scala" then the programmer can use the scalac program to compile it:

scalac Hello.scala

And then it can be run:

scala Hello

It will display the same text as before, but now the programmer can carry on programming in Scala and then passing their applications on to all of their users to enjoy.



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Your contribution cannot be approved yet because it is not as informative as other contributions.

Explanation:

  • you really want to write tutorials for the Scala programming language? Well, please do so: cool!,
  • however, this is not how to do it,
  • you even wrote "sca;e" in stead of scala when referring to the repository onGitHub (which makes me doubt you understand it at all),
  • then you have copied some "Hello World" example, which could be fine as a beginning of a tutorial, but now the title "Creating Scala Applications" is misleading,
  • did you even install Scala yourself and actually try to build something? Your text-content currently seems copy-pasted from elsewhere which is plagiarism.

So please, improve a lot, please do so within 48 hours, and if you think you are ready for me reviewing this again, then and only then respond to this comment (you have 1 chance for re-evaluation by me).

Good luck!

You can contact us on Discord.
[utopian-moderator]

Your contribution cannot be approved because it does not follow the Utopian Rules.

You can contact us on Discord.
[utopian-moderator]

Coin Marketplace

STEEM 0.18
TRX 0.15
JST 0.029
BTC 63057.34
ETH 2546.78
USDT 1.00
SBD 2.64