Writing Documentation: Teach, Don't Tell
Programmer Steve Losh has written a lengthy explanation of what separates good documentation from bad, and how to go about planning and writing documentation that will actually help people. His overarching point is that documentation should be used to teach, not to dump excessive amounts of unstructured information onto a user. Losh takes many of the common documentation tropes — "read the source," "look at the tests," "read the docstrings" — and makes analogies with learning everyday skills to show how silly they can be. "This is your driving teacher, Ms. Smith. ... If you have any questions about a part of the car while you’re driving, you can ask her and she’ll tell you all about that piece. Here are the keys, good luck!" He has a similar opinion of API strings: "API documentation is like the user’s manual of a car. When something goes wrong and you need to replace a tire it’s a godsend. But if you’re learning to drive it’s not going to help you because people don’t learn by reading alphabetized lists of disconnected information." Losh's advice for wikis is simple and straightforward: "They are bad and terrible. Do not use them."
There's a difference between a tutorial and documentation? Who'd have thunk!
But for those of us who already know the basics of driving, a quick reference is much more useful than a didactically structured text. Documentation isn't supposed to be a tutorial.
Obviously documentation that tells you to read the code is useless, though.
I think one thing the author misses is that sometimes something, even something bad is better than nothing. While a wiki certainly can't replace a professional technical writer devoting a full time job to writing documentation--most of the time your choices are between nothing and something unreliable. In the case of documentation I would rather have unreliable information than absolutely nothing at all. With nothing at all often you will have to scour google for an inkling of a hint. Also wikis on languages like PHP offer up if not corrections at least lots of different examples of usage.
Say what you want but Stack Overflow is an amazing resource and essentially a wiki.
In other news a screwdriver is not the best hammer, it turns out.
From TFA: The purpose of technical documentation is to take someone who has never seen your project, teach them to be an expert user of it, and support them once they become an expert.
No. Experts in their field shouldn't need to be taught how to understand your system; that's part of being an expert ( or indeed, even a professional ). All documentation should be doing is explaining the sticky bits and providing details and/or examples ( whichever is relevant ).
Just my opinion of course. But having stepped in to countless networks/codebases, I can tell you that I just get annoyed when the documentation gets in the way of the information I need to complete my job.
Mod me down with all of your hatred and your journey towards the dark side will be complete!
Programmer Steve Losh has written a lengthy explanation. . .
And we're done.
Provide that in addition to docstrings, and you will make everyone satisfied.
Do you really want to read the source code for ssh every time you forget whether it's -p or -P to specify the port? (It's one for ssh and another for rsync...)
API documentation is like the user’s manual of a car. When something goes wrong and you need to replace a tire it’s a godsend.
Great! That's exactly what API documentation is for.
But if you’re learning to drive it’s not going to help you because people don’t learn by reading alphabetized lists of disconnected information
If you want to learn to program you want to read tutorials not the API documentation...
Most documentation comes in the form of a reference manual for good reason: It is written for advanced users who already know the concepts and need to know the details. If you don't know the concepts, you're the target audience of tutorials. Some people need a tutorial, but all people eventually need a reference manual. It's the more important piece of documentation.
Thanks for pointing out what we've been telling developers for as long as there have been tech writers.
...the author doesn't understand what documentation is supposed to be used for.
Time is an illusion. Lunchtime doubly so. ~ Douglas Adams
Am I the only one who enjoys reading the entire owners manual when you buy a new car?
As an author of three successful dead-tree programming books, I have a few observations.
1) I use the electronic versions myself because of easy search (better than an index) and copy/paste.
2) In book format, it's possible to lead a reader through topics in a sensible order that builds on prior topics.
3) The challenge with electronic/on-line documentation is that there is no expectation that readers will approach the material in any particular order. Readers type a search term into google and up pops a page or two of documentation. How can the author make safe assumptions about the definitions of terms and prior conceptual knowledge the reader will have? Adding links to the definitions of terms and links to chapter oriented conceptual documentation doesn't usually help because readers are impatient, and there is no good place in the middle of the documentation to start.
4) Many readers don't know the terms to type into google and therefore aren't lead to the relevant conceptual documentation even if they would have read it had they known.
I like seeing this alot:
That's it in a thesis statement.
What does 'documentation' or a 'user manual' that **teaches** not dumps random data actually look like???
Complexity is the problem, and it causes blurred lines in areas that in a simpler technical area (with less uncertainty), say auto repair, would not be uncertain.
Computer programs, languages, API's, etc are insanely complex compared to a radio or engine. The parameters and variables are way off the scale in comparison.
Another way to say it is, even on the 'strict' end, in computing there are too many ways to do everything.
A second problem is time. Specifically time in relation to the development cycle.
A manual for a '68 Mustang will always be accurate and usable as long as '68 Mustangs exist.
A complete guide to HTML, CSS, and Dreamweaver...well that can become obsolete in 2 years b/c of changes in the industry. What good is a tome on CSS 2 when CSS 3 becomes standard? It filters down through the whole development stack.
1. Complexity
2. Time
These things cause making a proper 'user manual' that teaches the user like the best user manuals or instructions for other things we've seen.
That's the thing, us tech-minded people know what a good 'user manual' or 'FAQ' or 'help page' looks like when we see it.
The challenge for developers is to integrate educational concepts to mitigate the challenges of the complexity and speed of the industry provide.
We need teachers who can code...we need *women* who can code...
To get that, we need to learn to admit when we *don't know* exactly what we are doing and fess up to the fact that much of computer developmenet these days is done by trial and error!
I don't like it, but we have to accept it to change a whole industry.
Thank you Dave Raggett
Of course I do. Reading source code is guaranteed to be the most up-to-date explanation of how things work. By definition!
And of course this is based on the assumption that people name their methods, classes, functions and variables in a meaningful way, structure their code, and other do all the other things that make it a maintainable code but even if not, what would you rather base your decision on, an out-of-date wiki or a confirmation by seeing with your own eyes?
I can't believe my eyes when I read all those idiotic questions on stackoverflow.com such as "what if I use this option with this library, will that work?" Then they go via trial-and-error and at the end of it, they still don't know whether what they observed is true or not. Instead of clicking 'download source' in their IDE and fucking checking themselves.
It's not rocket science, it's just code. Code is like any language. It is to be both written and read (except for Perl, which is write-only :-P ).
TFA sez:
But all that is irrelevant because aside from Wikipedia itself and video game wikis, they don’t fucking work. ...wait, what? So, aside from the largest wiki, and indeed, possibly the largest single repository of human knowledge EVER, wikis don't work? Because of your silly driving lesson strawman argument, too pedantic to repost here?
Yeah.... I really don't want to read *your* technical documentation now.
The article misses something critial - the use of common language.
The biggests example of this is HIS use of "user". A "user" for all my time in this business is the person sitting in front of the computer using the software to preform a business funtion... not programming a business function.
This leads to second issue a developer is person that uses an embedded function written by another developer - generally with a higher skill or at least akill peaked before the new developerl. That developer is trying to come up to speed about cause and effect of using a given piece of code and trusting the original developer actual did his job right.
How can you trust a person that says what documentation is to be, that cannot teach it following his own rules? The first rule of any teaching is placing terms that you are going to be using, to teach the others what you mean. You see this legal documents to prevent confussion of common terms being used in a more defined or limited manor.
In my opinion, Stack Overflow is most often the blind leading the blind. There will be 20 wrong answers, 10 answers to the wrong question, 2 suboptimal solutions, and if you are in luck there will be 1 good solution. Now, tell me which is which. It seems to me that the good answer is almost always buried under crap.
Stack overflow questions are often badly stated and difficult to find with more correct search terms. If you don't even know the search terms, the site is useless.
There have been a few times when stack overflow saved me a lot of time. There have been many times when stack overflow has been a pointless time sink.
I agree with your superficial point...who would have thunk it indeed
However, I think it is still a distinction without a difference, one that only causes more confusion.
You and I know what 'documentation' in the computing sense means, but it's not a logical concept for a non-techie.
'documentation' in computing can be as simple as the coder showing his/her work and making a formal log of changes and bug reports/fixes
however, and here is where the problem happens...what constitutes 'sufficient documentation' for a coder is *not* sufficient for a user!
the problem is, that to bridge the gap, most programmers (who are not at all schooled in education theory & by nature tend anti-social) must create some sort of 'document' beyond the 'documentation' for the end user
sometimes this takes the form a 'tutorial'
a 'tutorial' is not full instructions...it is a real-time step-by step *demonstration* which may have supplimentary material that is actually instructions
ex: I can make a video with the steps to start a car, put it in gear and how the brake and throttle work...a person, with *nothing* else but that video and factory plans of the car *could* learn to use it...but calling a basic video and factory plans 'instrucitons' is insulting!
'documentation' can be helpful
'tutorials' can be helpful
'help' menus can be helpful
even so, its not a full user manual that an end user in other industries would expect
the computing industry has decades of work in this area I fear...so many have gotten used to doing it a bad way
Thank you Dave Raggett
peaked before the new developerl.
Freudian slip much?
Have gnu, will travel.
I run Windows!
Since when did the car owner's manual teach the owner how to drive?
I work for an airline. We train pilots on our aircraft and our procedures. We certainly do not teach them how to fly.
Do you really want to read the source code for ssh every time you forget whether it's -p or -P to specify the port? (It's one for ssh and another for rsync...)
I usually just write my own ssh and rsync clients. Much faster...
BTW: In rsync -p is the same as --perms and -P is the same as --partial --progress. Neither of them specify the port. You need --port for that. getopt_long() FTW!
I hate you! You're one of those co-workers that urgently e-mails me at 1AM in the morning asking me how to use some utility I wrote. In the morning I reply, "Use the -h switch, you mother f*cker." Followed by my usual disclaimer--"Every utility I write has an -h switch, which describes the switches option-by-option, followed by short description of the function of the utility, plus gives links to additional documentation."
And if you think you're going to find the -p switch in OpenSSH source code, good luck. Option argument handling is strewn about in several different files. I know, because I've had to hack on it and add options, as well as fix the parsing of forwarding option arguments, among other things. I've seen worse, but it's a long way from some utilities, where getopt and getopt_long processing is concise and easily readable.
Pro tip: readable source code has nothing to do with methods, classes, functions, or variables per se. It's the overall structure that counts, even if it's a single 10,000 SLoC function. Most C++ apps are harder to read than a gigantic ASM app.
Most people organize their code by what it literally does--by the components they learned in school or a textbook. They tediously breakdown blocks into a myriad functions and classes based on their algorithmic role. Or they farm out "parse_int", but then have a 200-line chunk of code processing a dozen different kinds of ints (ints for timeouts, ints for userid, etc).
I don't have many simple tips for alternatives. I just know that most people are doing it horribly wrong. I like to think my code is fairly easy to read--and people have told me that--but I know I could get better.
Okay.. one simple thing people could do more often--use fewer source files, fewer classes, etc.
Also, people abstract too early, before they understand what the meaningful abstractions are. So they end up with too many abstractions, creating too much complexity. People should begin to write their applications as quickly as possible, without worrying about structure--just functionality. It's only until you're about one third or even halfway through that you have an idea of how the whole application should be structured. That's when you start over, before it's too late to re-architect, but after you have a concrete idea of what's necessary and what's superfluous.
Document everything that you would have liked to have seen / needed to know if you'd suddenly been placed on the project at short notice.
Document your code for other developers : a single sentence is often enough to explain what a block of code does.
Don't make the readers of your code run every line in their heads - if the code works then they can read the documentation quicker.
Documentation must be maintained as dilligently as the code (nothing worse than wrong / obsolete documentation).
If you had to really think about it, document it.
Don't add unnecessary documentation (i++ // incerment i by 1)
If you believe that "all code is self documenting", go and work somewhere else, because at 3.a.m in the morning the developers trying to get your shitty code working will probably want to do you some harm.
developers, take notice because these words ring true! while there may be some quibbles among people about details in this article, there are two things that have are universal truths.
auto-generated documentation is worse than useless: it lets maintainers fool themselves into thinking they have documentation.
...
[crowd written] Wikis are an abomination. They are the worst form of “documentation”.
you have no idea how many times i've heard developers tell me to read the documentation only to find out it's just Doxygen generated with very sparse non-code text. it's a nightmare. "crowd" written wikis are terrible for code documentation, no question about it. however, privately written and maintained wikis can be a good editing tool for documentation.
if you want a good example of good documentation, check out the Qt documentation, it's has all the great things discussed, it's on the web, it's in a independent program and it has plugins that integrate it into IDEs.
*drops mic*
Anons need not reply. Questions end with a question mark.
For an API there's probably 90% that is almost never used in day to day operations. It's either there as infrastructure supporting the framework or is there for use in rare corner cases. Thus an example goes a long way in showing typical usage of how these things fit together. Same goes for all those man pages with long lists of arguments, when in reality almost everyone always runs that particular command with the arguments -Duv for most practical scenarios. If done right, the technical specs+practical examples, you should be able to jump to either one without the other being "in the way". You do know how to use your scroll wheel right?
Without practical usage, it's kinda like getting an assemble-yourself -plywood-furniture with all the pieces and screws, but without the instructions that show you how to put it together. Yes, you could argue that someone could manage to get it together without those instructions, but it will be much more difficult, and they will likely do things wrong. Just as when using APIs sometimes, people find ways to get it done, but without knowledge of some of the nuances of the framework they might be doing something wrong. This is often the case with someone rolling their own encryption, where someone gets something working but it is insecure because they missed one little nuance. If you can read the RFC's and manage to get something together, that alone is impressive, but maybe they didn't know they should also read the entire article on generating key materials properly and thus the whole thing is unapparently insecure.
-h? Next time, use all three of these: -?, -help, --help. I'm probably not going to try throwing -h at a program without having a clue what it might do.
Copyright 2010. All rights reserved. This comment may not be copied in any way including, but not limited to caching.
Hate to reply to myself, but I forgot /?
Copyright 2010. All rights reserved. This comment may not be copied in any way including, but not limited to caching.
Command line utilities should print their documentation for any unrecognized or erroneous command line arguments (unless that's so lengthy they need to only print a subset).
Socialism: a lie told by totalitarians and believed by fools.
A programmer using a library is a user of that library. The person programming a piece of software is not the end-user of the software being written, but she is still a user.
Life feeds on life ...
feeds on life
feeds on life
end user is on top of the food chain, is all.
We wrote two documents for every program (of any significant length), a "user guide" and a "reference manual". That's in addition to the man page and the "usage" blurb if it was invoked with nonsensical arguments.
They fulfill two very different needs.
(now get off my lawn)
There's also something to be said for "sell, don't tell". I seem to recall that the Commodore 64 Programmer's Reference Manual was written as if they were enthusiastically pitching the product. For some reason, it was much easier to retain the information when the author gushed about it.
For all intensive purposes, "whom" is no longer a word. That begs the question, "who cares"?
I think the author's tirade against wikis is that many people use a wiki as a magical tool that allows them to forego writing documentation in the hopes it will suddenly appear, written by users that want to write documentation. This obviously isn't what typically happens.
However, I think wikis can be (and often are) a great format for documentation. The author(s) of the software should still be the primary and/or only contributors, but even so good wiki software serves to lower the barrier to writing documentation: creating/editing as simple as clicking edit, and you instantly see the results. You can link between pages, reducing duplication. Some software forces a hierarchy of pages, leading you to create things in a logical, structured way (of course, you can lead a horse to water...).
The key to this of course is that the person/people writing the software must write the bulk of the documentation (eg, like you would without the wiki as well). Don't allow random edits, or at least subject edits to a review process.If your project is big and successful, just as it lowers the barrier for you to write docs it may encourage others to contribute -- but don't rely on this.
Think of the wiki more like a publishing platform or format; not like a way to absolve yourself of the responsibility to write documentation.
Speak before you think
You can't have -help using getopt(3) or getopt_long(3), but it will usually resolve like -h anyhow, assuming you exit after printing the usage. If getopt_long is available I also always add --help. -? is a freebie, because you can aggregate -h and unknown options in the same block. Although, my code will send -h to stdout and exit with 0, but -? to stderr and exit with EXIT_FAILURE.
A / switch is not something you'll find in Unix land.
At the very least, all applications should provide -h, period. It's almost universally supported by system utilities.
To be honest, when I say that "not all wikis are Wikipedia", I'm still being a bit unfair to Wikipedia. Even that project - which puts, for all practical purposes, zero dollars into content creation - still has recognized that at least some regulation is a good thing, and that even if you give everyone read access, you don't have to give everyone write access. Further, with their Pending Changes process, not all changes to a page go live immediately--for certain pages a reviewer has to approve edits before they appear on the outward-facing Wikipedia article.
A private company or organization can appoint gatekeepers to control who can edit what, and who can approve changes. Moreover, they can pay people to edit documentation, and can impose requirements and standards across the project. Wiki software can provide a lot of 'back-end' support for creating complex, multi-page, potentially multi-media documents, using markup that is relatively straightforward to learn. It can provide clear, complete records of who changed what, when--and who is responsible for breaking stuff.
Sure, waiting for people to randomly show up and write documentation, and then accepting everything they give you without any validation or quality control is a recipe for failure. But that's not the only way to use a wiki. Linus doesn't let just anyone check stuff into the kernel.
~Idarubicin
I love reading great documentation. When I have a question and the documentations explains the answer almost as if the author has magically anticipated my problem, I get a warm, fuzzy feeling inside.
I too love reading great documentation. Documentation that does not change the point of view twice. And then back again.
... documentations explains ... I’d like to say thanks to ... for proofreading this.
Documentation that was PROOFREAD by GOOD PROOFREADERS !!!
up-to-date-ness
I've been writing technical documents since the early 1970s.
You can't expect one piece of documentation to serve everyone ... it's like buying a "vehicle" and trying to use it to race, haul hogs, and climb Pikes Peak.
A - Ordinary users don't give a shit how the stuff works, they want it to do something for them ... tell them how to make whatever it is work as a tool for them. Run through the common use cases, screen by screen, showing them how to make the widget-smasher do it's thing.
Start with things the way they should work, then give them some basic troubleshooting, maintenance, etc.
B - Administrative users: They need all of "A", and how to handle the other users. Add, remove and monitor users.
Start with things the way they should work, then give them some basic troubleshooting, maintenance, etc. for the added functions.
C- Service techs, sysadmins, and those who will touch the sacred code: All of A and B (be reference to the appropriat4e manual or section thereof) and then feel free to pile on the technocrapobabble.
Each detailed explanation should start with a very brief "statement of purpose" ... when will this command be needed, or what does the bit of machine do. Why would you use it?
Then explain how to use it, and the expected results if you used it right, the expected results if you screwed up, and how to recover from an error.
======== ... chronologically, what touches it and what is supposed to happen?
You need to explain for each level of user what happens to a transaction, or data, or a part being manufactured, as it passes through the process or the proigram
What will you see if there is a failure?
How do you recover from the failure?
It's not difficult, you just have to make sure that each level of user can get their task done efficiently.
That's how I got my entree into writing about Linux. Programmers are very smart, but not very eloquent and they are also very poor teachers.
There are any number of rules and guidelines for writing documentation, most of which are ignored since documentation is often the red-headed stepchild of the project.
Documentation should tell a story clearly and help the reader understand the 'why' and 'how' as well as the 'what'.
"I believe in Karma. That means I can do bad things to people all day long and I assume they deserve it." : Dogbert
Yeah, this is one of the big annoyances with *nix man(1) pages.
Between "Name" and "Synopsis", they're all missing the "Typical usage examples" section. I shudder to think how much time has been wasted through this poor design choice.
I'm an end user, although one that likes mucking about in Linux, flashing a new OS on to my phone, and generally getting into the guts of whatever tech I'm using.
Maybe it's just because I'm old enough to remember trying to make early Linux distros work relying on Man pages, but "documentation" tends to be the last place that I look for answers. I still shudder to recall that understanding Man Page A required understanding Man page B required understanding Man page C..... I just wanted my modem to work!
The problem is that so much documentation is just too much for day to day needs. I don't want to understand the technical underpinnings of Android or Debian packages I just want to know how to make a problem go away. Simple questions require simple answers.
Instead I rely heavily on Google + Forums for probably 98% of my needs. I really need to have a very, very obscure problem to find that no-one has figured it out yet. (At which point I dutifully file a bug report)
Finally, am I alone in finding that whatever technical support docs are available on corporate sites are useless?
Three Squirrels
I produce a lot of documentation along with my coding, and the one thing that makes it palatable (even to me, re-reading it) are illustrations.
I'm not talking about UML class or activity diagrams, although those things are great where appropriate. It could be anything relevant to getting your point across, like a fragment of a database table showing sample data so people can visualize how a group of tables will work together. Screen grabs with arrows and circles.
My rule of thumb: if I ever find myself drawing a picture on a whiteboard as I'm explaining my module to someone, I immediately stop and take a picture of the diagram I just drew, and ASAP afterwards I turn that picture into an illustration in the user docs. Then next time I can just whip out the docs and point to the illustration.
Koans and fables for the software engineer
And for no arguments. Or at least print what is required to get help
C:\>app
Crappy app 0.0.0.1a
GPL 2 (If you don't like it fix it yourself
For help type -?
C:\>app /?
Crappy app 0.0.0.1a
GPL 2 (If you don't like it fix it yourself
I said enter -?, not /? This program was barely ported using cygwin, so you have to use *NIX arguments
Don't like it, fix it yourself
C:\>_
Nah,
The the thing is that most people are not programmers. Telling them to look at Wiki's, Source Code, or mile long README types of docs, are useless. These sources are for other developers who want to improve or make the application part of their workflow.
Those who wish to learn the software and are not programmers will simply be lost. I see this all the time with wordpress. People install the minimum required to get Wordpress running, and then get charged up the wazoo by their host because they don't install any caching or anti-spam plugins, so their disk space and bandwidth is chewed up in a manner of minutes instead of weeks.
Wordpress is a great example of doing everything wrong. It doesn't come, out-of-the-box in with appropriate plugins and is insecure by default. The average person running wordpress will have their site "hacked" at least once a year by defects in wordpress, without taking into consideration any plugins.
Non-programmers can not fix most OOP programs, even if they have the source code, because OOP programming is not for beginners. Non-programmers can usually fix a trivial 10 line javascript, not a 50,000 line Jquery widget.
More importantly. The source code of a library isn't necessarily any use for understanding best practices for using a library. Reading libavcodec would be gloriously unhelpful for adding video support to an application.
use fewer source files, fewer classes, etc.
Hardly useful; I use as many or as few source files as I require, no more, no less. I make a conscience effort to make the number of source files fewer, but that hardly matters if your user-facing interface or API is easy to use. If its documented well, there's hardly more you can do I think.
Python: 'And then suddenly you have a language which says "we're all stuck with whatever the whiniest coder wants".'
Not documenting is a more or less conscious technique developers and projects use to increase their market value. In those projects where the business model is consulting , you better believe that unless it's a public API , it's got zero documentation.
I know this is true. If software developers wanted to , they could write a nice book about how their source code works (as opposed to how their program works or how to write a plugin for their program).
They don't. This is not merely a case of being rushed for time or whatever. They don't want anyone else to understand it really. You control what only you understand- every developer knows this intuitively. Going to great pains to write a book-style learning aid to your actual code so that *just anyone* could take your place.. well... do I really need to finish that sentence?
Devs (don't) do it to so they can get some job security. Companies (don't ) do it to get consulting gigs. No one will admit that this is what's going on, but it is. I can hear the rebuttals already.. I can see the down-modding about to happen... go ahead.. flamebait me down. .. knock yourself out.
The closet analogy I can think of is magicians guarding their secrets. That worked very well for a long long time. The incentive was the same. If you give this away, if you make it understandable, you're going to be out of work. Slightly different dynamic, but you get the idea.
This is one of the product spaces we want to move into, but as you might imagine we have come to the conclusion that we have to move carefully, and even obliquely.
This is not exclusive to software engineering either. I know for a fact - which means i have multiple, full confessions, that mathematics teachers are far less clear than they could be wit their students. Some have said they do it to winnow out the weak. Others have admitted they do it to classes to students they don't like. They know it makes a huge difference, how you explain something- and that no one can accuse them of anything. That's basically a kind of power or force you can wield against and for people who please you or displease you.
Just sharing what I know.
Hahaha! Awesome.
) ) there, that's better.
Socialism: a lie told by totalitarians and believed by fools.
Just for you, I name my methods things like bob, Bob, bOb, boB, BOb, BoB, bOB, BOB, _bob, etc. My text documentation is absolutely beautiful, though.
The same way your managers answered the question "just how do I get a bunch of suits to create a business if I can't afford the services of professional tech-weenies who can write actual code? Excel Macros?"
When you have a business need for a professional tech writer: hire one. (Even if you do it on contract. Chances are your developers will learn a fair bit too, because they have to explain things to the tech writer well enough for the tech writer to get started. You'll wind up with a better product, and you'll probably find some bugs you had no idea existed.)
Oh cool! I known that shutdown -r -t 600 works on Windows when I expect it to finish installing an update and I'm ready to go for a coffee, but I never remember what it is in Linux. Thanks to your tip, I now know I can use shutdown -h but I know the Linux guy had to put a number, so let me try shutdown -h 0 and see what it tells me about how
Losh's advice for wikis is simple and straightforward: "They are bad and terrible. Do not use them."
With that quote right there he's lost all credibility.
A well maintained wiki with proofing, editors, publishers that has management on-board is about the best way to document anything. He seems to be referring to the often found, random wiki the local coders threw up for lack of anything better... yes, those are bad. But a well maintained one, that actually has official practices and peer review... Where you get a project to write or update something, and then someone else gets a project to edit it, and then the entire team peer reviews it before it goes to a "publisher" who then publishes it to the wiki officially is great.
In my job, published edits to our wiki documentation are something you can use for promotion, raises and even to get new positions. The "stars" at my company are the ones making the most published edits. And note, I say "published" edits. You can make all the edits you want but if they fail peer review you just wasted several hours so you'd better make sure they are worth-while and done well.
I try to use exactly one source file per abstract role. For example, I'll put an entire JSON, DNS, or HTTP library in a single source file (this is all C code, mind you), because it makes it infinitely easier to reuse the code without resorting to a full-blown shared library. It also allows me to tweak and experiment on a project-by-project basis, without worrying that a single change will break some other application, but when I do migrate changes over it's as simple as a copying a single file (or two, with the header).
I see too many projects which break down something simple into half a dozen source files.
Some of my projects may have twenty or thirty source files. Putting an entire JSON parser/composer in a single source file seems stupid until you see it embedded inside a larger application. Then it makes a ridiculous amount of sense. How does this app handle HTTP? Oh, it's in http.c. How does this application handle daemon startup and option processing? Oh, it's _all_ inside main.c, carefully layered out in layers from top-to-bottom.
The problem is that people write their projects as-if they're the only project in the universe. Especially neophyte programmers, who dream about creating the next greatest module system, etc.
I think this is why functional programmers do so well. Because of the nature of purely functional programming, you have to think long and hard about the simplest interface to your module. You can't simply offload the work by requiring the user to juggle or protect a ton of state.
In OOP-land, I think this is why people who suggest to avoid subclassing are correct. If you're implementing a Zebra, implement the platonic ideal of a Zebra, not a horse subclassed with stripes. 9 times out of 10 that additional abstraction will go entirely unused except by your Zebra, and the conciseness of the Zebra implementation will suffer.
-h? Next time, use all three of these: -?, -help, --help. I'm probably not going to try throwing -h at a program without having a clue what it might do.
Then use the damn manual. That's why we write them. If you want to know how to use the manual, use the manual:
$ man man
$ man woman
No manual entry for woman
Yep. It knows everything!
It is not the responsibility of the student to fix a broken lesson plan. For fuck’s sake, the entire point of having a teacher is that they know what the students need to learn and the students don’t!
This. I've lost count of the number of times as a medical student when I showed up in a pompous consultant's teaching session, (arranged with great difficulty, no less), and the first sentence was "So, what would you like me to teach you today?".
If I knew I'd have gone and read about it myself rather than waste time here with you, thank you very much you arrogant prick!
manor? Please define your terms upfront.
Nobody here is concerned with discussions held on small English estates.
In some languages the getopt() equivalent is pretty readable.
It's sort of unfortunate that after so many years, plain C is still the de facto standard language for Unix-alike systems. The limitations of the language (that it is designed with machine implementations in mind, instead of with human readability) makes it necessary to document more things than otherwise would have been in an ideal (/perfect) world.
Don't quote me on this.
You are an idiot.
-h? Next time, use all three of these: -?, -help, --help. I'm probably not going to try throwing -h at a program without having a clue what it might do.
For non-Windows systems:
-h is Valid
-? is Invalid as '?' is a special parameter that may be expanded by the shell
-help is Invalid on GNU/Linux (though used often by ported applications)
--help is Invalid on older Unix systems.
For newer Windows systems:
-? is Valid (and mandatory)
-Help is Valid (and mandatory)
--help is Invalid
-help is Valid
-h is Valid
-h is the safest option
[Rent This Space]
Wow. That was the most common sense thing I've read in a while. Want a job in NYC?
1) Nobody writes it.
2) Nobody reads it.
If documentation were free, then implementing all the suggestions would not be an issue. In the real world, however, time and resources are always constrained, so documentation is a balancing act between utility and achievability. Moreover, for a company whose revenue depends on service contracts, it might not be in the company's best interests to eliminate client confusion with better documentation. I vaguely recall some story about Bill Gates who objected to having (I think) docx structured in a way that would allow a person to modify it by hand because it would loosen Word's grip. In other words, complexity and opacity can align with corporate interests.
There is another problem with spending a lot of resources to produce great documentation, however, and that is that as the software being documented evolves, the original documentation becomes less and less valuable. Although the original documentation might win awards for clarity and usefulness, it might be close to useless in only a few years, and nothing but another herculean effort will suffice to update it. This might be worthwhile where millions of customers are involved, but for a user base of only thousands or tens of thousands, great documentation that is also current can eat up profits.
job.
I was told how much my documentation sucks because the information they needed to operate the device wasn't in the manual. I challenged the person complaining to tell me something that was left out. I turned to the page in the manual and pointed to every answer that was left out.
Eventually the person complaining finally said "It's a bad manual because you have to read it to use it."
That's exactly the answer I was looking for.
My current place of employment does not want educational manuals. They want step by step instructions. I haven't written another manual for these people since. At my previous places of employment they raved about how good my educational documentation was. As a matter of fact the support manuals I wrote of an ISP in early 2000 that included modem and email troubleshooting leaked to other ISP's and outsourced call centers who began to implement the pirated copies into their own resources. I finally put a documentation GPL on it and released it all to the public (I've had people criticize me for not using Creative Commons, but this was a couple of years before that hit).
The lesson I learned - technicians want to learn. Monkeys only want "monkey push button".
The preceding post was not a Slashvertisement.
Always find it a bit odd when people complain about documentation, or place emphasis on it. My first prioroty is, "it works".
On the other hand, it is hardly clear in most cases, who the audience of the comments are. Do they know much, do they know little? If they know little, there needs to be a lot of documentation. Who is to say?
So when I hear about people, who mention bad documentation, or who complain about some documentation, it strikes me a bit odd.
Stephan
http://stephan.sugarmotor.org
reminds me, I hate man pages. there, I said it. they are the devil. i have never learned anything important from a man. rftm, you say? well stfu!
I heard the shrieks of thousands of terrified brothers and sisters. It was the cries of the carrots... Tomorrow is harvest day, and to them it is the Holocaust.
Documentation is for people, not programmers.
Many here seem to think that programmers write software for other programmers. Some do, but look at the 'Dummies' books- they are for people. People who have to do accounting, who have to write with Word, who want to know how to assemble an Ikea coffee table.
As an Apple ][ user and then a Mac user, I've never needed a manual to run ordinary programs. Autodesk CAD software and Mathematica require some instruction but most stuff just happens as you expect it to. If a Mac program requires documentation, it's probably defective as programmed.
OTOH, dBase was written for DOS programmers. It was complicated enough to discourage ordinary users and provide a market for middleman scammers who would create simple databases for small business persons and make them dependent upon them forever after. Those end users using the Apple or Mac in the early days could easily create their own hierarchical or relational databases without a 'consultant' because the software was user friendly.
I am a senior member of the Society for Technical Communication (STC) and it is my business to communicate obscure information from programmers, scientists, engineers and other snobs so that regular people can understand it. If that information was properly organized by people with common sense, I would be out of work.
...omphaloskepsis often...
API documentation and especially external API (and actually Application PI) should contain enough information (that is documentation) so that a person can use it successfully and correctly in most situations. It should point out troublesome situations.
If you don't, then you are saying it doesn't matter.
Or maybe you think people should spend a lot of their time finding external information, killing trees producing multi-inch thick books, reading them and being out the cash, because it does matter. (But not to you specifically.) Or, maybe you don't think a typical programmer has to stare at other peoples code enough.
So you made an api, but you cant produce concise, useful information. Elegant and understandable is for chumps.
Thanks a lot, expert.
Once you are at the component level or have a high fan-in, what you have should make sense. Then all you can say is that it wasn't worth your time. It should be (very) obvious, take very little time to verify any normal question, or be an exception rather than the rule.
Well, the authors says: "I also love writing documentation.". So, there you have it. If you like doing that, then please do the kind of docs that you'd like to see from others. Me, not so much a fan of writing lengthy blabber, and in documentations I prefer conciseness, easy searchability (i.e. use the proper terms and wording), and quick & to the point examples. Put the rest in a book that I'll buy, put in on my shelf, and never use.
Most docs are written by people who didn't do it by choice, and it shows, but if they were put together by someone who knew their stuff, then they are still usable to the generally knowledgeable in the area. If you want to write for rookies, go ahead, but most of those texts cause me exceptional headaches.
I am putting myself to the fullest possible use, which is all I can think that any conscious entity can ever hope to do.
define 'non-techies' my friend...
it's a sliding scale...my grandma is a 'non-techie'...so is my cousin, her great-grand daughter...both non-techies...one uses the internet, facebook app, instagram app, edits photos, and maintains a blog...
both are 'non-techies'
in that same way, take say a Cisco certified Network Admin (I used to be one)...they are 'a techie'!!
however, techie though they may be, a CCNA could be gainfully employed for years without ever being anything other than an 'end user' of an API, if they ever use one at all...
so, in this manner, an IT professional with a decade of experience could be a **new users** of an API...
**IN THAT CONTEXT** they need and are logical to expect some 'document' that functions as a 'user manual' of some sort
it's a sliding scale...'techie'....learn this lesson now
Thank you Dave Raggett
You're on linux, aren't you? There, all the manpages used to say "go read our proprietary* texinfo crap using the proprietary* reader**, because our shit doesn't stink", and even though projects like debian do try and come up with workable manpages, they're only half succeeding. You can't simply wipe out institutional stupidity in a day.
Manpages, when well-written and curated, are fine as the handy-dandy on-line reference manual. They ought to have everything the professional needs getting work done, where "professional" is someone who already knows the overview and what tool would be well-suited for the job.
If you don't know that, you need a different kind of documentation. And so you need a system that understands that. BSD didn't come with just manpages, it also came with several handbooks full of articles on various systems. FreeBSD, next to its high quality manpage collection, still maintains an ever-growing handbook next to a collection of articles and a FAQ for all sorts of gotchas, plus these days a wiki to collate information for eventual inclusion into articles or handbook chapters. Next to all the ways you can ask people more knowledgeable than you, so common in the open source community.
It isn't perfect, of course. You really need a curator (or a team of those) to keep the quality up (personally I feel FreeBSD is a bit slipping here, though they're still miles ahead of others I could mention), and that's boring work. And it's a large project with lots of words to care for.
Same problem with wikis: They're great for gathering all sorts of fragmentary information from multiple sources, but they need someone to copyedit, to curate the content. Starting with spelling and grammar, and going from there. In the end you still need technical writers. You occasionally need a fresh intern to try if the results are any good, just like the "hallway testing" that helped apple create such well-regulated interfaces to their software. But that doesn't change that wikis are great as buckets to catch information that would otherwise up and vanish. It's just that merely catching the information isn't enough.
Likewise, merely providing good-quality manpages isn't enough. It is, however, a good start and still much better than what you usually see provided.
* Nobody else uses it. That makes it de facto proprietary, no matter how religiously "open".
** "If we can't find an info page, we'll present a manpage in our proprietary reader because that's obviously superior to your preference that you set in PAGER. If you're really lucky, the manpage will still tell you in snooty tones to go read the (apparently non-existing) info pages instead. Verily, our excrement does not ever smell, sir!"
Seems like a nerve has been hit.
If documentation were free, then implementing all the suggestions would not be an issue. In the real world, however, time and resources are always constrained, so documentation is a balancing act between utility and achievability.
That's why the author advised you to take a typing course if you haven't already, because then writing your documentation takes about as long as thinking what you should write.
As a professional technical writer, published author, and university instructor, I can tell everyone here that developers should never be permitted to write their own documentation. No amount of blogging and helpful hints is going to turn a programmer into a teacher, unless she already is both. Even then, there is a huge potential for disaster. The person who creates something should never, ever be the person who documents it. The creator is just too close to the product. Zen mind is beginner's mind. This is why UX focus groups consist of naive users, not experts. And the developers are the most expert of all possible experts. Sadly, software companies, at least in the digital content creation sector, seem to have fired all of the technical writers as a cost-cutting measure. The quality of documentation from many companies (I'm looking at you, Adobe) has plummeted. Nowadays it's expected that any issues with the docs will be resolved by the users themselves via discussion forums. It's a travesty, I tell you.
Speaking as someone who studied architecture (bricks, not computers) I see similarities. The first rule of design was that you only learn the real problem by trying to solve it. Then when you realise why your first attempts are so horribly broken, you can use that understanding of the problem to actually start a design that works. But it is as much top down as it is bottom up, so you need both a clear simple overall architecture, but without it compromising the space to work out the details properly. So it is very iterative, some important details and constraints may break your elegant framework. The iteration usually stops not when it is finished but when you run out of time.
The notion of "site" is also very important, as every site is different and so every building is effectively a prototype, a design of one. This affects all sorts of subtleties in the project, so abstraction is nice for trying to think more quickly and simply, abstraction doesn't in itself solve anything, because the devil is always in the details. The details can't be hidden by abstraction, but they can be organised by abstraction.
When I'm trying to learn something new, I don't like reading documentation, I prefer reading a textbook written just for me. So please, when you're writing documentation at the work place, think about me! On the off chance that I could become your colleague, and furthermore, in the event that I should have to maintain some of your software, I will be very pleased to read a texbook you wrote for me. I may even kiss you (if you're a girl), and you will definitely get a gold star drawn in crayon on your scrapbook (regardless). That's how committed I am to having an excellent personal learning experience.
So slashdotters, now you know! Make it happen!
Though there seems to be a lot of good advice in this article, the author rants misguidedly against several things. As someone has pointed out already, he seems to be addressing the writing of tutorials, but labeling that "documentation for programming languages and libraries." While good tutorials are often sorely lacking, that is only one type of documentation for programming languages and libraries. API documentation is extremely important as well and literate programming and docstrings fit in a similar category. The author's rant against wikis is particularly funny, especially since he acknowledges that there are quite useful ones. Of course there are many wikis full of poor quality information, just as there are many essays and blog posts of poor quality. Blaming a wiki for the poor quality of its contents makes no more sense than blaming one's editor for the poor quality of one's code.
Given the number of bugs in most code, I'd suggest that it is pretty poor documentation for what the code is SUPPOSED to do.
I run: Windows, OS X, Linux, FreeBSD. Just because you have a hammer, doesn't mean everything is a nail.
You what? Man pages may not easily teach you how to use the tool but they are an excellent reference once you have some clue.
What do you do to get information about the tools on your system? Google everything and get the answers for some other version of the same tool?
I have worked on several large product from MAJOR vendors that provided over 800+ pages to document a simple API that could have been done efficiently in less than 40 pages. Because of this, the project costs drastically increased due to the complexities of implementation. I ended up reducing the documentation to a 40 page document that included "cut and paste" examples of which, if had been provided earlier, would have increased productivity time saving overall costs of the project.
Sometimes too much documentation is a bad thing.
The rule:
1 page (or less) per API call. Anything more and you're a fucking moron and should be fired for stupidity.
He didn't say "experts need to be taught", he said, "teach someone to become an expert." Big difference.
"We receive as friendly that which agrees with, we resist with dislike that which opposes us" - Faraday
if a person doesn't know what grep is, will he learn the tool through man grep? he'll learn the vsrious switches, but he won't understand teh concepts behind the tool and won't be able to apply it effectively. what's the good in that? I say, ask google using a natural language search, and see what you get. actually, ask siri, i bet she'd call up the relevant wiki or wolfram page.
Worse, it's one for ssh, another for scp. Rsync is a separate project so you can expect the options to be different.
That's nice. If I ever get attacked by a switch in the wild i'll know I can use -h to tell me what that switch is.
Now that I know what every switch is, tell me how to use them to achieve my goals.
That's what really makes the difference between being a reference and being instructions.
If I have been able to see further than others, it is because I bought a pair of binoculars.
Haven't used MS-DOS since 1990. No one cares. Joke is still funny.
Is 1563649 a prime number?
I said enter -?, not /? This program was barely ported using cygwin, so you have to use *NIX arguments
Don't like it, fix it yourself
C:\>_
I am SO going to include this in my code from now on.
Whether on StackOverflow, microsoft.com, or ANY OTHER WEBSITE OR ELECTRONIC DOCUMENTATION, please for the sanity of everyone involved clearly state up front:
1. what date it is now, when you write it
2. what version of the immediate software (API, etc.) and supporting software (language, runtime and OS at minimum!)
These will help the rest of humanity to understand the context in which you're proposing your documentation, question, or solution. If it is on a wiki, then create a new page for the new version and leave the previous one(s) up!
Thanks, people!
Great solution, I agree with the article. All software should point documentation to learning how to program (in the language the application uses) books for the user that are known for "teaching the user". Then the user is no longer a user, but a programmer and can use the sourcecode for documentation.
Genius.
Change is certain; progress is not obligatory.
FLOSS projects need new developers from time to time to remain viable. The issues for user documentation apply to developer documentation, too. New developers need to be taught the structure and conventions of a project so that they can find their way into it.
-- hendrik
... having spent decades fixing and enhancing code written by others, frequently no longer there.
"Teach" *may* be appropriate, if you're writing architectural documents, including the logic, but for system documenation for users, you don't teach: you write it so they can read it, and it MUST BE CORRECT and CURRENT, not some crap you threw together and fuggecaboutit.
If you want the right way to do it, I can offer one that was demonstrated to work when I developed it. My article on it, "Egoless Documentation", was published in the now-sadly-defunct SysAdmin magazine in '06: http://24.5-cent.us/egoless_docu.html
mark
Yes. Do that.
In education psychology and education design grouping information in that manner is standard practice. A teacher might identify and concentrate instruction time most heavily in the most important areas of a task analysis.
FYI, in education today, every lesson plan starts with a 'task analysis'....ed. majors are taught to analyze "what should the student *know* and *be able to do* after the lesson is finished"
Its two factors 'know'...as in a test of knowledge of data....'be able to do'...the all important second step of applying the data to solve a problem
Sounds alot like a user task analysis, no?
Another reason why I like the 'teach don't tell' mantra...
Time for some coders and engineers to audit an educational psychology class!
Thank you Dave Raggett
Grep is a special case because regexes are complicated. But a tool like ls? Read the manpage.
Using msdos since 1990, /slash switches are overall less common on msdos and its children than -minus switches were.
Nevermind that / is a poor choice due to its meaning as a directory separator. (Yes, windows supports / as dir separator for the last ten years or more).
But please, parade your lack of familiarity with your platform more.
straight from my cmd window
You were saying?
Microsoft Windows [Version 6.2.9200]
(c) 2012 Microsoft Corporation. All rights reserved.
C:\>dir /?
Displays a list of files and subdirectories in a directory.
DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N]
[/O[[:]sortorder]] [/P] [/Q] [/R] [/S] [/T[[:]timefield]] [/W] [/X] [/4]
[drive:][path][filename] /A Displays files with specified attributes. /B Uses bare format (no heading information or summary). /C Display the thousand separator in file sizes. This is the /-C to disable display of separator. /D Same as wide but files are list sorted by column. /L Uses lowercase. /N New long list format where filenames are on the far right. /O List by files in sorted order. /P Pauses after each screenful of information. /Q Display the owner of the file. /R Display alternate data streams of the file. /S Displays files in specified directory and all subdirectories. /T Controls which time field displayed or used for sorting /W Uses wide list format. /X This displays the short names generated for non-8dot3 file /N with the short name inserted /4 Displays four-digit years
Specifies drive, directory, and/or files to list.
attributes D Directories R Read-only files
H Hidden files A Files ready for archiving
S System files I Not content indexed files
L Reparse Points - Prefix meaning not
default. Use
sortorder N By name (alphabetic) S By size (smallest first)
E By extension (alphabetic) D By date/time (oldest first)
G Group directories first - Prefix to reverse order
timefield C Creation
A Last Access
W Last Written
names. The format is that of
before the long name. If no short name is present, blanks are
displayed in its place.
Why do you claim --help is invalid on Windows?
I'll trust you that --help is not valid on old Unix system (I assume some programs might interpret that as five options), but to say it's invalid on Windows is just silly.
I've used (and written) a number of tools that respect --help, and it needs no special handling from the system. Offering multiple methods is of course the best policy, because everyone tries something different first.
Why do you claim --help is invalid on Windows?
It will work (at the moment) but goes against the conventions set by Microsoft.
Microsoft could, at any time, change the way it interprets a double hyphen, breaking your program.
It is safe at the moment because Windows passes the entire parameter string via ARGV
[Rent This Space]
Yes, I am using Linux. Totally agree about 'info' --whatever its technical merits, it embodies the worst elements of NIHism.
I used FreeBSD 2.2.21 for a while (about 2000 to 2001-ish) and the man pages were better definitely much better. And the handbook was good. I also bought 'Grog' Lehey's "Complete FreeBSD, and that was useful too. FreeBSD did have a good documentation team ... once upon a time. (But, dammit, I wanted my USB Frobulator to work. Now, today, this minute! Or something like that, anyway; I forget. So I switched to Linux.)
Sigh. No need to get off my lawn; it is sere and withered. Enjoy the broken bottles, rusty cans, and poisonous spiders in the long grass, you young punks.
Wow, that is a great non sequitor, the part about having common sense and then taking a job in NYC :-)
Of course that is a rhetorical question and it is an answer to the flanebait that started the discussion which said to read the source, provided you have it. But if source code were so readable, it seldom is, then source would be the only document you need. People have pointed out that coding practice often inverts the logic of action, especially in OOD, The other truth is that most developers are poor writers and even though they are capable designers they can't explain the design, especially to a novice. This is a forest for the trees problem and relates to the role of educational techniques in spreading knowledge. The discipline it takes to develop and test and debug an object hierarchy in a modern language is often the reverse of the steps it takes for a novice to understand what it does, which is why reading the source is often the worst way to learn what an application does.
And still most people who develop cannot write. The proof of this is to read what documentation they do write. It is highly uneven in quality. While a tutorial that is written to advocate for a piece of code, a programming language, a library, might be quite readable and interesting, such as the kind of article that appears in a newsstand computer magazine, or on the main web site for a product. It doesn't take much delving into using the product or code to reach an inflection point where the character of what is documented changes abruptly into a specfication document and in which the writer has left out, or worse, glossed over, some pesky detail, whose inattenion to causes your project using the tool to fail and to not be easily and timely fixed. If developers want to know why what they do doesn't get used, they need look only at this problem.
On the other hand poor or non-existent document may serve a purpose. It may guarentee the elites an existence and provide a barrier to entry by less than elites, average or bad programmers and users who the elites say shouldn't be messing around in the innareds. The risk of that is slow adoption of the product, which can hurt developer security if the product has been over-hyped for its ease of use, when its use is hindered by poor documentation.
I consider myself a bad programmer, but I have experimented around with many programming languages, most recently Python, and have been looking for tasks to ignite a passion to get something done and to relearn the right way to develop applications. I have an avid interest in music and serious music composition, I can remember large works easily and know a great deal about the literature, so I was quite interested when a composition program written in Python came may way. I won't tell you the name of the software, but it was the usual approach, a collection of objects and methods to do various tasks associated with scales and pitches. There was some good tutorial and example code, but the use of it quickly became arduous, because the tutorials and examples emphasized the easy things to do and the other things you might want to do were either ignored or the jump off into the object hierarchy was so deep that you couldn't wade through the complexity. I wanted to go from the relatively easy processing of musical parts, horizontally, into the vertical aspect of chords, and in particular to be able to generate reasonable piano reductions of open scores based on where the pitches crossed from the left hand to the right with reasonable intervals. Not only had this not been tackled by the software design, but because of the ease with which Python handles lists, the emphasis was roo much on processing parts and not enough on harmony.
That's even more stupid - any author of any system could at any time change the rules and break existing programs. In fact, Unix is more prone to this than Windows, going by your earlier statement.
There's no guarantee Microsoft won't decide to break programs using their established conventions too - except that it would be bloody stupid to do so. Not to mention that even their own "conventions" vary significantly from tool to tool.
I don't think I'm going to worry about the possibility that Microsoft might stop passing command line options to programs. It's a ridiculous fear, and the fact that you got even one mod point for this shows how far Slashdot has fallen.
That's even more stupid - any author of any system could at any time change the rules and break existing programs. In fact, Unix is more prone to this than Windows, going by your earlier statement.
My post is not about changing existing rules, but leaving room to add more features. A single hyphen is to be used for command line arguments. This leaves a double hyphen available for a future use; whether that be implementing GNU-like syntax, some new security paradigm, a switch to set a flag, or any number of uses.
There's no guarantee Microsoft won't decide to break programs using their established conventions too - except that it would be bloody stupid to do so. Not to mention that even their own "conventions" vary significantly from tool to tool.
Standards, conventions, guidelines, and rules are all there for a reason. It is one method of future proofing and is vital to follow for a program to exhibit expected behaviour. Why be a maverick and use double hyphen when there is no need whatsoever other than to be different. That is hipster-coding.
I don't think I'm going to worry about the possibility that Microsoft might stop passing command line options to programs. It's a ridiculous fear, and the fact that you got even one mod point for this shows how far Slashdot has fallen.
Microsoft won't stop passing command line options to programs - that would break every program. What Microsoft MIGHT do, and it would be both safe and fair for them to do so, is have the shell examine the parameter string, cut out double hyphen parameters, pass the remaining string to ARGV, then act on those cut parameters separately prior to or simultaneously with program execution. If developers have acted competently and followed the conventions, this will not cause any issues.
This is not a fear - it is just common sense. I got a single +1 Informative as someone has either learned something, has thought about something they haven't put their mind to before, or thinks that someone else may benefit from the information. I am not a developer. I am not a Windows user. But I read, and I absorb. It is called listening. That more people don't do it shows how far society has fallen.
[Rent This Space]
What Microsoft MIGHT do, and it would be both safe and fair for them to do so, is have the shell examine the parameter string, cut out double hyphen parameters, pass the remaining string to ARGV
No, that would not be safe and fair for them to do. For starters, it's perfectly valid for a filename to start with two dashes.
it's perfectly valid for a filename to start with two dashes.
It is also perfectly valid for a filename to start with a single dash. But that is irrelevant to the issue.
The issue is with the parameters / command line options / arguments. This is the part AFTER the program name. $args contains an array of everything after the filename, delimited by breaking space (and a few other scenarios). Single hyphen parameters within these arguments can be automatically parsed and set. Double hyphen parameters are not a documented feature, are unsupported, and may exhibit behaviour that the user does not expect.
The term 'Best Practice' exists for a reason.
[Rent This Space]
Single hyphen parameters within these arguments can be automatically parsed and set. Double hyphen parameters are not a documented feature, are unsupported, and may exhibit behaviour that the user does not expect.
You already stated you're not a programmer, and I think I see the confusion. You seem to believe there's something automatic about parameters, and that the system does some processing for you.
This is not the case, on Unix or Windows systems. Libraries exist to do things like this (e.g. getopt), but there are numerous libraries and they all do things differently, and each program has to set up and initiate whatever parsing it wants to do.
There is no standard, though Posix includes recommendations (and GNU recommends an extension beyond this). The only exception might be Powershell, which tries to standardize on single-dash-long-name options, with shortcuts for common parameters.
Of course, it's also possible you're just trolling...
I hate you! You're one of those co-workers that urgently e-mails me at 1AM in the morning asking me how to use some utility I wrote. In the morning I reply, "Use the -h switch, you mother f*cker." Followed by my usual disclaimer--"Every utility I write has an -h switch, which describes the switches option-by-option, followed by short description of the function of the utility, plus gives links to additional documentation."
Uhm... what? How did you come to that conclusion?? You are creating some imaginary enemy here, probably because of your frustrations at work from working with lazy people.
I said source code is by definition guaranteed to be the most up-to-date explanation of how things work. Your command line options are in your source code. Your wiki can be out of date, your Word spec in a shared folder can be out of date, but your source code off of which you build & release will be the place where I will find accurate answers to my questions, guaranteed.