TheOdinProject / curriculum

The open curriculum for learning web development
https://www.theodinproject.com/
Other
10.11k stars 13.53k forks source link

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

Open vespucchi opened 4 months ago

vespucchi commented 4 months ago

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 commented 4 months ago

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 commented 4 months ago

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 commented 3 months ago

@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 commented 2 months ago

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:

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 commented 1 month ago

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

JackBogart commented 1 month ago

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 commented 1 week ago

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.

CouchofTomato commented 1 week ago

@TheOdinProject/javascript Thoughts please.

hoomanhorsey commented 2 days ago

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