Просмотр исходного кода

Merge pull request #1404 from sjwarner-bp/readme-updates

update readmes
FridaTveit 8 лет назад
Родитель
Сommit
09140f6253
Аккаунт пользователя с таким Email не найден

+ 4
- 5
exercises/crypto-square/README.md Просмотреть файл

@@ -45,11 +45,10 @@ The message above is coded as:
45 45
 imtgdvsfearwermayoogoanouuiontnnlvtwttddesaohghnsseoau
46 46
 ```
47 47
 
48
-Output the encoded text in chunks.  Phrases that fill perfect rectangles
49
-`(r X c)` should be output `c` chunks of `r` length, separated by spaces.
50
-Phrases that do not fill perfect rectangles will have `n` empty spaces.
51
-Those spaces should be distributed evenly, added to the end of the last
52
-`n` chunks.
48
+Output the encoded text in chunks that fill perfect rectangles `(r X c)`,
49
+with `c` chunks of `r` length, separated by spaces. For phrases that are
50
+`n` characters short of the perfect rectangle, pad each of the last `n`
51
+chunks with a single trailing space.
53 52
 
54 53
 ```text
55 54
 imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn  sseoau 

+ 38
- 0
exercises/error-handling/README.md Просмотреть файл

@@ -9,6 +9,44 @@ This exercise requires you to handle various errors. Because error handling
9 9
 is rather programming language specific you'll have to refer to the tests
10 10
 for your track to see what's exactly required.
11 11
 
12
+# Java Tips
13
+
14
+This exercise requires you to handle exceptions. An [exception](https://docs.oracle.com/javase/tutorial/essential/exceptions/definition.html) is an event, which occurs during the execution of a program, that disrupts the normal flow of the program's instructions.
15
+
16
+In Java, there are two types of exceptions: checked and unchecked exceptions.
17
+
18
+- [Checked vs Unchecked Exceptions in Java](https://www.geeksforgeeks.org/checked-vs-unchecked-exceptions-in-java/)
19
+
20
+- [Unchecked Exceptions — The Controversy](https://docs.oracle.com/javase/tutorial/essential/exceptions/runtime.html)
21
+
22
+## Checked exceptions
23
+
24
+Checked exceptions are the exceptions that are checked at [compile time](https://en.wikipedia.org/wiki/Compile_time).
25
+
26
+### Practical implications
27
+
28
+You have to declare them in the [method signature](https://docs.oracle.com/javase/tutorial/java/javaOO/methods.html) of any method that can [throw](https://docs.oracle.com/javase/tutorial/essential/exceptions/throwing.html) a checked exception and handle or rethrow them when calling any method that can throw a checked exception.
29
+
30
+This is because checked exceptions are meant to be handled at runtime, i.e. they are errors you can recover from.
31
+
32
+### Examples of where they are used
33
+
34
+They're often used when a method can't return any valid result, for example a search method which hasn't found the item it was searching for.
35
+
36
+It's an alternative to returning null or a error code. A checked exception is better than those alternatives because it forces the user of the method to consider the error case.
37
+
38
+## Unchecked exceptions
39
+
40
+Unchecked exceptions are the exceptions that are not checked at [compile time](https://en.wikipedia.org/wiki/Compile_time).
41
+
42
+### Practical implications
43
+
44
+You don't have to declare them in the [method signature](https://docs.oracle.com/javase/tutorial/java/javaOO/methods.html) of methods that can [throw](https://docs.oracle.com/javase/tutorial/essential/exceptions/throwing.html) an unchecked exception and handle or rethrow them when calling any method that can throw an unchecked exception.
45
+
46
+### Examples of where they are used
47
+
48
+Unchecked exceptions are mean to be used for any error than can't be handled at runtime, e.g. running out of memory.
49
+
12 50
 # Running the tests
13 51
 
14 52
 You can run all the tests for an exercise by entering

+ 6
- 6
exercises/series/README.md Просмотреть файл

@@ -1,18 +1,18 @@
1 1
 # Series
2 2
 
3 3
 Given a string of digits, output all the contiguous substrings of length `n` in
4
-that string.
4
+that string in the order that they appear.
5 5
 
6 6
 For example, the string "49142" has the following 3-digit series:
7 7
 
8
-- 491
9
-- 914
10
-- 142
8
+- "491"
9
+- "914"
10
+- "142"
11 11
 
12 12
 And the following 4-digit series:
13 13
 
14
-- 4914
15
-- 9142
14
+- "4914"
15
+- "9142"
16 16
 
17 17
 And if you ask for a 6-digit series from a 5-digit string, you deserve
18 18
 whatever you get.

+ 5
- 3
exercises/sieve/README.md Просмотреть файл

@@ -5,8 +5,8 @@ number.
5 5
 
6 6
 The Sieve of Eratosthenes is a simple, ancient algorithm for finding all
7 7
 prime numbers up to any given limit. It does so by iteratively marking as
8
-composite (i.e. not prime) the multiples of each prime,
9
-starting with the multiples of 2.
8
+composite (i.e. not prime) the multiples of each prime, starting with the
9
+multiples of 2. It does not use any division or remainder operation.
10 10
 
11 11
 Create your range, starting at two and continuing up to and including the given limit. (i.e. [2, limit])
12 12
 
@@ -25,7 +25,9 @@ https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
25 25
 
26 26
 Notice that this is a very specific algorithm, and the tests don't check
27 27
 that you've implemented the algorithm, only that you've come up with the
28
-correct list of primes.
28
+correct list of primes. A good first test is to check that you do not use
29
+division or remainder operations (div, /, mod or % depending on the
30
+language).
29 31
 
30 32
 # Running the tests
31 33