Talk:Boilerplate (text)

From Wikipedia, the free encyclopedia
Jump to: navigation, search

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
WikiProject Computing  
WikiProject icon This article is within the scope of WikiProject Computing, a collaborative effort to improve the coverage of computers, computing, and information technology on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
 ???  This article has not yet received a rating on the project's quality scale.
 ???  This article has not yet received a rating on the project's importance scale.
 

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.

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)

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)
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)
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)
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)

is comparing hell

Removing the example[edit]

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

In what sense is it "mostly errors"? Could you elaborate?

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

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.
  • 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)
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.
  • the argv,argc main version is arguably more correct and more boilerplate like
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)


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


add a bit about boilerplate robot[edit]

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

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)

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. Diego Moya (talk) 09:51, 11 November 2010 (UTC)

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

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

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)

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)

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)

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)