Skip to content

Commit 1c2155e

Browse files
committed
Domain Modeling is more accurate than Data Modeling
1 parent f53fe84 commit 1c2155e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+93
-86
lines changed

Diff for: _overviews/scala3-book/ca-context-bounds.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Contextual Abstractions
33
type: section
44
description: This page demonstrates Context Bounds in Scala 3.
5-
num: 51
5+
num: 52
66
previous-page: ca-given-using-clauses
77
next-page: ca-given-imports
88
---

Diff for: _overviews/scala3-book/ca-contextual-abstractions-intro.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Contextual Abstractions
33
type: chapter
44
description: This chapter provides an introduction to the Scala 3 concept of Contextual Abstractions.
5-
num: 49
5+
num: 50
66
previous-page: types-others
77
next-page: ca-given-using-clauses
88
---

Diff for: _overviews/scala3-book/ca-extension-methods.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Extension Methods
33
type: section
44
description: This page demonstrates how Extension Methods work in Scala 3.
5-
num: 53
5+
num: 54
66
previous-page: ca-given-imports
77
next-page: ca-type-classes
88
---

Diff for: _overviews/scala3-book/ca-given-imports.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Given Imports
33
type: section
44
description: This page demonstrates how 'given' import statements work in Scala 3.
5-
num: 52
5+
num: 53
66
previous-page: ca-context-bounds
77
next-page: ca-extension-methods
88
---

Diff for: _overviews/scala3-book/ca-given-using-clauses.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Given Instances and Using Clauses
33
type: section
44
description: This page demonstrates how to use 'given' instances and 'using' clauses in Scala 3.
5-
num: 50
5+
num: 51
66
previous-page: ca-contextual-abstractions-intro
77
next-page: ca-context-bounds
88
---

Diff for: _overviews/scala3-book/ca-implicit-conversions.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Implicit Conversions
33
type: section
44
description: This page demonstrates how to implement Implicit Conversions in Scala 3.
5-
num: 56
5+
num: 57
66
previous-page: ca-multiversal-equality
77
next-page: ca-summary
88
---

Diff for: _overviews/scala3-book/ca-multiversal-equality.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Multiversal Equality
33
type: section
44
description: This page demonstrates how to implement Multiversal Equality in Scala 3.
5-
num: 55
5+
num: 56
66
previous-page: ca-type-classes
77
next-page: ca-implicit-conversions
88
---

Diff for: _overviews/scala3-book/ca-summary.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Summary
33
type: section
44
description: This page provides a summary of the Contextual Abstractions lessons.
5-
num: 57
5+
num: 58
66
previous-page: ca-implicit-conversions
77
next-page: concurrency
88
---

Diff for: _overviews/scala3-book/ca-type-classes.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Implementing Type Classes
33
type: section
44
description: This page demonstrates how to create and use type classes in Scala 3.
5-
num: 54
5+
num: 55
66
previous-page: ca-extension-methods
77
next-page: ca-multiversal-equality
88
---

Diff for: _overviews/scala3-book/collections-classes.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Collections Classes
33
type: section
44
description: This page introduces the common Scala 3 collections classes.
5-
num: 33
5+
num: 34
66
previous-page: collections-intro
77
next-page: collections-methods
88
---

Diff for: _overviews/scala3-book/collections-intro.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Scala Collections
33
type: chapter
44
description: This page provides and introduction to the common collections classes and their methods in Scala 3.
5-
num: 32
5+
num: 33
66
previous-page: packaging-imports
77
next-page: collections-classes
88
---

Diff for: _overviews/scala3-book/collections-methods.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Collections Methods
33
type: section
44
description: This page demonstrates the common methods on the Scala 3 collections classes.
5-
num: 34
5+
num: 35
66
previous-page: collections-classes
77
next-page: collections-summary
88
---

Diff for: _overviews/scala3-book/collections-summary.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Collections Summary
33
type: section
44
description: This page provides a summary of the Collections chapter.
5-
num: 35
5+
num: 36
66
previous-page: collections-methods
77
next-page: functional-programming
88
---

Diff for: _overviews/scala3-book/concurrency.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Concurrency
33
type: chapter
44
description: This page discusses how Scala concurrency works, with an emphasis on Scala Futures.
5-
num: 58
5+
num: 59
66
previous-page: ca-summary
77
next-page: scala-tools
88
---

Diff for: _overviews/scala3-book/control-structures.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ type: chapter
44
description: This page provides an introduction to Scala's control structures, including if/then/else, 'for' loops, 'for' expressions, 'match' expressions, try/catch/finally, and 'while' loops.
55
num: 15
66
previous-page: first-look-at-types
7-
next-page: data-modeling-1-tools
7+
next-page: domain-modeling-intro
88
---
99

1010
<!--

Diff for: _overviews/scala3-book/data-modeling-3-fp.md renamed to _overviews/scala3-book/domain-modeling-fp.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
2-
title: FP Data Modeling
2+
title: FP Modeling
33
type: section
4-
description: This chapter provides an introduction to FP data modeling with Scala 3.
5-
num: 18
6-
previous-page: data-modeling-2-oop
4+
description: This chapter provides an introduction to FP domain modeling with Scala 3.
5+
num: 19
6+
previous-page: domain-modeling-oop
77
next-page: methods-intro
88
---
99

1010

11-
This chapter provides an introduction to functional programming (FP) style data modeling in Scala 3. When modeling the world around us with FP, you typically use these Scala constructs:
11+
This chapter provides an introduction to functional programming (FP) style domain modeling in Scala 3. When modeling the world around us with FP, you typically use these Scala constructs:
1212

1313
- Enumerations
1414
- Case classes
@@ -137,7 +137,7 @@ These solutions are shown in the next three sections.
137137

138138

139139

140-
## (1) Handling behavior in FP with a companion object
140+
## (1) Handling behavior with a companion object
141141

142142
A first approach is to put the behaviors — the methods — in a companion object. With this approach, you put the data model in a `case` class, and then put the methods in a companion object of the `case` class.
143143

@@ -195,7 +195,7 @@ val pizza3 = updateCrustSize(pizza2, Large)
195195

196196

197197

198-
## (2) Using a modular approach
198+
## (2) Handling behavior with a modular approach
199199

200200
A second way to organize behaviors in an FP style is to use a “modular” approach. The book, *Programming in Scala*, defines a *module* as, “a ‘smaller program piece’ with a well defined interface and a hidden implementation.” Let’s look at what this means.
201201

@@ -393,7 +393,7 @@ Just like the `Pizza` class, you can say these things about the `List` class:
393393

394394

395395

396-
## Summary of the FP domain modeling approaches
396+
## Summary of the approaches
397397

398398
Defining a data model in Scala/FP tends to be simple: Just model the data with enumerations and `case` classes with immutable fields. This approach is similar to creating a relational database design, and it becomes a blueprint of the classes, their fields, and their relationships.
399399

Diff for: _overviews/scala3-book/domain-modeling-intro.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: Domain Modeling
3+
type: chapter
4+
description: This chapter provides an introduction to domain modeling in Scala 3.
5+
num: 16
6+
previous-page: control-structures
7+
next-page: domain-modeling-tools
8+
---
9+
10+
This chapter shows how you can model the world around you with Scala 3:
11+
12+
- The Tools section introduces the tools that are available to you, including classes, traits, enums, and more
13+
- The OOP Modeling section looks at modeling attributes and behaviors in an object-oriented programming (OOP) style
14+
- The FP Modeling section looks at domain modeling in a functional programming (FP) style
15+

Diff for: _overviews/scala3-book/data-modeling-2-oop.md renamed to _overviews/scala3-book/domain-modeling-oop.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
---
2-
title: OOP Data Modeling
2+
title: OOP Modeling
33
type: section
4-
description: This chapter provides an introduction to OOP data modeling with Scala 3.
5-
num: 17
6-
previous-page: data-modeling-1-tools
7-
next-page: data-modeling-3-fp
4+
description: This chapter provides an introduction to OOP domain modeling with Scala 3.
5+
num: 18
6+
previous-page: domain-modeling-tools
7+
next-page: domain-modeling-fp
88
---
99

10-
This chapter provides an introduction to object-oriented programming (OOP) style data modeling in Scala 3.
10+
This chapter provides an introduction to object-oriented programming (OOP) style domain modeling in Scala 3.
1111

1212

1313

14-
## OOP Data Modeling
14+
## Introduction
1515

1616
The “big three” concepts in OOP are encapsulation, polymorphism, and inheritance:
1717

@@ -31,7 +31,7 @@ This chapter focuses on two main concepts:
3131

3232
## Classes
3333

34-
As shown in the [Modeling Tools chapter](data-modeling-1-tools.md), these examples show how to define classes that only have constructor parameters:
34+
As shown in the [Modeling Tools section](domain-modeling-tools.md), these examples show how to define classes that only have constructor parameters:
3535

3636
```scala
3737
class Person(var name: String, var vocation: String)
@@ -224,7 +224,7 @@ Scala classes have other features to support OOP-style programming:
224224

225225
- You can define methods and fields to be `private` or `protected`, to control how they are accessed and overridden
226226
- Classes can have multiple constructors
227-
- As shown in the [Modeling Tools chapter](data-modeling-1-tools.md), class constructor parameters can have default values
227+
- As shown in the [Modeling Tools section](domain-modeling-tools.md), class constructor parameters can have default values
228228
- A class can be marked as `open`, signaling that it’s planned for extensions:
229229

230230
```scala

Diff for: _overviews/scala3-book/data-modeling-1-tools.md renamed to _overviews/scala3-book/domain-modeling-tools.md

+8-16
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
11
---
2-
title: Data Modeling
3-
type: chapter
4-
description: This chapter provides an introduction to the available data modeling tools in Scala 3, including classes, traits, enums, and more.
5-
num: 16
6-
previous-page: control-structures
7-
next-page: data-modeling-2-oop
2+
title: Tools
3+
type: section
4+
description: This chapter provides an introduction to the available domain modeling tools in Scala 3, including classes, traits, enums, and more.
5+
num: 17
6+
previous-page: domain-modeling-intro
7+
next-page: domain-modeling-oop
88
---
99

10-
This chapter is the first of three chapters that look at how you can model the world around you with Scala 3. The three chapters are:
1110

12-
- This chapter introduces the tools that are available to you, including classes, traits, enums, and more
13-
- The next chapter looks at modeling attributes and behaviors in an object-oriented programming (OOP) style
14-
- The third chapter looks at modeling in a functional programming (FP) style
15-
16-
17-
18-
## Scala 3 modeling tools
1911

2012
Scala 3 provides the following tools to help us model the world around us:
2113

@@ -71,7 +63,7 @@ p.vocation = "Musician"
7163
```
7264

7365

74-
### Classes can have fields and methods
66+
### Fields and methods
7567

7668
In addition to constructor parameters, classes can also have fields and methods. They are defined in the body of the class, which also serves as the class constructor:
7769

@@ -192,7 +184,7 @@ circle1.area
192184

193185
In this example the `area` method that’s available to each instance uses the `calculateArea` method that’s defined in the companion object. If you’re familiar with Java, `calculateArea` is similar to a static method. Also, because `calculateArea` is private, it can’t be accessed by other code, but as shown, it can be seen by instances of the `Circle` class.
194186

195-
### Other companion object uses
187+
### Other uses
196188

197189
Companion objects can be used for several purposes:
198190

Diff for: _overviews/scala3-book/fun-anonymous-functions.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Anonymous Functions
33
type: section
44
description: This page shows how to use anonymous functions in Scala, including examples with the List class 'map' and 'filter' functions.
5-
num: 24
5+
num: 25
66
previous-page: fun-intro
77
next-page: fun-function-variables
88
---

Diff for: _overviews/scala3-book/fun-eta-expansion.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Eta Expansion
33
type: section
44
description: This page discusses Eta Expansion, the Scala technology that automatically and transparently converts methods into functions.
5-
num: 26
5+
num: 27
66
previous-page: fun-function-variables
77
next-page: fun-hofs
88
---

Diff for: _overviews/scala3-book/fun-function-variables.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Function Variables
33
type: section
44
description: This page shows how to use anonymous functions in Scala, including examples with the List class 'map' and 'filter' functions.
5-
num: 25
5+
num: 26
66
previous-page: fun-anonymous-functions
77
next-page: fun-eta-expansion
88
---

Diff for: _overviews/scala3-book/fun-hofs.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Higher-Order Functions
33
type: section
44
description: This page demonstrates how to create and use higher-order functions in Scala.
5-
num: 27
5+
num: 28
66
previous-page: fun-eta-expansion
77
next-page: fun-write-map-function
88
---

Diff for: _overviews/scala3-book/fun-intro.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Functions
33
type: chapter
44
description: This chapter looks at all topics related to functions in Scala 3.
5-
num: 23
5+
num: 24
66
previous-page: methods-summary
77
next-page: fun-anonymous-functions
88
---

Diff for: _overviews/scala3-book/fun-summary.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Functions Summary
33
type: section
44
description: This page shows how to use anonymous functions in Scala, including examples with the List class 'map' and 'filter' functions.
5-
num: 30
5+
num: 31
66
previous-page: fun-write-method-returns-function
77
next-page: packaging-imports
88
---

Diff for: _overviews/scala3-book/fun-write-map-function.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Write Your Own map Method
33
type: section
44
description: This page demonstrates how to create and use higher-order functions in Scala.
5-
num: 28
5+
num: 29
66
previous-page: fun-hofs
77
next-page: fun-write-method-returns-function
88
---

Diff for: _overviews/scala3-book/fun-write-method-returns-function.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Creating a Method That Returns a Function
33
type: section
44
description: This page demonstrates how to create and use higher-order functions in Scala.
5-
num: 29
5+
num: 30
66
previous-page: fun-write-map-function
77
next-page: fun-summary
88
---

Diff for: _overviews/scala3-book/functional-programming.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Functional Programming
33
type: chapter
44
description: This section provides an introduction to functional programming in Scala 3.
5-
num: 36
5+
num: 37
66
previous-page: collections-summary
77
next-page: types-introduction
88
---

Diff for: _overviews/scala3-book/interacting-with-java.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Interacting with Java
33
type: chapter
44
description: This page demonstrates how Scala code can interact with Java, and how Java code can interact with Scala code.
5-
num: 60
5+
num: 61
66
previous-page: scala-tools
77
next-page: scala-3-metaprogramming
88
---

Diff for: _overviews/scala3-book/methods-intro.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
title: Methods
33
type: chapter
44
description: This section introduces methods in Scala 3.
5-
num: 19
6-
previous-page: data-modeling-3-fp
5+
num: 20
6+
previous-page: domain-modeling-fp
77
next-page: methods-most
88
---
99

Diff for: _overviews/scala3-book/methods-main-methods.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: main Methods
33
type: section
44
description: This page describes how 'main' methods and the '@main' annotation work in Scala 3.
5-
num: 21
5+
num: 22
66
previous-page: methods-most
77
next-page: methods-summary
88
---

0 commit comments

Comments
 (0)