curriculum icon indicating copy to clipboard operation
curriculum copied to clipboard

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

Open vespucchi opened this issue 1 year ago • 6 comments

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

vespucchi avatar Jul 07 '24 18:07 vespucchi

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 .

incandesc3nce avatar Jul 08 '24 16:07 incandesc3nce

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.

mao-sz avatar Jul 13 '24 11:07 mao-sz

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

mao-sz avatar Aug 03 '24 15:08 mao-sz

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

JackBogart avatar Sep 02 '24 23:09 JackBogart

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

yousufaltayeb avatar Oct 01 '24 15:10 yousufaltayeb

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.

JackBogart avatar Oct 08 '24 20:10 JackBogart

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.

cyphersept avatar Nov 02 '24 19:11 cyphersept

@TheOdinProject/javascript Thoughts please.

CouchofTomato avatar Nov 04 '24 21:11 CouchofTomato

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

hoomanhorsey avatar Nov 13 '24 10:11 hoomanhorsey

This issue is stale because it has had no activity for the last 30 days.

github-actions[bot] avatar Dec 14 '24 02:12 github-actions[bot]

After reviewing the article, I think it can probably just be removed.

I agree that it is complex and honestly think it's out of scope for what a jr level developer really needs to know. I also don't see any key points in it that seem essential and aren't already covered otherwise in the curriculum.

wise-king-sullyman avatar Sep 27 '25 16:09 wise-king-sullyman

Mind if I take this on?

ZackHoang avatar Oct 10 '25 00:10 ZackHoang

This issue is stale because it has had no activity for the last 30 days.

github-actions[bot] avatar Nov 09 '25 02:11 github-actions[bot]

Mind if I take this on?

@ZackHoang Still interested in taking it? I'll assign you if you want it.

JoshDevHub avatar Nov 21 '25 18:11 JoshDevHub

Mind if I take this on?

@ZackHoang Still interested in taking it? I'll assign you if you want it.

Yes please!

ZackHoang avatar Nov 21 '25 18:11 ZackHoang

@ZackHoang Done. Let us know if you have any questions.

JoshDevHub avatar Nov 21 '25 19:11 JoshDevHub