1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
//! # Danger in Java; Errors in Rust; and arrogant Android

/// # Java should be banned from universities
///
/// _To sum up, Java also should be banned from the technology industry._
///
/// ## Contracts
///
/// When 2 people work together on a common subject, they agree upon a contract. Break this contract and everything fails.
///
/// In its nature, Java provides tools and encourages developers to break contracts.
///
/// For example, if you're a teacher or a university professor who teaches Java. Could you tell what is wrong with this code?
///
/// ```java
/// public class Program {
///
///     public static void main(String... args) {
///         System.out.println("Hello World");
///     }
///
/// }
/// ```
///
/// Of course, nothing is wrong. Now let's use some external code:
///
/// ```java
/// import big.enterprise.Api;
///
/// public class Program {
///
///     public static void main(String... args) {
///         System.out.println(Api.hello_world());
///     }
///
/// }
/// ```
///
/// We agree to this contract here:
///
/// - It calls a static method from an external API.
/// - It's compiled successfully.
///
/// Now, don't cheat by scrolling down to the answer below. But, look at above code and think. In 30 seconds, could you tell what is wrong?
///
/// Ready. Go!
///
/// - `1`
/// - `2`
/// - `3`
/// - `4`
/// - `5`
/// - `6`
/// - `7`
/// - `8`
/// - `9`
/// - `10`
/// - `11`
/// - `12`
/// - `13`
/// - `14`
/// - `15`
/// - `16`
/// - `17`
/// - `18`
/// - `19`
/// - `20`
/// - `21`
/// - `22`
/// - `23`
/// - `24`
/// - `25`
/// - `26`
/// - `27`
/// - `28`
/// - `29`
/// - `30`
///
/// The answer: it forgot to catch `RuntimeException`.
///
/// ## `java.lang.RuntimeException`
///
/// 1. **First of all, to use anything, you have to import.**
///
///     For example:
///
///     ```java
///     import java.util.Locale;
///     ```
///
///     But, except for things stayed inside `java.lang` package: you don't have to explicitly import them.
///
/// 2. **Second, `RuntimeException` is destructive**
///
///     That exception is unrecoverable. When thrown, it crashes the running process. Throwing a `RuntimeException` (or its subclasses) is
///     _**not**_ required to be declared in method signature. That simply breaks any contract between two Java partners.
///
/// 3. **Third: `java.lang.RuntimeException`**
///
///     Means:
///
///     - Out of the box, Java provides developers a most convenient way to use it.
///     - Java encourages developers to use it.
///
///     For instance, here is a list of its subclasses: <https://docs.oracle.com/javase/10/docs/api/java/lang/RuntimeException.html>
///
///     There are over 80+ built-in runtime exceptions. Beside, there are `n+` runtime exceptions developed by third parties; where `n` is an
///     unsigned integer value.
///
/// ## Java 2
///
/// There won't be Java 2. They're afraid of breaking changes.
///
/// Ironic. Changes are much less dangerous than the language design.
///
/// ## To sum up
///
/// Java, in its nature, breaks its own contracts inside, by:
///
/// - Allowing developers to throw runtime exceptions.
/// - Providing developers most convenient way to throw runtime exceptions.
/// - Encouraging developers to use runtime exceptions.
///
/// Hence, I declare:
///
/// - Java should be banned from universities.
/// - Java should be banned from the technology industry.
///
/// I predict the language will fade out and decay; with the condition that developers see how dangerous its design is.
pub const _30_: () = ();

/// # Errors in Rust
///
/// ## Java/Ruby
///
/// Before Rust, I've coded Java and Ruby. Both languages allow developers to throw exceptions at will. I would prefer the word _"encourage"_
/// over _"allow"_, just to emphasize the use of throwing exceptions.
///
/// That would become a problem. Big and tough.
///
/// You can get exceptions thrown at, while using official API libraries provided by "enterprises". All the time. I mean the "enterprises" can
/// throw official exceptions at you, all the time. The official documentation often is a joke. When that happens, you know you're officially
/// dead. Ha-ha.
///
/// Here comes my rant to those enterprise developers, encoded via `sha1sum`: `d71a0df4e85066445a0ed0f4fe9b5b06dd681a20`. I'm sorry to readers,
/// if you're not one of those "enterprise developers", please ignore my rant.
///
/// ## Rust
///
/// Now in Rust, developers can call `panic!()`, or `::unwrap()`. But that is considered [bad practice][book:09-03]. Even if developers like to
/// call those functions, at least, Rust does limit the numbers of "exceptions" to a very small set. It's much more easier to audit the source
/// code.
///
/// Rust encourages developers to use [`Result<T, E>`][std::result::Result] instead. In my experiences, this helps me write better code.
///
/// One thing that's different: stack-trace.
///
/// While handling exceptions in Java, I can print the stack-trace to stderr. It's useful. But in Rust, as far as I know, there's no way to
/// obtain a similar "stack-trace", unless you crash your handling code yourself. So I reverted to using the error messages. I put the path to
/// the messages like this:
///
/// ```ignore
/// ...
/// match this_function() {
///     Ok(_) => (),
///     Err(err) => eprintln!("this::module::at::this_function() -> {}", &err),
/// };
/// ```
///
/// Tiny text, but turned out it helped _a lot_.
///
/// ---
///
/// Final words, I sincerely hope Rust developers come to prefer `Result<T, E>` over `panic!()` or `::unwrap()`. I go first, in case you use
/// one of my crates: it's a guarantee that there are no panics. In return, it would be great if you do the same  `:-)`
///
/// Thanks,
///
/// [book:09-03]: https://doc.rust-lang.org/book/second-edition/ch09-03-to-panic-or-not-to-panic.html
/// [std::result::Result]: https://doc.rust-lang.org/std/result/enum.Result.html
pub const _26_: () = ();

/// # Crawling the whole `crates.io`
///
/// ---
///
/// If I make a program, I would crawl the entire [crates.io], if necessary.
///
/// ---
///
/// If I make a library crate, I would:
///
/// - Open [VS Code][vscode].
/// - Code.
///
/// By the way, for API surface of that library crate:
///
/// - [`std::error`][std::error] is enough. I would not try to invent new errors. I think I should not scare myself years later. When debugging
///   a program, I would want to read the error messages, not the error struct names (or enum names...)
///
/// - I would not make confusable pairs of names such as:
///
///     + `Serialize`, `Serializer` (that's an `r` difference at the end).
///     + And then duplicate them with a same prefix: `Deserialize`, `Deserializer` (those are a same `De` prefix, and an `r` difference at the
///       end).
///     + And then not rename them because I would be afraid to go from `1.x.x` to `2.x.x`.
///     + ... It's because when my 6th cup of coffee of the day doesn't affect my head anymore, my eyes seem to be able to bend the light. And
///       the `r` at the end is not in that light.
///
/// When I got stuck, I looked up for a while. My girlfriend thought I was contacting aliens. Haha. She was right. It took a while, because, you
/// know, light is not that fast.
///
/// When I got the signals back from my Saturnian partner, I looked back at the screen and resumed coding.
///
/// That was simple.
///
/// [crates.io]: https://crates.io
/// [vscode]: https://github.com/Microsoft/vscode/
/// [std::error]: https://doc.rust-lang.org/std/error/index.html
pub const _19_: () = ();

/// # Android is an arrogant OS
///
/// ---
///
/// Android designers are arrogant.
///
/// The whole company is just a Logan Paul clone. It's simply _hot_. Some newly graduated applying to it is same as why the Logangs exist. The
/// result? A generation of arrogant so-called "developers".
///
/// No one can prevent it from falling down. Except...
///
/// Except when Logan disappears from the crowd, goes to a temple, becomes a monk. That will save the company.
pub const _05_: () = ();