
Explore Scala, scalable language that blends object oriented and functional programming on the Java platform. See how traits, function values as objects, and Java interoperability enable building scripts to systems.
Discover the basics of Scala variables, using val and var with type inference, print hello world, and grasp reassignment rules and multi-line input via the Scala interpreter.
Learn to write Scala functions with def, parameter and result types, use if expressions, explore unit, and run scripts with println, args, and comments, including simple string concatenation.
Explore while loops and if conditions in Scala, demonstrate printing and incrementing, discuss type inference and braces, and compare imperative and functional styles with for expressions.
Learn to parameterize Scala arrays with types and values, using type parameters in square brackets and value parameters in parentheses, with practical array initialization.
Learn how Scala lists enable functional programming with immutable lists built from cons and nil, support for prepending elements efficiently, and strategies to append via reverse or a list buffer.
Learn how Scala tuples are immutable containers that hold mixed types, access elements with underscore indices, and return multiple values compared to lists.
Explore how Scala balances immutable values (vals) with mutable vars, refactoring imperative code into a functional style, minimizing side effects and embracing unit results for testable programs.
Explore writing a scala script that reads lines from a file and prints each line with its length, using a functional style and optional formatting to align the output.
Explore Scala programming concepts like classes and objects, including fields, methods, and private state, using a checksum accumulator example to show instantiation, mutability, and access control in a Scala application.
Explore how Scala handles class design with a checksum accumulator, define side-effect methods, and use semicolon inference to write concise, unit-typed procedures.
Explore singleton objects in Scala by contrasting them with classes, and learn how a companion object shares private members with its class, exposes a calculate method, and uses a cache.
Explore scala's basic types, including byte, short, int, long, char, and boolean, alongside strings, floats, and doubles, and learn their Java-like ranges, literals, and operator behavior.
Discover how Scala represents literals, from floating point, floats and doubles, to character literals with octal, hex, and unicode escapes, plus raw strings and stripMargin for multiline text.
Explore symbol literals in Scala, including their interned nature and how to pass names, and learn that operators are just methods with infix, prefix, and postfix notation.
Scala explains reference equality with EQ and NE, and details operator precedence and associativity, including assignment operators and how the first and last characters of operator names affect evaluation.
Explore designing immutable functional objects in Scala by building a rational class with numerator and denominator, supporting addition, subtraction, multiplication, and division, using primary constructor.
Explore auxiliary constructors in Scala by modeling rationals with a single-argument constructor that defaults the denominator to one, invoking the primary constructor.
Explore Scala's identifier rules, including alphanumeric, operator forms, and constants, and how camel case, underscores, and the dollar prefix affect variables, methods, and classes, plus how the compiler mangles operators.
Explore method overloading in Scala to support mixed arithmetic on rational numbers and integers, with overloaded plus, minus, times, and divide methods and compiler driven resolution.
Explore method overloading in Scala by building a rational class with plus, minus, multiply, divide, and gcd-based normalization, plus custom constructors and implicit conversions.
Explore Scala's built-in control structures—if, while, for, try, match, and function calls—and how they produce values, with libraries providing most controls and immutable vals.
Explore Scala while and do-while loops, understand unit values, and compare imperative and functional styles while looping until conditions meet, with gcd and input examples.
Explore Scala exception handling with try expressions, throwing and catching exceptions, understanding throw as an expression, and using catch clauses with pattern matching to handle errors.
Translate Java loop patterns to Scala by rewriting the while loop with an if guard or a recursive function, using argument length checks and starts with and ends with checks.
Explore first-class functions in Scala, writing function literals and values, and invoking them with apply. Learn short-form literals, target typing, and using for each and filter on collections.
Discover how Scala creates function values from sums with underscores, preview the compiler-generated apply method, and master partially applied functions and for each usage.
Explore how Scala implements first-class functions by capturing free variables in closures, producing runtime function values that reflect external changes and maintain per-closure bindings.
Explore Scala repeated parameters and varargs using a star for the last parameter and colon underscore star to pass array elements to echo. Tail recursion runs without overhead.
Explore tail recursion in Scala, learn how tail calls optimize stack usage, and understand limitations with indirect recursion, function values, and repeated parameters.
Explore reducing code duplication through higher-order functions and function values, learning currying and binding parameters to build control abstractions for flexible file search API.
Explain by-name and binding parameters in Scala, illustrate with my assert vs boolean assert, and show how by-name parameters enable concise, side-effect-free control patterns using higher-order functions.
Examine a two dimensional layout library using composition and inheritance to build rectangular text elements with abstract classes, combinators like above and beside, and factory methods.
Explore parameter list methods in Scala, distinguish parameterless from empty-parameter forms, and apply the uniform access principle. Define height and width in an abstract element using contents length.
Extend Scala classes by creating a subclass that implements the abstract contents method, inherits from element, and explores composition and the uniform access principle with val or var fields.
Explore how Scala handles inheritance and dynamic binding by overriding a demo method in array and line element classes while uniform element inherits the superclass implementation, showing runtime method resolution.
Discover how to declare final members and final classes in Scala inheritance to prevent overrides, fragile base class issues. Compare inheritance with composition and explore above, beside, and mkString formatting.
Explore how to define a factory object in Scala to centralize object creation for layout elements, using a companion object with overloaded LM methods to hide implementation details.
Explore scala's class hierarchy from any to nothing, including null, with anyval and anyref, and learn how value classes derive from them and use implicit widening.
Discover how Scala implements primitives, stores 32-bit integers, and uses autoboxing for Java interop, and how equality handles value versus reference semantics and bottom types like Null and Nothing.
Explore a Scala case study on employee data analysis, using biometric in and out hours to determine hikes, and design file and database schemas with JDBC.
Install scala, mysql, mysql workbench, and the IntelliJ IDE, verify scala installation and version compatibility, and follow platform-specific steps for Windows, Linux, or macOS.
Install MySQL and set up MySQL Workbench as the UI to connect to a local MySQL instance, start the server, and run queries, then download IntelliJ IDEA for development.
Course Introduction
Welcome to "Scala Programming - From Basics to Advanced," a comprehensive course designed to take you from a beginner to a proficient Scala developer. Scala, known for its concise syntax and functional programming features, is a powerful language that runs on the Java Virtual Machine (JVM). This course is tailored to provide a deep understanding of Scala, making it an excellent choice for both new and experienced programmers looking to expand their skills.
Section 1: Scala Programming
In this section, students will gain a thorough grounding in Scala programming. We begin with an introduction to the language, where students will learn about Scala's syntax, variables, and the basics of writing scripts. As we progress, we'll delve into loops, conditions, and parameterizing arrays with types, providing a solid foundation in control structures and data manipulation.
We'll cover essential topics such as lists, tuples, sets, and the differences between mutable (vars) and immutable (vals) data structures. Students will also learn how to create sets in tuples through scripting. The section continues with an in-depth look at classes, fields, methods, and semicolon inference, as well as singleton objects and app development in Scala.
Advanced topics include basic types, character literals, operators, arithmetic, and bitwise operations. We'll explore rational objects, preconditions, auxiliary constructors, private fields, methods, operator definitions, and method overloading. Control structures like if expressions, while and do-while loops, for expressions, and exception handling with try expressions will be thoroughly covered. The section concludes with match expressions, variable scope, first-class functions, repeated parameters, reducing code duplication, higher-order functions, new control structures, and by-name parameters.
Section 2: Project On Scala: Employee Data Analysis
This project-based section is designed to apply the skills learned in Section 1 through a real-world scenario: Employee Data Analysis. Starting with an introduction to the project, students will set up their development environment, create project structures, and configure necessary dependencies.
The project will involve reading and manipulating CSV data using Scala, leveraging JDBC API for data insertion and fetching, and working with files from the classpath. Students will gain hands-on experience in configuring POM, understanding data structures, and executing Scala-based data analysis tasks.
Course Conclusion
By the end of this course, students will have developed a robust understanding of Scala programming, from basic concepts to advanced techniques. They will be well-equipped to handle real-world programming challenges, particularly in data analysis and application development. This course will empower students to harness the full potential of Scala, making them proficient in one of the most versatile programming languages in the industry.