Talk:Boilerplate text

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Boiler Plate vs Cut and Paste[edit]

It seems like cut and pastable code is what the boiler plate refers too.

Also the C malloc and free example doesn't make much sense to me, from the definition of Boilerplate given. Those have meaning and seldom can I cut and paste those. Depending on if it is an array or structure, each time the free can be different.

More apt example of programming boiler plate code would be microsoft foundation classes, or ruby on rails scaffolds. — Preceding unsigned comment added by 99.195.196.136 (talk) 02:40, 30 July 2009 (UTC)[reply]

Misc[edit]

Why is library linked to in this item? The link I see ("you must type #include <stdio.h> in C therefore library inclusions are boilerplate") is spurious at best. 83.244.198.194 (talk) 13:48, 21 December 2007 (UTC)[reply]

The C code is a bad example for the point being made, the argc and argv parameters to main() are not used, so there's no need to declare them. As you hint at, including <stdio.h> is optional in older variants of C. JonathanWakely (talk) 17:09, 3 February 2008 (UTC)[reply]
The if __name__ == "__main__": line in the python example is not strictly necessary either. It's only necessary if you want the behavior of a python program to be different when it is executed directly to when it is imported. In this case, I see no reason to complicate things by adding it. SpaceDude (talk) 14:34, 14 April 2008 (UTC)[reply]
This line in python was included because there was a revert war with someone trying to remove the standard argc, argv parameters, arguing that they made the code unfair to C (because they are really not needed), and someone arguing that they are typical C boilerplate. Thus I added typical Python boilerplate to make the comparison between languages fair, without removing content. Diego (talk) 11:35, 15 April 2008 (UTC)[reply]
Why not just replace both examples with java? The private static void main (String args[]){new <class name>;} really is pretty much standard. 139.57.100.104 (talk) 17:00, 5 June 2008 (UTC)[reply]

Removing the example[edit]

I recommend removing the hello world boilerplate examples as they consist mostly of errors and do not represent boilerplate accurately

an example must be fully clear, it's better not to have one at all then to have a vague one

  • the python example shouldn't contain the boilerplate at all, and was added for a wrong reason (making a silly comparission "fair"), wikipedia is supposed to be NPOV, not fair
  • comparing verbosity of languages by hello world is meaningless, I doubt it's done seriously (i request a citation)
  • the argv,argc main version is arguably more correct and more boilerplate like

If you want a better example of boilerplate, a Perl 5 (my programming language of choice) example would be better

#!/usr/bin/perl
use strict
use warnings; 
# real code starts here

as lines 2-3 serve to encourage coding style, and line 1 is a very common filetype indicator {{subst:unsourcedip|78.8.208.43|21:41, 14 July 2008 (UTC)}}

In what sense is it "mostly errors"? Could you elaborate?
On the contrary, I'd rather have some concrete instance of what we're talking about, even if it's a contrived one, instead of explaining a concept purely on abstract terms. IMHO the second is much more likely to provide a false impression of the subject than the former, since the example provides context, and those assumptions that are incorrect can be detected due to the limited nature of an example.
I agree that a better example could be found. I typically associate boilerplate with Getter and Setter methods, for example. Maybe we could work something based on that - object oriented code tends to have much more boilerplate than procedural.
Again I agree on this one. A previous version had them, I don't understand why they were removed again. Diego (talk) 08:52, 15 July 2008 (UTC)[reply]

add a bit about boilerplate robot[edit]

look up the robot and add something about it — Preceding unsigned comment added by Dreftymac (talkcontribs) 00:52, 24 October 2006 (UTC)[reply]

this has been done some time ago: Boilerplate (robot) -- JonathanWakely (talk) 16:19, 3 February 2008 (UTC)[reply]

Differentiating a Boilerplate from a Template[edit]

Aside from the history of the term "boilerplate", how specifically does a boilerplate differ from a template? When would you use one term over the other? A paragraph about this at the beginning of the article would really make it more focused and easier to understand.

And not only: I need a notice about disabiguation between Boilerplate, Template and Reusability. My point is to finally merge this Boilerplate into Reusability, making this just a redirect. Shall I put the {{mergeto}} to the page? ...there still is a chance I did not udertand something well enogh, please explain me! ;) Franta Oashi (talk) 23:33, 27 June 2009 (UTC)[reply]

Includes example in boilerplate code[edit]

I removed the following from the Boilerplate code section:

Preambles often include imports, that is declarations of which libraries are being used. For example the following lines are very frequently included in C programs:
#include <stdio.h>
#include <stdlib.h>
This tells the compiler to include the files stdio.h and stdlib.h, which contain declarations of the types of commonly used library functions, making them available for use in the rest of the source file.

This is because includes are not boilerplate code, they are rather included components. Boilerplate means "does not require much change", not "cannot be changed at all". Since developers never edit their `stdio.h`, it's a library (or API) rather than boilerplate. Jevon (talk) 02:52, 11 November 2010 (UTC)[reply]

I'm not sure that your logic is sound to justify that removal. I doubt that the common usage of "boilerplate" includes your requirement that boilerplate should be able to be changed. But even accepting it: it's true that one does not change each particular include (the same way as one wouldn't change the "#!/usr/bin/perl" line in scripts); but that doesn't make them less boilerplate even by your criteria, since one can choose which includes to use (there's no need to include stdio nor even stdlib, and one can have many other includes) so an include section can change.
Moreover, Microsoft does call includes "Heading boilerplate" here.

Heading boilerplate: Consists of comments, #include statement for COMDEF.H (which defines some standard macros used in the header), and other miscellaneous setup information.

Diego Moya (talk) 09:51, 11 November 2010 (UTC)[reply]
You're absolutely correct. Apologies. Jevon (talk) 02:10, 12 November 2010 (UTC)[reply]
No need to apology! You were being bold, which is a great thing to be! Diego Moya (talk) 08:49, 12 November 2010 (UTC)[reply]

Definition[edit]

Boilerplate can mean

1. steel rolled in large flat plates, used in making steam boilers
2. syndicated features or fillers that are relatively timeless, sent to newspapers, formerly as stereotype plates, now often by wire, mail, or computer
3. a glib, hackneyed statement reflecting a generally accepted opinion or belief
4. any of the standard clauses or sections of a legal document

— Preceding unsigned comment added by Citygeneral (talkcontribs) 17:51, 16 August 2010 (UTC)[reply]

This article should be split[edit]

The section titled Boilerplate Code is far too in depth of a programming article. It ought to be split into another page and perhaps only have a Main Article: Boilerplate Code and perhaps a few sentences. As it is right now, however, the section is huge and far too in depth compared to the rest of the article. 71.146.152.14 (talk) 08:44, 4 May 2011 (UTC)[reply]

I agree. Would you do the honors? (Note that the proper capitalization should be Boilerplate code which is currently a redirect). Diego Moya (talk) 11:03, 4 May 2011 (UTC)[reply]

Link to Template processors[edit]

Has "Template processors are used to generate boilerplate text automatically" confused the template with final output? Should it read, for example, "Template processors use boilerplate text as a template to generate customized documents automatically."? AlanS1951 (talk) 19:00, 22 May 2014 (UTC)[reply]

No, boilerplate text is still boilerplate text in the final document. The first sentence is more accurate - the template contains fragments of boilerplate text which are converted to their definite form in the generated code. Diego (talk) 09:17, 23 May 2014 (UTC)[reply]

The etymology is ambigous[edit]

The etymology section in this article is entirely different than the origin section in https://en.wikipedia.org/wiki/Boilerplate_code. The latter seems plausible, but cite no sources. Glaux (talk) 09:59, 29 March 2017 (UTC)[reply]