Scala Programming – Hello World

This is a continuation from the previous entry which I wrote about the Scala Programming’s setup and IDE installation. In the previous entry, we were successfully setup the JDK, sbt, Scala and installed the IntelliJ. The last step is start coding.

Besides using the IntelliJ, you can install and use other IDEs to write codes, for example, Eclipse. It is just a personal preferences. I asked my friends which tools that they are using for Scala programming and I received a standard reply from them, Eclipse.

As for my Coursera’s course, the instructor is using IntelliJ and I am going to use it in my virtual machine. I will try to use Eclipse as well on my Windows environment. Come, let try to write a Hello World program using the IntelliJ.

When the new project loads, the Project explorer on the left side shows the structure of the Scala project. Go to the src folder and expand it. Under the main folder > New Scala Worksheet > Enter file name. The text editor at the center of the application loads the new file. Type as below,

"Hello World"

And, press the ‘Run’ button on the top. It renders the result on the right side of the application. We need to include the double quotation in our codes.

This is our first helloworld. Different IDEs will show the result in different mode or presentation but the end result is the same. You can try to use the command line to run and print helloworld too. When I tried it using my virtual machine’s command line by typing scala, it prompted me an error. It is my very first time using command line in Ubuntu to run a scala program.

scala

It advised me to install the Scala using the command below. I just did as per advised.

sudo apt install scala

It took a while to install when I run it in my Terminal. Can someone highlight to me what causes the error? Does it mean that Scala installation on the IDEs is not the same as the Terminal?

When the installation is completed in the Terminal, I try again as below and it is correctly displaying the string input I entered.

This is Scala Programming! I am going to stop writing for a while and concentrating on learning this programming language. See ya 🙂

So You Want To Be A Developer? [Part 3]

I am sorry I took a short break from writing blogs in order to concentrate and complete my final project for the Data Science Course that I am taking. It has been a long journey of 1 year to complete this course. Of course, I did take a month break from it before I finished my final project. It is really not a good idea to take a break from study.

In the part 3 of the “So You Want To Be A Developer?”, the third question the host asked the speaker was how do they learn the programming language and which language that they would suggest for beginner.

Most of them did not really specific which language to pick but did suggest if you do not have programming background, learn Javascript is the best to kick start. What do you think?

Personally, I agreed we can learn any languages that we like. It depends on individual and some may find it easy while some have to struggle in the beginning. Once you are getting familiar, you will be okay and when you keep doing, you will find yourself creating magic tools. Everything is just a click away.

I started with Visual Basic 6.0 and I jumped into .net immediately after learning Java. Do not ask me why. I did well for Java and badly for Visual Basic. Do you believe it? In the end, I decided to choose .net C# as my main language until now. I learned all by examples from the Internet, forums and books that I borrowed from the library during my college time. When I started to work, colleagues and Google have become my best pals to learn the language. Due to work nature, I stick with C# for the past 6 years and now I feel it is time to move on to learn others.

Recently, Python and Ruby on Rails are getting popular but young developers. Maybe, we should try it out. How about you, have you thought of which language you want to try?