Re: example with source code

Dailey, David P wrote:
> I'm thinking of something [...] which would allow the author to maintain 
> only one sequence of characters (rather than markup and appearance being 
> maintained separately and in parallel).
> [...]
> I'm thinking that a nice <dualpurpose>both 
> wysiwyg<i>and</i>markup</dualpurpose> sort of container could be rather 
> handy.

Can you show us some specific pages where this would be useful? Pages from 
several different authors would be better than several pages from one 
author.

As a professional website developer, I use tutorials about markup and 
suchlike. My experience of them includes:

* Sometimes only the sample code is provided to avoid authoring a separate, 
working example:
   <http://www.accessifyforum.com/viewtopic.php?t=10112>
   <http://forums.gouranga.com/iceyboard/topic/4850/>
* Other times the sample code is placed in the article and the example is 
linked to on a separate page, like a testcase. This shows the working 
example in isolation, away from the effect any CSS and scripting which may 
be applied to the tutorial:
   <http://www.isolani.co.uk/articles/structuredTables.html>
* For PHP, the sample code is sometimes linked to with a ".phps" extension 
and there is neither a working example nor a code sample:
   <http://www.sdesign1.com/php-menu.htm>
   <http://www.sdesign1.com/includes/array.phps>
* Other programming languages sometimes provide source code in the page, 
with a link to download a working example:
   <http://vbnet.mvps.org/index.html?code/faq/cdlgmultiselect.htm>
* Occassionally, both the source code and the working example are on the 
same page:
   <http://iceyboard.no-ip.org/projects/littleredbook/1/3>
   <http://iceyboard.no-ip.org/projects/littleredbook/6/9>
* Rarer still is to have source code, a working example and a link to a 
generated file:
   <http://iceyboard.no-ip.org/projects/littleredbook/8/4>

Creating an element which is rendered onto the page twice in different ways 
is rather foreign to HTML. Particularly in the case of executable samples, 
such as with PHP or VB6. If the tag is only for use with HTML, then I agree 
with Ian that it's far too niche a community to create a new element for.

If the tag is for all languages, that requires a web browser which can parse 
and render every file format. As well as compile and execute every 
programming language.

It may be better for tutorial writers to choose from various approaches the 
one which best suits the type of code they are supplying and their editorial 
style? This is what they already seem to do.

-- 
Ben 'Cerbera' Millard
Collections of Interesting Data Tables
<http://sitesurgeon.co.uk/tables/> 

Received on Wednesday, 16 July 2008 06:56:04 UTC