Hello, coding enthusiasts!

We will journey through the landscapes of two of the most famous programming languages in the software development world: Java and Scala. These languages are like two sides of the same coin in the JVM (Java Virtual Machine) world.

Let's dive in and explore these two captivating languages together!

Java: The Time-Tested Titan

Java, the brainchild of Sun Microsystems (now owned by Oracle), has been a pillar in the programming world for over two decades. Known for its "write once, run anywhere" philosophy , Java is everywhere – from enterprise servers to Android apps. Java's robustness, simplicity, and cross-platform capabilities have cemented its place as a reliable choice for developers.

Java is an object-oriented programming language that leans heavily on explicitness and clarity. It's like your reliable old friend – always there when you need it, and you know exactly what to expect. Developers who like control and predictability might find Java a soothing balm for their programming souls.

The extensive libraries and frameworks available for Java are one of its biggest strengths. Spring, Hibernate, Maven, and many more make Java development a breeze. Moreover, its fantastic community support and extensive documentation make troubleshooting Java relatively straightforward – there's always a fellow developer ready to lend a hand!

Scala: The Functional-Object Fusion

Scala, which stands for "Scalable Language" was introduced by Martin Odersky in 2004. It blends the best of both worlds: object-oriented and functional programming. Scala, the modern artist of the programming world, is designed to express common programming patterns in a concise, elegant, and type-safe way.

With Scala, you can write less code and accomplish more, thanks to its high-level abstractions. It's like a sleek, modern sports car – compact, efficient, and oh-so-stylish.

The Comparison: Why it's a Win-Win

Now, let's pit these two languages against each other. But remember, it's not about declaring a winner but understanding how each language can be the right tool for the right job.

Performance

Java and Scala run on the JVM, so their performance is quite similar. However, Scala's advanced features, like immutability and concurrency, might offer an edge in developing high-performance systems. But remember, performance depends more on the coder's skill than the language itself!

Syntax

Java's syntax is explicit and lengthy, and it values clarity over brevity, which makes Java code easy to read and understand. On the other hand, Scala's syntax is concise and expressive. It may take a little time to get used to, but once you do, you might fall in love with its elegance!

Paradigm

Java is a stalwart of object-oriented programming, but with the introduction of lambdas and streams in Java 8, it has embraced functional programming concepts. Scala, conversely, beautifully merges object-oriented and functional programming paradigms. So if you're looking to explore available programming without letting go of the familiar object-oriented structure, Scala could be your ideal companion.

Too long; didn't read

In a nutshell, let's break down the comparison of Java and Scala into 20 bullet points highlighting their pros and cons:

Java

Pros

  • Proven Stability: Java has been around for over two decades, and its stability is time-tested.
  • Wide Adoption: Used by millions of developers worldwide, resulting in a vast community and extensive resources.
  • Clear and Explicit Syntax: The protracted nature of Java makes it easy to understand, reducing ambiguity.
  • Robust Libraries and Frameworks: Spring, Hibernate, and Maven make development easier.
  • Platform Independence: The "write once, run anywhere" philosophy ensures cross-platform compatibility.
  • Excellent Documentation: Comprehensive and extensive documentation is available.
  • Job Market: Due to its wide adoption, there are many job opportunities for Java developers.
  • Gradual Introduction to Functional Programming: With Java 8 and beyond, developers can explore functional programming concepts.

Cons

  • Verbose Syntax: Java requires more lines of code to accomplish tasks, which can lead to boilerplate code.
  • Slower to Adapt Modern Features: Java tends to be slower in adopting new programming concepts.

Scala

Pros

  • Functional and Object-Oriented: Scala beautifully merges object-oriented and functional programming paradigms.
  • Concise Syntax: Scala code is typically shorter than equivalent Java code, leading to increased productivity.
  • Advanced Features: Scala has modern features like traits, case classes, and implicit.
  • Great for Concurrency: Immutable data and first-class functions make Scala an excellent choice for concurrent and reactive applications.
  • Java Interoperability: Scala can seamlessly interoperate with Java code and libraries.
  • Powerful Tools: Scala has powerful tools like SBT and frameworks like Akka.

Cons

  • Steep Learning Curve: Scala's advanced features and concise syntax might be hard to grasp for beginners.
  • Smaller Community: Compared to Java, Scala's community is smaller, meaning less support and resources.
  • Less Job Market: There are fewer job opportunities for Scala developers compared to Java.
  • Complexity: The flexibility and power of Scala can lead to overly complex code if not used judiciously.

Conclusions

The choice between Java and Scala should be based on your project requirements, your team's skill set, and your personal preference. They are both powerful tools in their own right and understanding their strengths and weaknesses will help you make an informed decision.

Happy coding!

Author: Franco Geraci, Head Of Engineering at Bitrock

Read More

A few months ago, we began an incredible journey into the world of Java through a compelling retrospective written in collaboration with Danilo Ventura, Senior Software Engineer at Bitrock.

Enjoy the fourth and last episode following below!


In 2014 a revolutionary new version of Java arrived. All versions of Java are backward compatible, meaning that sources generated with a new version of Java are executable on older Java VMs. This revolutionary version of Java 8 allows for a leap in functional languages. So come many new tools such as streams, lambda expressions, optionals to write more functional code using both the object-oriented paradigm and the functional paradigm. Java 8 was really a milestone because it gave birth to new constructs and many Java developers took years to get used to it.

The first Java application framework like Spring Boot

From now on, Java is used to create services and for web applications. The first Java frameworks begin to emerge to quickly create applications that provide Rest Json services. For convenience, we will mention only the most important one: Spring Boot. The latter is based on a leaner library that was precisely Spring (launched in 2016) and made developers’s life easier allowing not to use the complex EJBs but to create JARs able to self-execute, without installing a server and running it.

Spring

Cloud, Container and Docker

It is precisely with this in mind that a new revolution takes place, that of the cloud and containers. Before, servers and their maintenance were 'in house' - just think of banks and insurance companies; right around this time, the concept of Cloud was born mainly with giants such as Amazon, Google, and Microsoft providing the necessary tools to create 'machines' on the web where you can install everything you need to run your website or web application. In this way, all the maintenance of the '(virtual) machine' is entrusted to the Cloud Manager.

The other major aspect is the container, since it changes the way applications are distributed. The distribution, indeed, is now published through a container that can be basically seen as a 'machine' with an operating system inside and a container executor called Docker that guarantees the security and functionality of the application.

Cloud

“Write once, run anywhere (WORA)” or not?

All of this shakes the concept and motto of Java: "Write once, run anywhere". If the application can be distributed in a container with the preferred operating system, what are the advantages of still using Java? Indeed, there are none and this is precisely the reason why new and alternative languages emerged such as Rust and Google's GO whose container takes 5 milliseconds to start - instead of Java, which needs 30 seconds.

It seems like Java in this Cloud Native world would have no future. Actually, it was not true. Along comes a super revolutionary technology in Java: the GraalVM, which allows native code to be generated from bytecode of any type. So a bytecode starting from a source of any type - Java, C - is created for a special virtual machine which is precisely the GraalVM capable of generating an executable file for a given operating system. Why is it revolutionary? Java can be used to create a container with an executable in it that can start in times comparable to services written in GO.

Java continues to move forward by adapting to new frameworks that allow services to be written directly cloud-native. For instance, one noteworthy framework is Quarkus, which allows the generation of cloud-native containers that can run on Docker or any container orchestrator.

The new frontier of Web 3.0

We are on the threshold of Web 3.0, and the new frontier is the blockchain-based web. Perspectives are starting to change and new architectures are being released: server-side, there will no longer be a single server managed by a platform. Just to give you an example: YouTube is run by Google, owned by Google, and the videos that are uploaded are on Google's servers as well as owned by Google.

With Web 3.0, the perspective changes, since the platform is not owned by a single owner anymore, but distributed on the blockchain.

In line with the times and needs, the Web continues to evolve while facing many difficulties and uncertainties. How will Java adapt to this new type of architecture? We will see! In the meantime, we can say that we are not standing still but moving with this evolution; there are already several pieces of evidence, such as new framework libraries (e.g. Spring) that allow interaction with popular blockchains.

We have come to the end of this fourth and final episode of the retrospective dedicated to Java. We thank Danilo Ventura for sharing his valuable insights on Java technologies and wrapping up 20 years of web history.

You can also read the firstsecond and third parts. Follow us on LinkedIn and stay tuned for upcoming interesting technology articles on our blog!

Read More
Java 3

A few months ago, we began an incredible journey into the world of Java through a compelling retrospective written in collaboration with Danilo Ventura, Senior Software Engineer at Bitrock. We can move on with our narrative by depicting what happened in the mid- and late-2000s as well as highlighting the developments of Java with the advent of Web 2.0 .


Back in early 2005 there was a major revolution that kicked off what has been called Web 2.0. What is it? Web 2.0 is the revolution in the computer industry caused by the move to the internet as a platform. It’s an improved version of the first world wide web, characterized specifically by the change from static to dynamic or user-generated content and also the growth of social media like, for instance, the first one that was YouTube to publish video. Starting from these years, the web begins to transform itself into a container of platforms.

Ajax and JSON

What was the technical evolution that allowed this to happen? New browsers like Firefox and Chrome took advantage of a new technology called Ajax (Asynchronous JavaScript and XML) which allowed for asynchronous calls. What does it mean? Browsers launch a request and while the response arrives another request can be launched.  All this makes web pages more interactive and faster. Pages populate as long as requests are completed. It also changes the very structure of web applications because you no longer have to provide the entire page but only the data.
The web application development changed and new frameworks were based on Javascript. Between 2005 and 2010 came the first JavaScript library for web applications distributed as a free software: jQuery. Later came more powerful frameworks for open source web applications such as AngularJs up to Angular 2 and React JS.

Hence, server-side applications become just data providers. The new interchange of data between client/server applications was based on JSON, which stands for JavaScript Object Notation. This was an open standard file format and data interchange format that used human-readable text to store and transmit data objects consisting of attribute-value pairs and arrays (or other serialisable values).

Java and the Mobile Operating Systems

In 2008, the first commercial Android device was unveiled: this was another important moment for Java. Android is an operating system that basically runs programs that are written in Java and compiled by a Dalvik virtual machine that is able to take this Java code and turn it into the bytecode that is then executed by the Android operating systems. The competitor Apple developed iOS, a parallel proprietary operating system, while Google based everything on Android and the open source language of Java. One more time, Java played a major role as a programming language to write mobile applications.

Criticism of Java

In 2010, the largest database software and technology company Oracle acquired Sun Microsystem, consequently Java became property of Oracle. What changed? Java became a proprietary language and only the latest version remained free. For older versions you still have to go through Java distributors. 

Later the Java programming language and Java software platform were criticized by the developer communities for design choices, including the implementation of generics, forced object-oriented programming. New high-level programming languages have been designed to fully interoperate with the Java Virtual Machine version. We can mention Scala released in 2004 as well as Kotlin in 2011.

We have to wait until 2014 for another revolutionary version of Java.

You can also read the first, second and forth parts. Follow us on LinkedIn and stay tuned for upcoming interesting technology articles on our blog!

Thanks to Danilo Ventura for the valuable contribution to this article series.

Read More
Java | Part 2 | 2000s

A few months ago, we began an incredible journey into the world of Java through a compelling retrospective written in collaboration with Danilo Ventura, Senior Software Engineer at Bitrock. We can move on in our narrative by depicting what happened in the early 2000s.


From Java Server Pages to eXtensible markup language

We saw that Java servlets allowed higher degrees of interactivity and dynamicity in web design. Yet, a significant limitation still existed. Servers could only produce static HTML pages, with no variable elements. Inside a Servlet you had to write all the code of each html page putting together variable data (for example coming from a DB) and static data. 

To simplify the process, in 1999 Sun Microsystems released the first version of a new revolutionary technology: Java Server Pages (JSP).  With JSP  pages it was possible to insert in a HTML page, scripting section parts in java language, creating a “JSP page”. JSP was translated into Servlet and then compiled. With Java Server Pages and servlets led to the birth of server-side pages. This means that pages were no longer static (steady and immutable as website creators thought them): on the contrary, they were dynamically generated on the server side, using the JSP as a template with dynamic contents inside. 

We’ve come to the early 2000s: during these years, the first Java frameworks to write web applications emerge. The most relevant ones we must mention are Velocity (a template engine, rather than a framework), Struts and then Struts2. Tools like these were the first attempts to apply the M.V.C. pattern in web application development. Struts and Struts2 were based on XML (“eXtensible markup language”), which was designed to be a human and machine-readable markup language for handling data transport. XML was born as an exchange format for data but it was also (ab)used as a configuration language.

The Enterprise Java Beans and the Web 1.0 age

The evolution of distributed applications still lacked and it could be achieved only thanks to another Java technology: Enterprise Java Beans (EJB). We can now describe EJB as an architecture for setting up program components, written in the Java programming language, that run in the server parts of a computer network that uses the client/server model.

EJB was a very powerful, complex and also widely used technology. Enterprise Java Beans were based on application servers: we are no longer talking about simple servers or servlet engines. In order to execute EJB, developers required application servers that had an entire substrate (called EJB Container) thanks to which, whenever the application was deployed, a wide array of runtime components was generated, creating an actual ecosystem that allows the application to interact with server resources. Many Software houses, at that time, had its own product of EJB Application Server: WebSphere from IBM, Weblogic from BEA Systems (later acquired by Oracle), and, of course, were present open source products too such as JBoss, Apache TomEE and GlassFish.

Developing applications for this technology was rather complicated, IT since professionals had to deal not only with code writing operations, but also with repetitive actions: launching programs, packaging the application in a certain way, having the correct library dependencies for the projects and so on. All these tasks were done manually: as you can imagine, the chance of error was particularly high. Moreover, it was a huge waste of time (that could be dedicated to development) for developers to generate all these packages that would be deployed on application servers.

This led to the creation of new tools able to solve these needs, starting from Ant. Ant was a very innovative tool since, always through XML, it was possible to write procedures to be executed inside the Java world. Through an Ant script in XML, you could run a sequence of operations, such as copying and filing out files, moving some parts to a specific folder, creating a Java archive from that folder and moving it elsewhere. It was thus possible to automate a number of tasks.

XML

Ant arrived in 2002, followed by Maven in 2004 (which is still used nowadays). Last but not least, Gradle appeared around 2012. Maven, now, allows a java developer to manage all dependencies and the lifecycle of its application in a standard way. All these tools, by solving a series of issues, have been essential to guarantee Java survival, otherwise it would have gone extinct.

In the early 2000s - the Web 1.0 age - there were some alternatives to Java. Some examples? PHP, C#, and Microsoft .NET (the Microsoft technology for building Web Applications in Windows environments).

This was also the glorious time of other technologies that were presumed to have an explosive success. Starting from Adobe Flash. At the time, if you didn’t have a Flash animation on your website, you were basically considered a loser! For this reason, Adobe launched this technology that allowed programmers to create, thanks to a language mainly based on Javascript and XML, a code that was executed from the browsers through a proper HTML tag that was generated.

Java 5

2004 was a breakthrough year, marked by the arrival of a version of Java that is still considered game-changing for many aspects: Java 5. Java 5 showed some new features, i.e. generics (taken from C language), annotations, enumerations, varargs, static imports. Sun Microsystem’s programmers and the Java communities, indeed, realized that in those years evolutions were fast-paced and, if they wanted to remain competitive and make Java a modern language, they would have to introduce additional features.

Not being a static language and continuously evolving through time, was the trump card that made Java survive in the long run. Through the implementation of new features, developers' needs have always been responded to. Java, as a matter of fact, is open-source: all Java developers can download the sources and can manifest within the community which features they would like to be implemented. Even then, the developer community, when talking about the implementation of new features, put it up to the vote.

In those years service-based architectures also began to evolve and companies started realizing that the mainframe was likely to fade away soon. However, there was the need within companies to maintain data sharing available through services.

At this stage, we begin to have problems and questions, like for instance, how do we exchange data? Which language do we use to make different technologies interact with each other? How do we restructure data? Then XML becomes established as an exchange language allowing to structure and to control data.

The first service-oriented architecture (SOA) arose based on a SOAP protocol able to exchange data among multiple technologies and in different formats. Between 2006 - 2009, new solutions, for more complex situations, were implemented, such as, for instance,  enterprise service bus (ESB), that resolves in a brilliant way the point to point communication problem for different software technologies.

SOA
Elements of SOA, by Dirk Krafzig, Karl Banke, and Dirk Slama (Source:Wikipedia)

Java is part of this revolution and is no longer just a language for web application, but is evolving to follow the new requirements of the server world.

You can also read the first, third and forth parts. Follow us on LinkedIn and stay tuned for upcoming interesting technology articles on our blog!

Thanks to Danilo Ventura for the valuable contribution to this article series.

Read More

It has been around for almost 30 years, and still shows no signs of retiring. Java was there when the web was taking its first steps, and has accompanied it throughout the decades. It has steadily changed, evolving based on the protean needs of internet users and developers, from the early applets to today’s blockchain and Web3. We can only imagine where it will be 30 years from now. 

In this four-part retrospective, written in collaboration with Danilo Ventura, Senior Software Engineer at ProActivity (our sister company part of Fortitude Group), we attempt at tracing the history of Java and the role it has played in the development of the web as we know it. The aim is to identify the reason why Java succeeded in lieu of other languages and technologies, especially in the early hectic, experimental days of the internet. That was when the programming language and the web were influencing each other, to fully unlock the potential of the technology that has changed the world forever. 


It all started in the mid 1990s. It was the best of times, it was the worst of times. The World Wide Web was still in its infancy and was not readily accessible by the general public. Only tech-savvy enthusiasts connected their computers to the internet to share content and talk with strangers on the message boards. 

The birth and development of the web had been made possible by the creation and development of a simple protocol called HTTP (Hypertext Transfer Protocol), first introduced by Tim Berners-Lee and his team in 1991 and revised as 1.0 HTTP five years later. Since then the protocol has continuously evolved to become more efficient and secure - 2022 saw the launch of HTTP 3.0 - but the underlying principles are still valid and constitute the foundation for today’s web applications. 

HTTP works as a straightforward request–response protocol: the client submits a request to the server on the internet, which in turn provides a resource such as a document, content or a piece of information. This conceptual simplicity of HTTP has ensured its resilience throughout the years. We can see a sort of Darwinian principle at play, by which only the simple, useful and evolvable technologies pass the test of time.

The documents exchanged between computers via the HTTP protocol are written in HTML, i.e. HyperText Markup Language. Since its introduction in 1991, HTML has been used to describe the structure and content of web pages. At first, these were crude text documents with some basic formatting, such as bold and italic. Later on, the evolution of HTML and the addition of accompanying technologies such as CSS enabled more formatting and content options, such as images, tables, animations, etc.. 

In order to be accessed by human readers, HTML web pages need to be decoded by a web browser, namely the other great technology that enabled the birth and development of the internet. Browsers were created as simple programs capable of requesting resources via the HTTP protocol, receiving HTML documents and rendering them as a readable web page.

At the time the Web was primitive, with very few people accessing it for leisure or work. It is reported that in 1995 only 44M people had access to the internet globally, with half of them being located in the United States (source: Our World in Data). Business applications were scarce, but some pioneers were experimenting with home banking and electronic commerce services. In 1995, Wells Fargo allowed customers to access their bank account from a computer, while Amazon and AuctionWeb - later known as eBay - took their first steps in the world of online shopping. 

The main limiting factors to the web’s democratization as a business tool were technological. Needs were changing, with users reclaiming an active role in their online presence. At the same time, website creators wanted easier ways to offer more speed, more flexibility, and the possibility to interact with an online document or web page. In this regard, the introduction of Java was about to give a big boost to the evolution of the online landscape.

The first public implementation of Java was released by Sun Microsystems in January 1996. It was designed by frustrated programmers who were tired of fighting with the complexity of the solutions available at the time. The aim was to create a simple, robust, object-oriented language that would not generate operating system-specific code

That was arguably the most revolutionary feature. Before Java, programmers wrote code in the preferred language and then used an OS-specific compiler to translate the source code into object code, thus creating an OS-specific program. In order to make the same program compatible with other systems, the code had to be rewritten and retranslated with the appropriate compiler. 

Java instead allowed programmers to “write once, run everywhere” - that was its motto. Developers could write code on any device and generate a metalanguage, called bytecode, that could be run on all operating systems and platforms equipped with a Java Virtual Machine. It was a game changer for web developers, for they did not have to worry anymore about the machine and OS running the program.

This flexibility guaranteed Java’s success as a tool to create multi-OS desktop applications with user-friendly interfaces. Supported by the coeval spread of the first mass OS for lay people (Windows 95), it helped the codification of the classic computer program visual grammar, still relevant today. Java also became one of the preferred standards for programs running on household appliances, such as washing machines or TV sets.  

The birth of applets can be seen as a milestone in the development and popularization of Java. These were small Java applications that could be launched directly from a webpage. A specific HTML tag indicated the server location of the bytecode, which was downloaded and executed on the fly in the browser window itself.

Applets allowed a higher degree of interactivity than HTML, and were for instance used for games and data visualization. The first web browser supporting applets was Sun Microsystem’s own HotJava, released in 1997, with all major competitors following soon thereafter. 

A Java Applet used for data visualization (source: Wikimedia)

Java Applets were pioneering attempts at transforming the web into an interactive space. Yet, they had security issues that contributed to their gradual demise in the early 2010s, when all major browsers started to terminate the support for the underlying technology. One of the last great applets was Minecraft, which was first introduced as a Java-based browser game in 2009. Java Applets were officially discontinued in 2017.

We can say that the goal of making HTML web pages more interactive has been fully achieved thanks to JavaScript, another great creation of the mid-nineties. Yet, despite the name, it has nothing to do with Java, apart from some similarities in the syntax and libraries. It was actually introduced in 1995 by Netscape as LiveScript and then rebranded JavaScript for marketing purposes. It is not a programming language, but rather an OOP scripting language that runs in a browser and enhances web pages with interactive elements. JavaScript has now become dominant, being used in 2022 by 98% of all websites (source: w3techs).

At the same time, another Java technology, RMI (Remote Method Invocation), and later RMI-IIOP (RMI on Internet Inter-Orb Protocol), enabled distributed computing based on the Object Oriented paradigm in a Java Virtual Machine. In the early 2000s, it was possible to develop web applications with Applets that, thanks to RMI-services, could retrieve data from a server, all based on JVMs. 

The next step in the evolutionary path were Java servlets, which paved the way for your typical Web 1.0 applications. Servlet allowed the creation of server-side apps interacting with the HTTP protocol. That means that the browser could request a resource to the server, which in turn provided it as a HTML page. It was finally possible to write server-side programs that could interact with web browsers, a real game changer for the time. As servlets’ popularity increased, that of Applets started to wane, for it was easier to adopt pure HTML as User Interface and build server-side web pages.

You can also read the second, third and forth parts. Follow us on LinkedIn and stay tuned for upcoming interesting technology articles on our blog!

Thanks to Danilo Ventura for the valuable contribution to this article series.

Read More
Lambda World 2018

Lambda World 2018

Lambda World is the largest Functional programming event in the country, carefully crafted for you by 47 Degrees and the Scala and Java communities of Spain. The event takes place in Cádiz, one of the most beautiful cities in Spain, and includes Workshops, hands-on experience, hacking, and debugging.

./banner.png


Our colleagues Andrea Bessi and Alberto Adami will be our representatives in Spain.


Discover the Full Event Agenda at: http://cadiz.lambda.world/schedule/


./people.jpg Andrea Bessi & Alberto Adami at Lambda World

Read More