J

James Shore

jamesshore.com · Personal blog · on HN since 2008

James Shore, a software developer and agile consultant, writes about testing, dependency injection, test-driven development, and agile practice.

What HN saysCommenters call his dependency injection post a favorite and a classic explanation of a simple concept behind a fancy term.
56HN people shared it
25linked it in comments
74stories submitted
1.0Kstory points
3 months agolast shared
2008people per year2026

Most-shared posts

  1. 1
    Dependency Injection (simple explanation)
    9 people · 7 points · first shared 2011 · 2 comments on HN
  2. 2
  3. 3
  4. 4
    Testing Without Mocks: A Pattern Language (2023)
    3 people · 92 points · first shared 2023 · 62 comments on HN
  5. 5
    Testing Without Mocks: A Pattern Language (2018)
    3 people · 57 points · first shared 2020 · 28 comments on HN
  6. 6
    James Shore: The Decline and Fall of Agile
    3 people · 25 points · first shared 2008 · 11 comments on HN
  7. 7
    Testing Without Mocks: A Pattern Language
    3 people · 7 points · first shared 2018 · 12 comments on HN
  8. 8
    Testing Without Mocks: A Pattern Language
    3 people · 3 points · first shared 2022 · discussion on HN
  9. 9
  10. 10
    The Problem with Dependency Injection Frameworks
    3 people · 1 points · first shared 2023 · discussion on HN
  11. 11
    TDD Lunch and Learn
    3 people · 1 points · first shared 2022 · discussion on HN
  12. 12
    What Is Agile?
    2 people · 5 points · first shared 2020 · 1 comments on HN
  13. 13
  14. 14
  15. 15
    The Art Of Incremental Design
    2 people · 2 points · first shared 2010 · discussion on HN

What HN people wrote when they linked it

jdlshore · 2012-05-08
I love the idea, and when I created a search engine for http://jamesshore.com, it complained that the web page doesn't exist. Ditto for http://www.jamesshore.com. Trying again colored the "Name" field red without any indication of what was happening. After poking around a bit more, it looks like my search engine was created. But when I click it, I get an error message: "You have not created any DocumentTypes in James Shore yet. Please use the API to get started." This is despite selecting the "Crawler" option when creating the engine. Also, deleting an engine asks me to confirm, but then doesn't actually appear to delete it. I want to love this tool, so I'm looking forward to when these growing pains are resolved. Edit: A third attempt appears to have worked. I'm guessing you're seeing a lot of load, and your code isn't handling timeout errors well?
thunderbong · 2019-10-31
This is my favourite explanation on dependency injection - https://www.jamesshore.com/Blog/Dependency-Injection-Demystified.html From the article - The Really Short Version Dependency injection means giving an object its instance variables. Really. That's it.
leostatic · 2015-06-06
I just started off in a very young startup and we will be a building a team now. So this was my concern too. I started reading Peopleware by Tom DeMarco and Tim Lister, and I'm 1/3rd in it. Highly recommended. I also found this series of articles about a real person's real experience while trying to improve things in his company to be pretty interesting. http://www.jamesshore.com/Change-Diary/
arethuza · 2013-06-27
In a stackoverflow thread I found a reference to this classic: '"Dependency Injection" is a 25-dollar term for a 5-cent concept.' http://www.jamesshore.com/Blog/Dependency-Injection-Demystified.html I do think it is a useful concept - but I sometimes think it gets a bit blown out of proportion.
adrianhoward · 2013-03-20
There's more to Agile than Scrum. And there's more to Scrum than Scott's saying. Ah good - somebody else go there first ;-) To James' link I'd add reading the Agile Manifesto values (http://agilemanifesto.org/) and principles (http://agilemanifesto.org/principles.html - everybody forgets the principles). If folk want to learn a bit more about Scrum the Scrum Guide is a nice summary and not that much longer than Scott's mild oversimplification (http://www.scrum.org/Scrum-Guides). (And since he's too polite to pimp it himself - James' book co-authored with Shane Warden is one of the ones I recommend to folk wanting to learn about agile http://www.jamesshore.com/Agile-Book/ - well worth a read if you're interested).
swanson · 2012-10-31
James Shore's Lets Play TDD (http://www.jamesshore.com/Blog/Lets-Play) is an excellent video series that has the perfect pace and level of depth for a beginner. James Shore is also doing a Javascript series (it was a kickstart project, http://www.letscodejavascript.com/) Specifically regarding your question of knowing where to draw the line, there is never going to be definitive answer. That is one of those questions that changes frequently based on your specific project and codebase, but overtime you get a sense of where those lines generally are. My advice would be to watch the first few videos, then start trying to do TDD on a small project.
rsanheim · 2025-04-14
It isn't a matter of trust, its a matter of developers are humans. Humans make mistakes, and continuous integration helps catch mistakes. I've been coding for 25+ years, and I sometimes I forget to remove debug output, or I forget to update an explicit exception I threw somewhere, or I forget to make sure dependencies build across all the platforms we need. Running your build a second machine helps to catch a lot of those mistakes. It also helps enforce automation and good configuration practices and lint/formatting standards and all that, but fundamentally its helps us because humans make mistakes. CI doesn't have to mean setting up a 12 step pipeline in GH actions with 3k lines of yaml and crazy triggers and workflows. It can just be an old dev machine (https://www.jamesshore.com/v2/blog/2006/continuous-integration-on-a-do… that pulls the latest code, runs `script/build`, and POSTs results somewhere. Maybe local signoff works for 37signals, if so, thats great. But it isn't continuous integration.
still_grokking · 2023-06-04
No, it isn't. The benefit that some code (maybe) provides is an asset. The code as such is strictly not. Nobody would even look at your code if you don't compensate them with some benefits. Exactly that's why nobody touches random "free code" even with a ten foot pole if there aren't very strong reasons to do so. If you could have the benefits without the code any sane person would prefer that. Code is just cost. You don't want code as such as already just owning it has steadily increasing costs. You just want the benefits out of it. If there's a solutions to a problem where writing new code can be avoided this is almost in any case the cheapest and most preferable solution. Only junior devs think code has value. But the truth is you get more value if you're senior skilled and smart enough to avoid wasting your time on writing (more) code. Code is a means to an end, not a means in itself! Given that, the best approximate measure of technical dept (and with it security issues, bugs, and in the end of the day cost) is: Lines of code! https://www.jamesshore.com/v2/blog/2008/an-approximate-measure-of-tech… Now, a smart and really helpful AI for programmers would try very hard to achieve the stated goals but delete on it's way as much code as possible. Because that's the only way to lower cost in the long run and keep things maintainable. Any AI that does the opposite, and just creates mostly completely mindless piles of more and more code, is like an oven…
_audakel · 2016-06-13
Beign at either extreme, moving too fast or moving too slow, is problematic. A related field to medical is the Space + Rocket industry. Heavily regulated and if you make a mistake people die. For much of the lifetime of the industry, NASA was the best there was. They embraced a "zero bug" mentality (http://www.jamesshore.com/Agile-Book/no_bugs.html). It resulted in very slow and costly development and we accepted that as the way things where, ie very expensive and little progress. SpaceX came in with a move fast and break things mentality. They did not approach this in the way that had always been done (move slow and make no mistakes). They have greatly reduced cost and increased capability to a level that arguably would never have been reached by NASA, all without loss of life. We don't need to test or develop medical in a haphazard way, but do have to accept that the way things work currently will not result many advancements (at least not rapid advancements). FDA regulations are fine until you realize that you have a currently incurable medial condition, and wonder if medical innovation was easier if you would have a cure. Is the regulation to ease fear of a potential death/injury worth the many real deaths of people who we do not have treatments for?
nilliams · 2014-10-25
What you just wrote as a code example is Dependency Injection, it's just manual dependency injection as opposed to using an IOC container or any of the mechanisms Angular provides. I am very much in favour of the approach you posted. That's exactly how I write my code (I don't currently use Angular), but yep ... that's DI. As James Shore said 'Dependency Injection is a 25-dollar term for a 5-cent concept'. [1]. What you show in that code example is what in my head I call "poor man's DI" or ... "passing stuff in" but it's actually my favourite kind as it demonstrates the fundamental idea and is easy to explain to people - as soon as you start talking about IOC and service providers things start to get murkier. I think that's definitely where Angular is losing some people. You can get a long way with the basic "poor man's" approach. [1] http://www.jamesshore.com/Blog/Dependency-Injection-Demystified.html
akoboldfrying · 2026-08-07
I think the "taste" described here actually can be formulated as a measurable quantity, just one that can't be accurately measured in practice. According to James Shore's 2006 essay "Quality With a Name" [0], "good design" amounts to nothing more or less than minimising the expected engineering time needed to create a good enough product over the space of changes that are likely to be needed during its lifetime (I'm paraphrasing slightly). Realising this was a revelation to me. I would argue that OP's "taste" is Shore's "good design". This conclusion may be unwelcome here, since it implies that AI can acquire "taste". [0]: https://www.jamesshore.com/Articles/Quality-With-a-Name.html
munchlax · 2025-10-10
If you have a class whose constructor depends on an instance of something else, you can instantiate that first and pass it on. That's all there's to it. You can do DI in your own startup code and have some logic in there that substitutes mocks when running under test. Or you could change the logging when debug is enabled. Hardly rocket science. If you can write code, you can write the startup code. If your team likes patterns, dont mention dependency injection unless you're confident it wont get replaced with the framework of the day. See https://www.jamesshore.com/v2/blog/2023/the-problem-with-dependency-in… Frameworks turn your DI code into highly complicated configuration. The end result is a giant lump of code whose only achievement is hiding the new operator and possibly also someones job security.
loevborg · 2025-05-25
Why is it a pain to inject dependencies manually? I think this is because people assume for some reason that a class isn't allowed to instantiate its own dependencies. If you lift that assumption, the problem kind of goes away. James Shore calls this Parameterless Instantiation: https://www.jamesshore.com/v2/projects/nullables/testing-without-mocks… It means that in most cases, you just call a static factory method like create() rather than the constructor. This method will default to using Instance.now() but also gives you a way to provide your own now() for tests (or other non-standard situations). At the top of the call stack, you call App.create() and boom - you have a whole tree of dependencies.
john-tells-all · 2025-03-29
the author also wrote: A Light Introduction to Nullables https://www.jamesshore.com/v2/projects/nullables/a-light-introduction-…
philbo · 2025-01-13
The clickable link is in the right margin just underneath the (first) QR code image: https://www.jamesshore.com/v2/blog/2024/update-on-software-engineering…
turtleyacht · 2024-07-20
There was a comment on HN where each feature was implemented in a fresh folder. Since then, I had always wanted elaboration on that. For me, the name to look for now is "vertical slicing." This also reminds me of James Shore's nullables [1], where infra and logging are also unit-testable. Having a slice for each feature could help evolve the system organically as patterns emerge over time. Combined with that, a recent post on database design [2]. [1] https://www.jamesshore.com/v2/courses/testing-without-mocks [2] https://news.ycombinator.com/item?id=41013519
angersock · 2016-10-23
I'm unfamiliar with whatever recent chatter on "primitive obsession" there's been, but it's not a new idea ( http://www.jamesshore.com/Blog/PrimitiveObsession.html ) and has been discussed elsewhere ( http://wiki.c2.com/?PrimitiveObsession ). Frankly, while I do see the point about fixing it with value objects and whatnot, I rather think that is a sign of wannabe architect/PL wankery. Javascript has a basically useless type system in practice (especially with legacy code) and has a lot of really handy/flexible features that would only interact badly with attempts to fix this "primitive obsession" stuff. I don't think it matters in the JS ecosystem.
ktRolster · 2016-10-16
I've posted this before, but it teaches how to get to that point: http://www.jamesshore.com/Agile-Book/estimating.html Most teams fail because management uses estimates as a way to get underlings to work harder. When that happens, estimates will never be accurate.
rrrx3 · 2015-12-29
You have renamed "Design Debt," as outlined here back in 2004 by James Shore: http://www.jamesshore.com/Articles/Business/Software%20Profitability%2… Design Debt is not a new concept. It is a common cause of product failure. Taken from the link above: "'Design debt' explains the problem. When a team is working under pressure, they take shortcuts that compromise design quality. It's like taking out a high-interest loan. The team gets a short-term boost in speed, but from that point forward, changes are more expensive: they're paying interest on the loan. The only way to stop paying interest is to pay back the loan's principle and fix the design shortcuts."
i0nutzb · 2015-05-03
In order to do efficient TDD, you need to be fairly familiar with the SOLID principles. I saw at least one book on O'reilly about TDD-ing in Python, but I can't really tell how good they are, since I don't do Py myself: http://chimera.labs.oreilly.com/books/1234000000754 However, if you are willing to invest few hours for watching TDD in other languages, I could recommend you these stuff: 1) https://code.tutsplus.com/courses/solid-design-patterns 2) http://www.jamesshore.com/Blog/Lets-Play 3) Clean Coders Series ( http://cleancoders.com/ ) - there are only few episodes strictly on TDD, but there are a lot of how and why on design patterns, principles and so on. (I'm doing PHP/JS, but I found Clean Coders - mostly Java - very helpful) I just found this: https://code.tutsplus.com/tutorials/beginning-test-driven-development-…
ayers · 2013-06-17
As you found out, changing a company from the inside can be very difficult. James Shore wrote about his experience when he tried to do this and it is a very interesting read. http://www.jamesshore.com/Change-Diary/
lazydon · 2013-05-01
Huh! are people still stuck on this? Yet another post that justifies this comment[1] James Shore made about 7 years back: "Dependency Injection is a 25-dollar term for a 5-cent concept" [1]: http://www.jamesshore.com/Blog/Dependency-Injection-Demystified.html
neilk · 2013-04-03
> Empirically Citation needed. There are studies out there showing that productivity is proportional to days spent on the problem, not hours. It's likely that for a knowledge worker, sustained schedules with long workdays actually reduce average productivity. http://www.jamesshore.com/Articles/Business/Software%20Profitability%2… There may be some exceptional people who can defy this rule, and it's possible they are concentrated in startups, but I'm dubious.
rednosehacker · 2020-08-28
Hey Normille, I am glad you asked ! "Genuine question. I've read so many times about why I should practice TDD that I believe it in theory. But I've never seen a beginner's example that has actually seemed like it would provide the claimed benefits." You need to find ressources to show you. I think when you see a thousands lines long codebase (divided in modules, classes, files, ...) with a test suite which fail immediately when a feature - you are not even working on so you where not meant to test immediately - breaks because of your current refactoring you thought was cool... Voila! "Why is writing a test that takes one single specified input and checks for one single specified output "better" than just writing my code and then trying to break it by [metaphorically] hitting the "Do Not Press!" button, by throwing as much incorrect, malformed or otherwise "wrong" data at it, as possible. " Did you see the test to fail before you write your code ? Maybe you don't need to write it haha. Maybe your test don't fail for the good reason. If you don't write your test before to see it to fail for the good reason, how are you sure you write code to actually do what it is supposed to ? To me learning TDD is like learning martial art (I talk about my own experience haha). You need to practice. Some say it need discipline to stick to it enough, sometimes you are not convinced but you just push the experiment a bit further and there you get it ! Maybe you like to read, to watch,…

Keyboard shortcuts

/Search
j kNext / previous blog
EnterOpen selected blog
vVisit the blog site
fFollow / unfollow
lSwitch grid / list view
dSwitch dark mode
g hHome
g pTop posts
g tTopics
g fFollowing
g lLiked
g yHistory
g qFAQ
EscBack / close