518 karma · joined October 11, 2012
We can argue about what granularity they should be, talk about functional programming, debate whether they should hit the database or not, but IMO all of those things miss the point. For me, in order of priority, unit tests provide the following benefits:
1) Make me write better, more decoupled code
2) Serve as documentation as to the intent of the code, and provide some expected use cases
3) Validate the code works as expected, (especially when "refactoring", which is basically how I write all my code even from the start)
4) Help you when deleting code by exposing unexpected dependencies
You can argue against all of those points, and I often will, myself. It depends on the scale, importance, and lifetime of the project as to whether I will write unit tests. But, as soon as I think someone else will work on the code, I will almost always provide unit tests. In that scenario, they:
- Provide a way to quickly validate setup and installation was correct and the application functions
- Signal that the code was "curated" in some way. Someone cared enough to setup the test environment and write some tests, and that gives me a certain comfort in proceeding to work on the code.
- Provide a gateway into understanding why the application exists, and what some of the implementation details are.
So, thinking about the advantages I've outlined above, for me it would be very hard to say I don't "believe" in unit tests. I just don't always use them.
Given that there would probably be more complexity in the real code I would create separate functions expressing the rules for each employee type.
* Very happy with the output. This is my favourite code search now.
* Can you update the cache GUID in the URL before the answer is fully rendered? Rendering can take a long time to finish and I often have what I need before it's done and want to share.
* The copy to clipboard button often fails to register clicks. I find myself clicking all over it and long clicking to try to get it to register.
* It's not clear to me what constitutes a "session". It would be nice to be able to both define a new session whenever I want, and to share an entire session with one URL.
* It would be nice to be able to name sessions.
* On my monitor the top right corner is empty (above SOURCES), and thus the content in the scrollable question textarea is forced to scroll more than it should if it extended full width.
* Under SOURCES, one of the URLS had a green plus sign at the end of it. It's not clear what that means.
* A thought: A lot of my questions are for the same domain (language/framework/hosting context, etc.). It would be nice to be able to save domain information and be able to select it, so it would automatically get added to each question instead of having to type it out over and over. Maybe this gets tied to a session.
Thanks for a great product!
This is non-obvious, but great! It would be nice to have a share button to copy the URL. The querystring param cache= makes me think the permalink may not be forever. Do you plan to keep the cache indefinitely?
I would love to see this as a data type (CalendarDate) baked into languages & databases which would prevent you from applying timezone conversions to it.