Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update task.md #151

Merged
merged 1 commit into from
Dec 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions aliasServer/aliasServerUtil/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,31 @@ If you have any difficulties, **hints will help you solve this task**.

### Hints

<div class="hint" title="Click me to learn about type aliases usage">
<div class="hint" title="Click me to learn about the usage of type aliases">

Sometimes, type aliases are used in cases where there is no certainty that
the type used will not be replaced in the future.
Sometimes, type aliases are used in cases where there is uncertainty that
the type being used will not be replaced in the future.

For example, right now, we use the `Int` type as the `Identifier`,
but in the future, we can create our own class.
Using a type alias in this case will help us make this change as painless as possible in the future.
For example, right now, we're using the `Int` type as the `Identifier`.
However, in the future, we may create our own class.
Using a type alias in this case can help us make such a change as seamless as possible in the future.
</div>

<div class="hint" title="Click me to learn more about access modifiers">

The property `counter` stores some internal information about the current state of the class instance.
So, the best way is to mark it as a private property to forbid access outside the class.
The `counter` property stores internal information about the current state of the class instance.
So, it's best to mark it as a private property to prevent access outside the class.

A simple example of why it is bad to use a `public` modifier here is that in such a
case, the user would be able to change the value of the `counter` property on their own
and we cannot guarantee its uniqueness.
A simple example of why it is bad to use a `public` modifier here is that, in such a
case, the user could independently change the value of the `counter` property,
compromising its uniqueness.
</div>

<div class="hint" title="Click me to learn about default values">

It is better to set the value `0` as the default value for the property `counter`.
It is better to set `0` as the default value for the `counter` property.
This makes it easier to create an instance of the class,
since you do not have to write the start value each time:
since you won't need to specify the starting value each time:

```kotlin
val id = IdentifierFactory(0)
Expand All @@ -57,7 +57,7 @@ Compare with:

</div>

<div class="hint" title="Click me to learn about short notation for functions">
<div class="hint" title="Click me to learn about the short notation used for functions">

Since the `uniqueIdentifier` function is so short, we can use the short notation:

Expand Down
Loading