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

More Testing: Mocking is a Code Smell article is way too advanced #28355

Open
2 of 3 tasks
vespucchi opened this issue Jul 7, 2024 · 9 comments
Open
2 of 3 tasks

More Testing: Mocking is a Code Smell article is way too advanced #28355

vespucchi opened this issue Jul 7, 2024 · 9 comments

Comments

@vespucchi
Copy link

vespucchi commented Jul 7, 2024

Checks

Describe your suggestion

I'm giving you my point of view as a beginner. This article is way too advanced, terminology used is nowhere to be found in previous lessons which wouldn't be a problem if it was only few terms and not whole (very long) article. Reading it feels like opening a book in the middle of it with no context provided and trying to understand what's going on. Also the jump from FunFunFunctions mock video to this article is night and day difference. I also struggled with some previous lessons but always knew where I was lacking so it was relatively easy to google it. This lesson I don't even know where to start, finding a course on this topic is my only option seems like. I wonder if others struggle as well or is it just me, feel free to discuss.

Path

Node / JS

Lesson Url

https://www.theodinproject.com/lessons/node-path-javascript-more-testing

(Optional) Discord Name

vespucci

(Optional) Additional Comments

No response

@incandesc3nce
Copy link

Agreed, the article felt like a really hard read and overly complicated for those not yet familiar with React and Redux. But I think the article should stay, it gives some insight and tries to teach good coding techniques. Simply stating "glance through the article" and saying "it will have unknown terminology, but it is a good read" would be enough in my opinion. Maybe place it into additional resources .

@MaoShizhong
Copy link
Contributor

I would not be opposed to moving the article in question to Additional Resources if someone can find a replacement that goes through the same core concepts, but presents them in a way that's more in line with the flow of the assignments. So there's less of a night/day jump in complexity, while retaining the core concepts discussed.

@MaoShizhong
Copy link
Contributor

@TheOdinProject/javascript Any differing/additional thoughts on the above? Whether the assignment step itself could be moved to the AR section, or whether we only want to do so if we can get a replacement resource that goes through the same general concept in a more lesson-appropriate manner, or otherwise?

@JackBogart
Copy link
Contributor

JackBogart commented Sep 2, 2024

Bumping this up as I just made an issue on this, missed this when I went through the active issues! My original write up was in #28735 .

To summarize my points were:

  • This article is way too advanced
  • The idea it's trying to convey isn't that complicated and could maybe be added to the lesson rather than being replaced by a different resource
  • That idea being (rough summary): "too many mocks can be a sign of code smell as everything might be tightly coupled if you need to mock often"

From doing a little research it seems like this isn't an uncommon concern. If you go in the discord and search Mocking is a Code Smell, you get many users bringing up valid concerns about the difficulty of this article.

I think a really good quote from the article that summarizes the main ideas from the article that the lesson wants to teach users is: 'Can the unit be tested without mocking dependencies? If it can’t, it’s tightly coupled to the mocked dependencies.'.

@YousifTheKind
Copy link

If there aren't articles to replace this one, perhaps it could be written in-house?

@JackBogart
Copy link
Contributor

If there aren't articles to replace this one, perhaps it could be written in-house?

Agreed. I didn't suggest this myself as I imagine in-house lessons are a larger undertaking but with something as important as TDD/testing, it might be nice.

@cyphersept
Copy link
Contributor

The lesson is very vague about what the "several really good points about program architecture and testing" from the article are. Any replacement material needs to be able to address those "several really good points" to a roughly equivalent quality.

Piggybacking off of this discord discussion I'd summarize the points as:

  1. If testing is making coding harder, not simpler, then you’re doing TDD wrong
  2. Tests provide diminishing returns, with increasing clutter
  3. What causes tight coupling, and how to avoid it
  4. What are pure functions, and why they're ideal for testing
  5. Code smell can tell you that there might be something wrong with your code
  6. When is a mock bad

I submitted #29040 to discuss introducing 5 earlier in the curriculum in more accessible material, 4 is already addressed in the article linked in the pure functions section (which should probably get moved down to assignments), and 6 is already covered in the assignments via the FunFunFunction videos but tbh at this point a lesson on how to actually use mocking is probably more valuable than one telling you when not to use a feature you probably weren't going to use. So a replacement resource only needs to address 1-3.

  • https://www.designite-tools.com/blog/understanding-testability-test-smells addresses only 1 and 3, but I really like this because it focuses on writing code that's easy to test, which has no overlaps with any other material other than the article to be replaced, and it's concise.
  • TDD, Where Did It All Go Wrong talk by Ian Cooper comes highly recommended as a lesson on common TDD mistakes though I haven't watched it yet. It appears to cover all 3 and more, but it's an hour long video in a lesson that already has over an hour's worth of videos assigned. This article summarizes the contents.
  • https://shiftmag.dev/test-driven-development-fail-and-success-1118/ covers 1 and 3. This also addresses writing testable code, though with less clarity than the first source, but the benefit of this article is that it's presented within the context of problem-solving as a newcomer to TDD which probably makes the cases it talks about easier to spot and apply
  • Or we keep the original article, but specify what the "really good points" are and that the second half can be skipped.

@CouchofTomato
Copy link
Member

@TheOdinProject/javascript Thoughts please.

@hoomanhorsey
Copy link

Just chiming in as I just finished this article and also found it really overwhelming. Way over my head as a beginner. It was so in-depth I just skimmed and scrolled through the last half as I couldn't really make sense of any of it. .

On the quote:
"While it is quite in-depth, the following article contains several really good points about [program architecture and testing]"

it's particularly frustrating because the article is so overwhelming I honestly have no idea what the really good points are. I can imagine a seasoned programmer nodding their head along with the article with the points it raises. But not as a beginner.

Meanwhile, the fun fun function material always leaves me with a smile on my face! So accessible and beautifully presented and explained.

Anyway, I feel like it's already acknowledged that the article may not be pitched at the right level of students. But just wanted to add my feedback.

I do appreciate all the work that all of you put into this as well. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants