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

Add introduction #117

Merged
merged 24 commits into from
Jan 2, 2021
Merged

Add introduction #117

merged 24 commits into from
Jan 2, 2021

Conversation

simonsan
Copy link
Collaborator

@simonsan simonsan commented Jan 1, 2021

Reviving the ghost PR #43

Regarding functional and refactoring folders:

Something that we might add to the issues:

I was thinking something similar to what exists in the patterns folder, probably with an altered template. So far my ideas are:

* `functional`
  
  * currying
  * higher-order functions
  * collections

* `refactoring`
  
  * refactoring from `unwrap` to `Result`
  * refactoring from `enum` to `Option`

Some point may still stand? Need to check.

2021-01-01 15_00_03-Window-Screenshot

Fixes #4

@simonsan simonsan added C-enhancement Category: Enhancements to content C-addition Category: Adding new content, something that didn't exist in the repository before S-review Status: A PR that is currently under review or where a review is the next step C-zombie Category: A PR/an Issue that might be still useful but was closed labels Jan 1, 2021
@simonsan simonsan mentioned this pull request Jan 1, 2021
refactoring/README.md Outdated Show resolved Hide resolved
patterns/README.md Outdated Show resolved Hide resolved
intro.md Outdated Show resolved Hide resolved
patterns/README.md Outdated Show resolved Hide resolved
patterns/README.md Outdated Show resolved Hide resolved
rust_rocks.md Outdated Show resolved Hide resolved
rust_rocks.md Outdated Show resolved Hide resolved
intro.md Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
anti_patterns/README.md Outdated Show resolved Hide resolved
simonsan and others added 3 commits January 2, 2021 10:48
Co-authored-by: Marco Ieni <11428655+MarcoIeni@users.noreply.github.com>
@simonsan simonsan merged commit de7519f into master Jan 2, 2021
@simonsan simonsan deleted the add-introduction branch January 2, 2021 11:15
@simonsan
Copy link
Collaborator Author

simonsan commented Jan 2, 2021

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".
Copy link
Contributor

@pickfire pickfire Jan 2, 2021

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?

Copy link
Collaborator

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).

Comment on lines +10 to +12
[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.
Copy link
Contributor

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.
Copy link
Contributor

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.

@simonsan
Copy link
Collaborator Author

simonsan commented Jan 2, 2021

@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.
Copy link
Contributor

@pickfire pickfire Jan 2, 2021

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?

Copy link
Collaborator

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 :)

@simonsan simonsan removed the S-review Status: A PR that is currently under review or where a review is the next step label Jan 2, 2021
@pickfire
Copy link
Contributor

pickfire commented Jan 3, 2021

@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! ;)

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.

@simonsan
Copy link
Collaborator Author

simonsan commented Jan 3, 2021

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.

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.

@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.

I think this is a good collection of what happened and an actual status:
https://www.reddit.com/r/rust/comments/kowtqn/rust_design_patterns_now_also_as_a_book/

Cheers ;-)

@MarcoIeni
Copy link
Collaborator

MarcoIeni commented Jan 3, 2021

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!
Right now I'm overwhelmed by github notifications, so any help is HIGHLY appreciated! :)

Me and simonsan requested maintainer rights in #107 by the way

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-addition Category: Adding new content, something that didn't exist in the repository before C-enhancement Category: Enhancements to content C-zombie Category: A PR/an Issue that might be still useful but was closed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduction is empty
3 participants