Differences between object and class in Scala

A small Scala tutorial with code examples and video
29 August 2017   1028

What's the differences between class and object in Scala? Let's check thru a code example.

object A extends B with C {
  def f(x: Any): Any = ???

From the Scala view, this declaration

  • declares an anonymous (inaccessible) class that extends both B and C, and
  • creates a single instance of this class named A.

This means A can be passed to functions expecting objects of type B or C, and method f can be called using A.f(...).

Additional Features of object

There exist some special methods that can be defined for objects:

  • def apply(...) enables the usual method name-less syntax of A(...)
  • def unapply(...) allows to create custom pattern matching extractors
  • if accompanying a class of the same name, the object assumes a special role when resolving implicit parameters

What is Graphcool?

Little review of open-source backend development framework
26 October 2017   3222

Graphcool is an open-source backend development framework to develop and deploy production-ready GraphQL microservices. With Graphcool you can design your data model and have a production ready GraphQL API online in minutes.

The framework integrates with cloud-native serverless functions and is compatible with existing libraries and tools like GraphQL.js and Apollo Server. Graphcool comes with a CLI and a Docker-based runtime which can be deployed to any server or cloud.

The framework provides powerful abstractions and building blocks to develop flexible, scalable GraphQL backends:

  1. GraphQL database to easily evolve your data schema & migrate your database
  2. Flexible auth using the JWT-based authentication & permission system
  3. Realtime API using GraphQL Subscriptions
  4. Highly scalable architecture enabling asynchronous, event-driven flows using serverless functions
  5. Works with all frontend frameworks like React, Vue.js, Angular

You can learn more here:

  • Website
  • GitHub