Show newer

@yisraeldov It's been a while since I did clojure but as I remember it, the REPL ran your tests. But I would agree just running your program in the REPL each time you save certainly doesn't constitute TDD :)

@yisraeldov Well, if you test first, you on'y need to really know the syntax of your test package... :) Since it is going to fail anyway, it might help you to get the syntax as well.

@freemo Here's the idea. A group of people gets together (well virtually)
1. Brainstorm a project
2. Design the project
3. Code the project
4. Release it to the wild
5. Start over

There is a little more to it, but that is the basic flow. Add whatever other fluff is involved in a club. :)

Okay folks, this should be simple, but maybe not.

The goal is to write a function that takes a positive integer and returns a list of its prime factors. So if you did 12 you should get the list [2, 2, 3]

As neither 1 nor zero are prime, as a result should return an empty list.

This is taken from a , so if you have not done this one I encourage you to do so. If you are not into then solve it however you like.

Is anyone interested in, or has anyone been a part of a programming or coding club?

@tomekw at work we have a very large code base and we use cxxtest (yes even for the C code) and I have used boost's tests for C++. There are quite a few out there. What have you tried?

@yisraeldov
One might posit that actually test_hello_world. should precede hello_world. :)

@sir googol or even googolplex? Both of them are pretty big not sure if any larger ones have names do they?

@sir so all you do is first line testing? I ran it, it worked. Let's ship it! :) Been there, done that.

No, I am not concerned with little green lights.

You and I have a problem of vernacular. When you say TDD and when I say TDD we are not talking about the same thing.

Like I said in the beginning, I am not interested in changing your mind or having an argument about it.

@sir making human beings do mindless repetitive tasks is immoral and akin to cruel and unusual punishment. A computer can do that better. There are testings that are suited to humans, let them do that, because computers are not quite up to that task. Right tool for the job. Sometimes that tool is a human.

@sir if you are doing TDD correctly, you are refactoring after each passed test in the process. If your code is constantly refactored to remove unnecessary complexity, then there is little to refactor later. It is a process. Work the steps. Save the world :)

@sir I disagree with that statement as well. But you are certainly entitled to that opinion.

@sir if you do TDD properly what you get in your unit tests is different than if you just write unit tests after the fact. You also get well refactored code earlier so there aren't the same needs for mass refactorings later. But there are plenty of need of TESTS besides unit tests. Functional tests, end to end tests, integration tests, regression tests. Untested code is immoral.

@GuerillaOntologist bees being bees. I think it is pretty. They will also do that if you don't have an inner cover and violate "bee space" between the cover and the top of the frames. <3/8" they fill it with propolis >3/8" they fill it with comb. :)

@sir True, because there is no way you could have 100% coverage with a single test!

Unit tests are useless if they are done wrong. If you don't have 100% coverage in well written and tested tests, then when they pass you know nothing. So they lend no confidence. If you have 100% coverage and they pass then you know you haven't broken anything.

@Wolf480pl@niu.moe @sir

Test First
Test Early
Test Often

Huzzah!

@sir I disagree. But I am not interested in changing your mind. :)

This is for python, but could be easily tweaked for any other development system.

Your suggestions and opinions are appreciated.

If you like to do code kata and you like to use Vim, here is a script that will create your 2 starter files (<kataname>.py and test_<kataname>.py)

#!/bin/sh
#
# kata, a script for starting up a new kata exercise
#
# Given a name for the kata the script will create 2
# files. One with the same name as the kata with '.py'
# extension added to the end and another named 'test_'
# followed by the kata name and '.py' extension. It will
# be opened in a 3 window layout of Vim with a vertical
# terminal to the left in which you can run 'pytest' or
# 'python -m unittest' or whatever appropriate runner
# you use.
#
# If these files don't alreay exist they will be created
# with an import , and basic docstrings.
#

if [ $# -eq 0 ]; then
printf "Usage:\n\t $0 <kataname>\n"
exit 0
fi

if [ ! -f "$1.py" ]; then
printf '"""%s module."""\n\n' "$1" > "$1.py"
fi

if [ ! -f "test_$1.py" ]; then
printf '"""Unit tests for %s module."""\n\n\n' "$1" > "test_$1.py"
printf 'import %s\n\n' "$1" >> "test_$1.py"
fi

vim -c ':vert topleft term' -c 'wincmd p' -o "$1.py" "test_$1.py"

TDD is awesome. is anyone out there using TDD? Anyone learning to use TDD? Do you want to?

Show older
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.