-
Notifications
You must be signed in to change notification settings - Fork 374
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
Add introduction #117
Add introduction #117
Conversation
d1722cb
to
da179df
Compare
Co-authored-by: Marco Ieni <11428655+MarcoIeni@users.noreply.github.com>
Nice! |
|
||
The computer understands the machine code that is generated by the compiler. The language is therefore mostly beneficial to the developer. So, since we have this abstraction layer, why not put it to good use and make it simple? | ||
|
||
Remember the [KISS principle](https://en.wikipedia.org/wiki/KISS_principle): "Keep It Simple, Stupid". It claims that "most systems work best if they are kept simple rather than made complicated; therefore, simplicity should be a key goal in design, and unnecessary complexity should be avoided". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds like go to me. I feel like rust is aiming to be "keep it simple but not simpler".
Go is able to be simple by having tons of footguns as a result, simplicity matters more than correctness, it just aims to be correct enough.
Rust aims more to be correct than simple (this is why rust became so complicated), one good thing is that the footguns are reduced to bare minimum, this is what I believe how the API in rust is designed.
Maybe be should still mention that correctness should be valued before simplicity?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I strongly agree with you.
We can say something like:
"even if the kiss principle is important rust tends to prefer correctness over simplicity."
If you want to do a PR where you explain this it would be nice I think (you don't have to report my words necessarily).
[Design patterns](patterns/README.md) are methods to solve common problems when writing software. | ||
|
||
[Anti-patterns](anti_patterns/README.md) are methods to solve these same common problems. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feels like the same wordings, maybe we should let readers know what are the differences between them? "Anti-patterns" is a tough english word, we should have more descriptions.
|
||
If we apply YAGNI to design patterns, we see that the features of Rust allow us to throw out many patterns. For instance, there is no need for the [strategy pattern](https://en.wikipedia.org/wiki/Strategy_pattern) in Rust because we can just use [traits](https://doc.rust-lang.org/book/traits.html). | ||
|
||
TODO: Maybe include some code to illustrate the traits. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could remove this, I wonder if illustration is really needed here for understanding.
@pickfire It's hard to deal with that feedback in a closed and merged PR. What do you think about changing the things directly in these files to your liking and create a new PR where we can discuss about your proposed changes? Would make it much easier to follow for everyone I think. Happy new year! ;) |
@@ -1,5 +1,9 @@ | |||
# Newtype | |||
|
|||
Rust has strong static types. This can be very different than what you are used to if you are coming from a loosely-typed language. Don't worry, though. Once you get used to them, you'll find the types actually make your life easier. Why? Because you are making implicit assumptions explicit. | |||
|
|||
A really convenient application of the Rust type system is the Newtype pattern. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is Newtype pattern convenient? I think we should use a different word other than convenient or maybe we should explain why is it convenient. Or maybe we could just
An application of the Rust type system is the Newtype pattern.
Or maybe we should have a better question or a problem as the introduction?
What if in some cases we want to have a type to behave similarly but still different to another type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if in some cases we want to have a type to behave similarly but still different to another type?
I like this :)
Happy new year! I wish there is more time gap since I am interested to help review these too (of course only those that I am able to). I see that by the time I read it (within 1 or 2 day time) it was already merged. @simonsan How did you get to be the maintainer here? I remember that it wasn't active for a while and then you suddenly come and change. |
This PR was a ghost PR from October 2016, most of the PRs, beside the repository structure we are changing like setting up CI or creating a book, were relatively old PRs. We want to work down the list and create a great learning resource for the community with it because imho this is excellent content and it will get even better with more people participating in the future. The other left over PRs are much bigger topics than the ones that were merged, so there will be a timegap for sure. I'm thankful as well, if there are more eyes on it with reviews, please feel free to review them as well. The velocity will slow down soonish, as we handled most of the open PRs already.
I think this is a good collection of what happened and an actual status: Cheers ;-) |
Pickfire, feel free to leave a comment on a pr if you want to review it and we will wait for your review, even for different days, no problem! Me and simonsan requested maintainer rights in #107 by the way |
Reviving the ghost PR #43
Regarding
functional
andrefactoring
folders:Something that we might add to the
issues
:Some point may still stand? Need to check.
Fixes #4