Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Lord and Lady preserve us! How complicated are you making your code?!

To get a sense of the magnitude of the project, please peruse http://lucene.apache.org/java/docs/api/index.html.

If I have to do what you're suggesting, that is a CodeSmell and needs to be addressed immediately, preferably through refactoring the living #$E*! out of it.

You may wish to direct your critiques to the Lucene developer's list, though I'm not sure how they will be received unless you refactor out the condescension. ;)

I've written a full-featured pure-Perl search engine (Kinosearch), and while the class-level architecture is less complex than Lucene's, that comes at the price of having more functionality inlined than it should. Building an inverse index is just complicated, period. Either you have to write functions which are so complex that they ought to be refactored (Kinosearch) and Dragonchild presumably disapproves, or you factor out the functionality so that data passes through several classes and 10 or 20 methods (Lucene) and Dragonchild definitely disapproves. Catch-22. :)

I gather from your comments that that you are a stong proponent of test-driven development. FWIW, I appreciate this school and try to adhere to the principles when possible, but with all due respect, I don't consider it the One True Way.

Period, end of story... [snip] No more and no less... [snip] At no time... [snip] ... never... [snip]

Hmm. This is awkward. I hope we can avoid descending into a religious argument. There are certainly things I can learn from our discussion, but as a Utilitarian by disposition, I find these absolutes off-putting. Some Java developers start by writing javadocs first, an approach which is somewhat similar to writing tests first, in that you don't just start out by writing code. It violates DRY, and it doesn't follow the pattern of "only write code when you have a failing test", but in both cases, the developer is thinking about the high-level interface first. IMO, developers who work this way are not terrorists who hate our freedom and are out to destroy our way of life. Good software which does useful stuff can be written in many ways.

I had an interesting chat with Ian Langworth, co-author of "Perl Testing - A Developer's Notebook" at OSCON. I asked him, How do you write tests for an inverse-indexing app? Absolutely, you have to have high-level tests which consist of queries against the index. But the process of building the index is quite complicated, and arguably every link in the chain is an implementation detail. How do you avoid tests for the intermediate processes which rely on the innards of what ought to be a series of black boxes? The answer is... there's no easy answer. Mock objects help. But there's going to be a fair amount of waste... It was a very helpful interchange, and my tests are better for it.

In conclusion... Your comments are appreciated, but the recommendations are inappropriate for my current task, which is porting an existing library not designed from the ground up according to the principles you set out. For the time being, I intend to convert Lucene's excellent javadocs to POD, rather than delete them and replace them with tests. But even if I were to start over and write another search engine library from scratch, I think adopting a dogmatic, absolutist TDD workflow would be unnecessarily ascetic and would yield documentation both excessively voluminous and noisy (in the information-theory sense). Better to adopt bits and pieces of TDD, specifically the emphasis on maintaining a comprehensive test suite, while supplementing the code with documentation via tests, comments and summaries.

Regards,

--
Marvin Humphrey
Rectangular Research ― http://www.rectangular.com

In reply to Re^4: Documenting non-public OO components by creamygoodness
in thread Documenting non-public OO components by creamygoodness

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-04-20 10:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found