Skip to content
This repository was archived by the owner on Nov 13, 2021. It is now read-only.

Commit 95958a9

Browse files
authored
Merge pull request #20 from IObert/master
Update before Codejam Vienna
2 parents 8bdda4d + f3ae557 commit 95958a9

16 files changed

+93
-92
lines changed

exercises/01/readme.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,31 +43,31 @@ user-agent = "npm/6.4.1 node/v10.15.3 linux x64"
4343
; "npm config ls -l" to show all defaults.
4444
```
4545

46-
:point_right: Next, explore the information about the `@sap/cds` package, including its dependencies, with:
46+
:point_right: Next, explore the information about the `@sap/cds-dk` (the dk stands for development kit)package, including its dependencies, with:
4747

4848
```sh
4949
user@host:~
50-
=> npm info @sap/cds
50+
=> npm info @sap/cds-dk
5151
```
5252

5353
This will show you that it has dependencies on other `@sap` namespaced packages, and also that there is a 'binary' (in other words an executable) called `cds` that's delivered as part of the package.
5454

55-
:point_right: Now, install the `@sap/cds` package globally:
55+
:point_right: Now, install the `@sap/cds-dk` package globally:
5656

5757
```sh
5858
user@host:~
59-
=> npm install --global @sap/cds
59+
=> npm install --global @sap/cds-dk
6060
```
6161

6262
This should eventually produce output similar to this:
6363

6464
```sh
65-
/Users/i347491/.nvm/versions/node/v10.16.3/bin/cds -> /Users/i347491/.nvm/versions/node/v10.16.3/lib/node_modules/@sap/cds/bin/cds.js
66-
+ @sap/cds@3.18.3
67-
added 69 packages from 144 contributors in 6.416s
65+
/Users/d056949/.nvm/versions/node/v10.15.3/bin/cds -> /Users/d056949/.nvm/versions/node/v10.15.3/lib/node_modules/@sap/cds-dk/bin/cds.js
66+
+ @sap/cds-dk@1.1.4
67+
updated 1 package in 27.076s
6868
```
6969

70-
Here you can see that the version of the `@sap/cds` package installed is 3.18.3. It may be that the version of `@sap/cds` that is installed when you do this exercise will be different (newer).
70+
Here you can see that the version of the `@sap/cds-dk` package installed is 3.18.4. It may be that the version of `@sap/cds-dk` that is installed when you do this exercise will be different (newer).
7171

7272
### 2. Install the CDS extension for VS Code
7373

@@ -110,7 +110,7 @@ npx check-sap-cloud-readiness -codejam-cap
110110
You should see an output similar to this:
111111
![out](output.png)
112112

113-
If necessary, double check the [prerequisites](../../prerequisites.md) to install the missing tools. Please contact the instructor of this CodeJam if you need help.
113+
If necessary, double check the [prerequisites](../../prerequisites.md) to install the missing tools. Please contact the instructor of this CodeJam if you need help.
114114

115115

116116
## Summary
@@ -120,9 +120,13 @@ You've now installed the key tools for developing with CAP locally, and are all
120120
## Questions
121121

122122
1. What are the benefits of using NPM here?
123+
<!--- easy to user and de-facto standard --->
123124

124-
1. What are the `@sap` namespaced packages upon which `@sap/cds` depends?
125+
2. What are the `@sap` namespaced packages upon which `@sap/cds-dk` depends?
126+
<!--- cds-sidecar-client, edm-converters, cds, generator-cds --->
125127

126-
1. What is the significance of using the `--global` option when installing the `@sap/cds` package?
128+
3. What is the significance of using the `--global` option when installing the `@sap/cds-dk` package?
129+
<!--- globally available --->
127130

128-
1. What is the meaning of the `.vsix` file type for the VS Code extension? Can we dig into that to see what's inside?
131+
4. What is the meaning of the `.vsix` file type for the VS Code extension? Can we dig into that to see what's inside?
132+
<!--- VSI (Visual Studio Installer) and with most things, we tacked an "x" on the end, unzip, contains extension (node app), manifest and xml --->
-7.63 KB
Loading
166 KB
Loading

exercises/02/readme.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ user@host:~
9898
=> code bookshop
9999
```
100100

101-
If this approach is not available to you, simply start VS Code through your operating system's GUI and open the directory manually (with menu path "File → Open").
101+
> If this approach is not available to you, simply start VS Code through your operating system's GUI and open the directory manually (with menu path "File → Open").
102102
103103

104104
### 3. Explore the initialized project structure
@@ -115,7 +115,7 @@ Briefly, the directories and contents can be described thus:
115115
| -------------- | -------- |
116116
| `.vscode` | VS Code specific files for launch configurations (useful for debugging, which we will cover in [exercise 08](../08/)) |
117117
| `db` | Where the data models (in CDS) are specified. |
118-
| `node_modules` | This is the normal place where NPM packages (modules) are to be found in a Node.js based project |
118+
| `node_modules` | This is the place where NPM packages (modules) are to be found in a Node.js based project |
119119
| `srv` | Where the service definitions (in CDS) are specified. |
120120
| `mta.yaml` | This is the central descriptor file for the project. It defines all modules (microservices) and backing services (like databases). This information will be used to build the .mtar archive during design time and to deploy & provision the apps and services during deploy time. |
121121

@@ -168,6 +168,9 @@ This should open up the terminal at the bottom of VS Code like this:
168168
169169
![integrated terminal in view](integrated-terminal-in-view.png)
170170
171+
> **Windows users:** Please make sure to select `cmd` as your default shell before you continue:
172+
![default shell](default-shell-windows.png)
173+
171174
:point_right: In the integrated terminal, use the `cds` command line tool with the `serve` command to start serving. Specify `all`, like this, so that `cds` will look for appropriate configuration to serve:
172175
173176
```sh
@@ -215,10 +218,14 @@ With a single command, you've initialized a basic OData service project and with
215218

216219
## Questions
217220

218-
1. Why is there an focus on "TTM" (time to metadata) - what advantages does that bring?
221+
1. Why is there an focus on "Contracts First" (As all you need to run a service is a service definition) - what advantages does that bring?
222+
<!--- UI teams can start to work right away --->
219223

220-
1. What is the difference between the data model and the service definition? Why do we need both?
224+
2. What is the difference between the data model and the service definition? Why do we need both?
225+
<!--- db model for schema, service for access (control) --->
221226

222-
1. What is returned in response to a request for the Books entityset resource right now?
227+
3. What is returned in response to a request for the Books entityset resource right now?
228+
<!--- error --->
223229

224-
1. What happened to the `cds` process when you accessed the entityset? Can you think of reasons why this happened?
230+
4. What happened to the `cds` process when you accessed the entityset? Can you think of reasons why this happened?
231+
<!--- crash --->

exercises/03/readme.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,10 @@ You now have a fully functional, albeit simple, OData service backed by a persis
290290
## Questions
291291

292292
1. What are other possible targets in the compilation context?
293+
<!--- yaml, edmx, when inspecting cdsc you can find hana,odata,cds,swager,sql,csn as well --->
293294

294-
1. What is the thinking behind the use of views at the service definition layer and tables at the data model layer?
295+
2. What is the thinking behind the use of views at the service definition layer and tables at the data model layer?
296+
<!--- different consumers on the same data (APIs, UIs), leverage features of a view, separation of concerns, --->
295297

296-
1. Why might you use the `cds compile` command at all?
298+
3. Why might you use the `cds compile` command at all?
299+
<!--- to understand what happens under the hood when you run cds deploy --->

exercises/04/readme.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,7 @@ Your OData service now has sample data that you can access via OData operations.
7676
## Questions
7777

7878
1. Does the order of the fields defined in the CSV files have to match the order of the properties defined in the entities in the data model?
79+
<!--- nope, databases work on sets --->
7980

80-
1. Where do you think the format of the CSV file names has come from?
81+
2. Where do you think the format of the CSV file names has come from?
82+
<!--- namespace + table name --->

exercises/05/readme.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,6 @@ user@host:~/bookshop
155155
[cds] - launched in: 722.087ms
156156
```
157157

158-
> If you're running Windows, you can use a double-semicolon (;;) in place of the `&&`. It's not quite the same but will work just fine in most cases.
159-
160158

161159
### 5. Examine what the Orders entity looks like now
162160

@@ -262,8 +260,11 @@ At this point you have a meaningful OData service with data and against which yo
262260

263261
## Questions
264262

265-
1. We added a field `country` described by the type `Country`. What exactly is this type, and what does it bring about in the resulting service's metadata?
266-
267263
1. Did you notice an extra line in the output of `cds serve all` after the addition of the reference to `@sap/cds/common`?
264+
<!--- node_modules/@sap/cds/common.cds --->
265+
266+
2. We added a field `country` described by the type `Country`. What exactly is this type, and what does it bring about in the resulting service's metadata?
267+
<!--- string(3), code list --->
268268

269-
1. Are there any issues with the way we have set up the service definition right now?
269+
3. Are there any issues with the way we have set up the service definition right now?
270+
<!--- all public --->

exercises/06/readme.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ curl \
4545
http://localhost:4004/catalog/Books
4646
```
4747

48-
Check that the creation requests are successful, and that you can see the new author and book in an OData Query operation: [http://localhost:4004/catalog/Authors?$expand=books](http://localhost:4004/catalog/Authors?$expand=books).
48+
Check that the creation requests are successful, and that you can see the new author and book in an OData Query operation: <http://localhost:4004/catalog/Authors?$expand=books>.
4949

5050

5151
### 3. Restrict access to the Books and Authors entities
@@ -187,6 +187,11 @@ In this exercise you used shortcut annotations to restrict access to the entitie
187187

188188
## Questions
189189

190-
1. How might the annotations relating to the read-only restrictions be useful in a UI context?
190+
1. Did you notice anything special about your request to <http://localhost:4004/catalog/Authors?$expand=books> in step 2?
191+
<!--- expand call --->
191192

192-
1. What was the format of the OData Delete operation - did we need to supply a payload?
193+
2. How might the annotations relating to the read-only restrictions be useful in a UI context?
194+
<!--- FE autorenders (or hides) component depending on metadata --->
195+
196+
3. What was the format of the OData Delete operation - did we need to supply a payload?
197+
<!--- nope, because of REST --->

exercises/07/readme.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,5 +102,7 @@ It's easy to explore building different views on the same underlying data model,
102102
## Questions
103103

104104
1. Why might it be better to specify properties to _exclude_, rather than properties to _include_?
105+
<!-- depending on the data model, how many "unused" properties you have -->
105106

106-
1. What did the order creation HTTP requests look like - which service was used, and why?
107+
2. What did the order creation HTTP requests look like - which service was used, and why?
108+
<!-- used the old one -->

exercises/08/readme.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,10 @@ You have added custom logic and learned how to debug a service in VS Code. The o
165165
## Questions
166166

167167
1. What other hooks do you think might be useful in customizing a service?
168+
<!-- before CRUD, after CRUD -->
168169

169-
1. What is the command used in the launch configuration for starting the service in debug mode - is it `cds serve all`?
170+
2. What is the command used in the launch configuration for starting the service in debug mode - is it `cds serve all`?
171+
<!-- cds run in memory with inspect breakpoint --->
170172

171-
1. How many times is the function (that is supplied to the `after` hook) called?
173+
3. How many times is the function (that is supplied to the `after` hook) called?
174+
<!-- 1 -->

0 commit comments

Comments
 (0)