Convert Figma logo to code with AI

twitter logoscala_school

Lessons in the Fundamentals of Scala

3,706
1,129
3,706
23

Top Related Projects

The easy way to learn Scala.

5,795

The Scala 3 compiler, also known as Dotty.

14,317

Scala 2 compiler and standard library. Scala 2 bugs at https://github.com/scala/bug; Scala 3 at https://github.com/scala/scala3

Pure Scala Artifact Fetching

Quick Overview

The twitter/scala_school repository is a collection of educational materials and resources for learning the Scala programming language. It covers a wide range of topics, from the basics of the language to more advanced concepts and best practices.

Pros

  • Comprehensive Content: The repository provides a thorough introduction to Scala, covering a wide range of topics, from the basics of the language to more advanced concepts and best practices.
  • Hands-on Approach: The materials include numerous code examples and exercises, allowing learners to practice and apply what they've learned.
  • Maintained by Industry Experts: The content is created and maintained by experienced Scala developers from Twitter, a company known for its extensive use of the language.
  • Free and Open-Source: The materials are freely available and open-source, making them accessible to anyone interested in learning Scala.

Cons

  • Outdated Content: Some of the content in the repository may be outdated, as the Scala language and ecosystem have evolved since the repository was last updated.
  • Lack of Structured Curriculum: The materials are organized as a collection of resources, rather than a structured curriculum, which may make it challenging for beginners to navigate and follow a clear learning path.
  • Limited Interactive Elements: The repository primarily consists of written materials and code examples, with limited interactive elements or exercises to reinforce learning.
  • Sparse Maintenance: The repository has not been actively maintained in recent years, which may impact the quality and relevance of the content over time.

Code Examples

The twitter/scala_school repository contains numerous code examples and snippets to illustrate various Scala concepts. Here are a few examples:

Example 1: Basic Scala Syntax

object HelloWorld {
  def main(args: Array[String]): Unit = {
    println("Hello, World!")
  }
}

This code demonstrates the basic syntax of a Scala program, including the object and def keywords, and the println function to output a message to the console.

Example 2: Functional Programming with Scala

val numbers = List(1, 2, 3, 4, 5)
val doubledNumbers = numbers.map(x => x * 2)
println(doubledNumbers) // Output: List(2, 4, 6, 8, 10)

This example showcases Scala's functional programming features, using the map function to double each element in a list.

Example 3: Case Classes and Pattern Matching

sealed trait Shape
case class Circle(radius: Double) extends Shape
case class Rectangle(width: Double, height: Double) extends Shape

def getArea(shape: Shape): Double = shape match {
  case Circle(r) => math.Pi * r * r
  case Rectangle(w, h) => w * h
}

println(getArea(Circle(5.0))) // Output: 78.53981633974483
println(getArea(Rectangle(4.0, 3.0))) // Output: 12.0

This code demonstrates the use of case classes and pattern matching in Scala, which are powerful features for working with algebraic data types.

Getting Started

To get started with the twitter/scala_school repository, follow these steps:

  1. Clone the repository to your local machine:

    git clone https://github.com/twitter/scala_school.git
    
  2. Navigate to the cloned repository:

    cd scala_school
    
  3. Explore the contents of the repository, which are organized into various directories and files covering different Scala topics.

  4. Start reading the materials and working through the code examples to learn Scala. The repository includes a variety of resources, including presentations, exercises, and code samples.

  5. If you encounter any issues or have questions, you can refer to the repository's README file or the project's issue tracker for guidance and support.

Competitor Comparisons

The easy way to learn Scala.

Pros of scala-exercises/scala-exercises

  • Actively maintained and updated, with regular commits and contributions from the community.
  • Provides a comprehensive set of exercises and lessons covering a wide range of Scala topics, making it a valuable resource for learning and practicing the language.
  • Includes interactive exercises that allow users to write and test code directly within the browser, enhancing the learning experience.

Cons of scala-exercises/scala-exercises

  • The repository may not be as well-known or widely used as the twitter/scala_school repository, which has a larger user base and more established presence.
  • The content and structure of the exercises may not be as polished or well-organized as the twitter/scala_school repository, which has been around for a longer period.

Code Comparison

Here's a brief code comparison between the two repositories:

twitter/scala_school:

object HelloWorld extends App {
  println("Hello, world!")
}

scala-exercises/scala-exercises:

object HelloWorld extends App {
  println("Hello, world!")
}

As you can see, the code structure and syntax are very similar between the two repositories, as they both demonstrate the basic "Hello, world!" program in Scala.

5,795

The Scala 3 compiler, also known as Dotty.

Pros of scala3

  • Official Scala 3 compiler and standard library, providing the latest language features and improvements
  • More comprehensive and up-to-date documentation for the current Scala ecosystem
  • Active development and regular updates from the core Scala team

Cons of scala3

  • Steeper learning curve for beginners due to advanced language features
  • Less focus on practical, real-world examples compared to scala_school
  • Larger codebase, which may be overwhelming for those new to Scala

Code Comparison

scala3:

enum Color:
  case Red, Green, Blue

def matchColor(c: Color): String = c match
  case Color.Red => "It's red!"
  case Color.Green => "It's green!"
  case Color.Blue => "It's blue!"

scala_school:

sealed trait Color
case object Red extends Color
case object Green extends Color
case object Blue extends Color

def matchColor(c: Color) = c match {
  case Red => "It's red!"
  case Green => "It's green!"
  case Blue => "It's blue!"
}

The scala3 example showcases the new enum syntax and pattern matching, while scala_school uses the older sealed trait approach. scala3's syntax is more concise and modern, reflecting the latest language features.

14,317

Scala 2 compiler and standard library. Scala 2 bugs at https://github.com/scala/bug; Scala 3 at https://github.com/scala/scala3

Pros of scala

  • Official Scala language repository, containing the core compiler and standard library
  • More comprehensive and up-to-date codebase, reflecting the latest language features and improvements
  • Extensive test suite and documentation for the Scala language internals

Cons of scala

  • Steeper learning curve for beginners due to its complexity and scope
  • Less focused on educational content compared to scala_school
  • Requires more advanced knowledge to contribute or understand the codebase

Code Comparison

scala:

object HelloWorld {
  def main(args: Array[String]): Unit = {
    println("Hello, world!")
  }
}

scala_school:

def hello(name: String) = s"Hello, $name!"
println(hello("Scala School"))

Summary

scala is the official Scala language repository, offering a comprehensive codebase for the language's core components. It's more suitable for advanced users and contributors interested in the language internals. scala_school, on the other hand, is an educational resource created by Twitter to teach Scala, making it more accessible for beginners. While scala provides the latest language features and improvements, scala_school focuses on practical examples and tutorials to help developers learn Scala programming concepts.

Pure Scala Artifact Fetching

Pros of coursier/coursier

  • coursier is a modern, actively maintained dependency management tool for Scala and Java, providing a fast and reliable way to fetch and manage dependencies.
  • coursier offers a wide range of features, including support for various dependency resolution algorithms, caching, and offline mode.
  • coursier is highly configurable and can be integrated into various build tools, such as sbt, Maven, and Gradle.

Cons of coursier/coursier

  • The learning curve for coursier may be steeper compared to the more widely used sbt or Maven, especially for developers new to the Scala ecosystem.
  • The documentation for coursier, while comprehensive, may not be as beginner-friendly as the documentation for twitter/scala_school.
  • coursier is primarily focused on dependency management, while twitter/scala_school covers a broader range of Scala-related topics.

Code Comparison

twitter/scala_school:

object HelloWorld extends App {
  println("Hello, world!")
}

coursier/coursier:

import coursier._
import coursier.cache.CacheDefaults
import coursier.cli.{CommonOptions, Resolve}

object Main extends App {
  val resolution = Resolve()
    .addDependencies(
      Dependency(
        Module("org.scala-lang", "scala-library"),
        "2.13.8"
      )
    )
    .run(CommonOptions.default)
}

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

This is Scala School - a set of lessons covering the Scala programming language.

We use jekyll to generate the site. In order to build it, you must first install it:

$ gem install jekyll

should do. Now, build the site with make. This will create a copy of the lessons in the web.out folder.

For development, you'll also need to install RedCloth.

$ gem install RedCloth
$ gem install jekyll-textile-converter

Then make serve will launch jekyll in serving mode: a web server will be launched on port 4000, and changing files will automatically rebuild the site.

To publish to https://twitter.github.io/scala_school:

$ make publish