I’ve worked in TDD/Agile teams in the J2EE world, and absolutely want to bring this and all the benefits it has for an open-source project to MODx. When I started xPDO development, I began with two test harnesses, one using SimpleTest (for PHP 4 testing) and one using PHPUnit (for PHP 5), but (as is typical) I got lazy and stopped following my ideal of doing true "test-first development".
I have lately heard a lot of good things about TDD/Agile, but have no experience of it myself and haven’t seen any good examples of it applied to PHP. What I was wondering if the core team has any thoughts about using TDD? I assume (purely guessing here) that it would be possible to do test cases for new enhancements and bugs which in turn should make it easier for contributing developers to know exactly in what way the contributions should work and what input/return values are expected... It would also be a good base for future documentation. If I have completely misunderstood TDD/Agile and if it isn’t as good as I’ve heard feel free to completely ignore this paragraph!
Letter "a" makes me sad Especially since it uses 4 bytes instead of 1, that adds up... [i](read: http://www.derkarl.org/why_to_tabs.html)[i]
I will publish the standards, but in general, the main rules will be:
a) 4 spaces per tab, no tabs period,
b) all files should have unix line endings, not mac or windows,
c) don’t reformat other people’s code; instead emulate the format they have used, and
d) don’t reformat code in check-ins where other changes are made; do them separately to reduce conflicts
I do apologize, but I’ve been in this holy war for over 8 years now, and heard just about every side of the story, but in my estimation, when the smoke clears, this quote sums up my justification for the choice.
Letter "a" makes me sad Especially since it uses 4 bytes instead of 1, that adds up... [i](read: http://www.derkarl.org/why_to_tabs.html)[i]
This has been discussed repeatedly, and the answer is "If you onlyAnd no, this isn’t Python, but the same issues apply regarding using various editors, some that are simply inept at dealing with the problem properly.
work alone, never use anyone else’s code and no one ever uses your
codes, then do as you please. Otherwise use tab-is-4-spaces."
When you do Agile Programming with people using emacs, vim, nedit,
xedit, wordpad, eclipse, and who knows what else, the 4-spaces rule is
necessary for survival.
The reason is simple: People get confused, and accidentally get the
wrong tab indents when they move among editors or among settings on
the same editor. In most languages this is an irritation, requiring
some cleanup. In Python it is a disaster requiring re-inventing the
coded algorithms.
Quote from: OpenGeek at Jan 24, 2008, 04:22 PMLetter "a" makes me sad Especially since it uses 4 bytes instead of 1, that adds up... [i](read: http://www.derkarl.org/why_to_tabs.html)[i]
I will publish the standards, but in general, the main rules will be:
a) 4 spaces per tab, no tabs period,
b) all files should have unix line endings, not mac or windows,
c) don’t reformat other people’s code; instead emulate the format they have used, and
d) don’t reformat code in check-ins where other changes are made; do them separately to reduce conflicts
I will publish the standards, but in general, the main rules will be:
a) 4 spaces per tab, no tabs period,
b) all files should have unix line endings, not mac or windows,
c) don’t reformat other people’s code; instead emulate the format they have used, and
d) don’t reformat code in check-ins where other changes are made; do them separately to reduce conflicts
I will not be adopting either PEAR or ZF standards, but some of the main points can certainly be incorporated into our own as they make sense.
I would eventually like to employ an auto-formatter on check-in so users could reformat to their hearts content when working on the code, but when checked into the repository, it would always be reformatted back to the standard format. This avoids the whole problem, and allows finicky devs to work with files in the format they feel most comfortable in.
I think selecting the K & R and in the meantime respecting the existing formatting used in the file by the author are the really critical points at this time. There are many infrastructure changes coming with the preparations for the new release, and I just can’t make researching/testing/developing such hooks a priority at the time being.
I would think the auto-formatter would be a critical feature that should come sooner rather than later. It could easily convert tabs to spaces, convert to unix line endings, and format the code to K & R (or whatever format is decided on) when it’s checked in (or uploaded to the repository).