There have been a few of these articles lately, that push some variant of “don’t worry so much about writing good code, focus on testing when it is branded as TDD.” Is there some reason for this trend?
If I were to hazard a guess, it would probably be a lot of the Uncle Bob Martin viewpoint that TDD is the only way to build better software.
It is a dumb viewpoint that only TDD fixes things, but it has understandable roots from a certain perspective. Also before I get down voted for the last phrase, an explanation to why TDD doesn’t solve a lot on its own and can mostly be gamed to demonstrate competence (inspired from real life code):
return x * x
This is the most useless test ever, and all it did was increase test coverage. But it doesn’t do a damn thing about boundaries, what should happen with different types being passed into the function, what should/should not be allowed as types (something static type systems like Haskell/Idris/Ocaml get for free) etc…
This is not a useless test! Based on the syntax, I’m assuming the language is Python. There are no compile-time or run-time checks that this code will not throw an error until you actually execute it.
What does * do when applied to two strings? Maybe you meant +?
>>> "x" * "x"
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: can't multiply sequence by non-int of type 'str'
>>> "x" + "x"
These “useless tests” can be thought of as double-entry bookkeeping in accounting. Sure, you’re absolutely certain that the code you meant to write would work. But as demonstrated in your example, even a single line method can have unexpected bugs.
Yeah, meant +.
The only issue with this test is it really doesn’t do anything useful, my typo that i’m too lazy to fix aside, it doesn’t actually test anything of substance.
A bit better example in c, take a function that takes a uint8t and does a divide by 2 and also adds a uint8t that can exceed UINT8_MAX. Writing out all the unit tests in a TDD fashion for this is tedious at best, and as error prone as the code you write at worst. How do you handle overflow? Do you use saturating addition? How do you validate all values are right in this regime? etc…. TDD doesn’t help with the hard problems of logic here.
Property based tests here would be better, but I guess in the end I see TDD as promoted by most people as being equivalent to ∃ or ∄ versus ∀. This isn’t to discount TDD, but it is at best a step towards better software. I’d argue it is a very small step compared to things like theorem provers and dependently typed languages.
These all need work as well to become mainstream but I feel much better with things like property based testing and dependent types, or even things like smt solvers with liquid haskell than I ever do with TDD. TDD is too much like ad hoc polymorphism with OO languages to me. I’d rather either use straight c structs or go all in with a more expressive type system.
I believe you are making their point for them. Writing tests for cases that can be systematically excluded by a type system is a waste of time, and no matter how hard you flail at it you’ll never do as good of a job covering those cases.
Type systems only guarantee that the input and output types are correct. They do not guarantee that the function does what you expected it to do.
That’s obvious. What is your point?
My reading of the example was that they 1) meant + instead of *, 2) were intending for foo to operate on integers, and 3) were showing an example of a useless test that checks the result of foo on strings, when that case would have been excluded by a type system.
People in this thread are missing the point:
That might be the point, but the point is unproven if the metric is not valid.
It’s not a huge burden to setup and maintain a self-hosted solution for any one service, but doing so for the 10-15 services I use would be a full time job.
Setting up self-hosted email for a residentially hosted domain is a pretty huge burden. In the US, you can’t just turn on a mail server on port 25, slap up some MX records, and expect to get email delivered to the server hanging at the end of your ISP’s modem. Even if your ISP hasn’t filtered out the standard email ports, most mail servers won’t talk directly to anything located in an ISP residential subscriber address block, and many upstream filters will either spambox or silently discard your mail if try to send it that way.
One typically ends working through the ISP to get outbound mail accepted through their local outbound servers, and then then still having to employ a third party (fourth party?) service to do authenticated relay for your domain.
Its doable (I do it) and its really nice to be able to set it all up the way you want it… but It costs money, its complex, and the details are different depending on your ISP and your relay provider so its not like there is a simple recipe for it. Even if you know what you are doing, setting up email is a burden. :‘/
I used to run my own, well, almost everything! (SMTP, XMPP, HTTP, CalDAV, etc.) But it was just more work, more money, and more hassle. But my migration choices were to providers without lock-in. (Fastmail, nfshost, etc.)
5 - Strongly agree
Relevant blog post about the package’s removal: https://medium.com/@azerbike/i-ve-just-liberated-my-modules-9045c06be67c
I have a folder in my Dropbox, and I sulking it to ~/Notes. I create/edit notes in any of:
ctrl+b n <start fuzzy finding notes>
This allows me to edit any note from anywhere, and doesn’t tie me in to any specific software. Each note is typically a Markdown file, but I have some others in there too, such as dot.
If I need to draw something, I love Rhodia dot-ruled notebooks, and any cheap #2 pencil with a sharp tip.
In response: http://amcaplan.ninja/blog/2015/11/18/formulating-the-ethics-of-programming/
I will take this opportunity to remind people that Lobsters stickers are also available (but not for free).
Is that 2.64 for one sticker?
So what? It’s an extremely offensive term on a publicly accessible part of their website. They have every right to remove it.
The comments by the lobsters community on this post are truly fucking dissapointing
Explain? It’s basically me and everyone else. I happen to disagree but I’m not disappointed by their comments. And as for me, well, I don’t think I qualify as the community.
I don’t know how a code of conduct can be seen as anything but a positive step for a community
This discussion has been tedu against pretty much everyone else, and while tedu is, shall we say, a weighty member of the lobste.rs community, he is hardly all or even an appreciable majority of it. I actually think this discussion has gone really well given how poorly discussions of codes of conduct have gone elsewhere on the Internet.
I would say most of the lobsters community agrees with you.
Excited to give this a try.
For those that use Vim, you can also use the conceal functionality to replace sequences with other symbols. Example: https://github.com/enomsg/vim-haskellConcealPlus
The original characters are shown when the cursor is on the line.
For emacs, one can use the display text property to show the utf8 characters instead of the sequences that’d normally be displayed (eg replacing -> with →)
I don’t know of any extensions off the top of my head that’d do all of the haskell ones in one shot, though I’m sure the community would appreciate it if there were one.
I just finished Programming Elixir by Dave Thomas, which is really week written. Also reading Understanding Computation by Tom Stuart for http://csbookclub.com.
This really excited me, so I bought the pro version, but it crashes the moment I sign in
I tried the free version and that worked. Love the layout on the today screen. The realtime number on the right is a nice touch.
Appreciate the feedback, and your patience! Let me know if you have any other suggestions or ideas.
I’m really sorry about that. It’s a bug that (I’m hoping) is fixed in a release I pushed out moments ago. Let me know if you still have issues.
Message me your email and I’ll send you a free promo code for the desktop version for your trouble!
Yeah, I’d like something like that, but for normal files on a system.
For space analysis, baobab is great.
I’ve been using jdiskreport for the last 10 years or so, it works a treat and it supports all main operating systems where the sun JVM runs
I appreciate the organization, but have you thought about just linking to pre-existing kata repositories rather than trying to bring them into one group?
They’re not katas per se, but repos to help you practice a kata. The person greeting is intentionally simple and vague so that it doesn’t lead you down a path.
If you can think of a way to make this intention clearer, I’d appreciate the feedback!
I took off until the new year to watch our baby. In between that, I plan on livecoding a bunch. Some stuff I plan to broadcast:
I’ll post when I’m broadcasting to http://twitter.com/justincampbell.
I’m also pairing with people on Fridays. If you want to pair, contact me on Twitter!
“This allows file names that contain newlines…” ಠ_ಠ
It’s entirely possible, and yeah, it’s a huge pain in the ass to deal with.
$ touch file$'\n'name
$ echo *
In fact, any byte other than null and slash are legal in filenames. It’s a safe bet that a significant majority of software doesn’t correctly handle every possible filename.