Skip to content

Commit

Permalink
Merge pull request #151 from jetbrains-academy/stephen-hero-patch-7
Browse files Browse the repository at this point in the history
Update task.md
  • Loading branch information
nbirillo authored Dec 25, 2023
2 parents 45b880c + 7fe5529 commit bb4d761
Showing 1 changed file with 14 additions and 14 deletions.
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

0 comments on commit bb4d761

Please sign in to comment.