Talk:Source code

From Wikipedia, the free encyclopedia
Jump to: navigation, search
WikiProject Computer science (Rated C-class, High-importance)
WikiProject icon This article is within the scope of WikiProject Computer science, a collaborative effort to improve the coverage of Computer science related articles 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.
C-Class article C  This article has been rated as C-Class on the project's quality scale.
 High  This article has been rated as High-importance on the project's importance scale.
 
WikiProject Computing (Rated C-class, High-importance)
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.
C-Class article C  This article has been rated as C-Class on the project's quality scale.
 High  This article has been rated as High-importance on the project's importance scale.
 

B[edit]

Why there is the attribute "human-readable" for the programming language in the definition? Is there some programming language which is not "human readable"? Faller 16:51, 8 August 2007 (UTC)

Machine language is not human readable. It might be debatable if machine language is a programming language, however, because it would be very difficult to program in, being not human readable. 71.142.100.154 (talk) 03:23, 17 April 2009 (UTC)
Binary code is not human readable (it is just 0s and 1s). My Ubuntu (talk) 02:14, 2 May 2010 (UTC)
I don't think we usually call a machine language a programming language, or machine code source code. Therefore I have removed the qualification human readable. Instead I have added more detail about translation, like M did before. I also narrowed the initial definition, corrected the way the SCAM article was introduced, and removed the untrue assertion that source code consists of statements and declarations. Rp (talk) 18:30, 20 January 2011 (UTC)

DevCDs and non-free sourcecode[edit]

The section DevCDs and non-free sourcecode sounds like an ad. I'm a developer and I've never heard of the term "DevCD," and the only mention of an example is a company I've never heard of producing a game I'm never heard of. I'm removing this section. Drano 07:08, 29 December 2006 (UTC)


Only a samll idea: Although it is not incorrect in the sense of the definition, I'd think we have better image examples of source code than HTML?? What about showing some real interesting stuff? Extract from Linux or FireFox (i.e. sth. many people have heard of) ? I think, that would be cooler. :-) Madmaxx 15:56, 25 April 2006 (UTC)

A[edit]

Well, hmm. Several issues are raised by the current version of this page:

  • Software can be written in a mixture of programming languages,
  • Program execution doesn't necessarily require compilation (interpreted languages, etc.),
  • An assembler doesn't turn object code into machine code, it turns assembly code into object code. The latter step (object code to machine code) is typically handled by a linker,
  • Machine language can be turned back into source code. This is called disassembly.

However, many (most?) interpreted languages compile the code anyways into either a byte code or native code. Smalltalk does this.

The reusability section should talk about maintainability. And it should be noted that people who believe in maintainability (eg, Smalltalk people) believe this to be the primary use of source code. Perhaps a quote to Donald Knuth saying as much is in order that needs to be specified. test


I've been working on rewriting some of this article, especially the first few paragraphs in the current version. Could some of the stuff about mnemonics and reusability be removed, or at least shortened a bit? A lot of this is covered in better detail in the programming language article, and its related pages, and I'd hate to duplicate effort that would be better spent on other articles more suited to these topics. Seems to me that the source code article would be better suited to discussing topics specifically related to source code, such as the legal issues surrounding it, and a discussion of how a bunch of source code becomes a running program, and not go into general programming constructs and concepts. Anyone else have ideas? -- Wapcaplet

Yeah, this page is pretty horrendous, right now. The opening paragraphs are jarringly bad. "DevCDs" are quite tangential to the core idea of source code of a computer program, yet are the first major heading. Organization is given short shrift. Licensing and Legal issues are decent, except the latter doesn't cover a very interesting disctinction and debate between software patents vs. software copyright. Quality, as well, is important, but also core to the idea of source code. Every time I think of this article I can't help but thing of the quote, "Nuke it from orbit: it's the only way to be sure." :( -- jsled 01:58, 11 October 2006 (UTC)

Password systems[edit]

Maybe I missed the point, but to me the "Password systems" section seems as if it doesn't belong here. It's not refered to from any other part of the text (at least I haven't noticed) and isn't really about source code either. zub 22:35, 6 April 2006 (UTC);

Ok, some unregistered user took care of that. :-) zub 08:31, 22 April 2006 (UTC)

HL2[edit]

Maybe something should be mentioned about the Half-Life 2 source code leak?
ßottesiηi Tell me what's up 23:40, 22 April 2006 (UTC)

Ugly picture[edit]

Why is there such an ugly picture up front? Why not show something nice, without a black background? A code snippet lifted from a real project would be nice. 82.139.85.48 23:42, 14 May 2006 (UTC)

Umm, again, why are you against a black background? ~LinuxeristTux-linux logo.svgNuvola apps emacs.png E/L/T 03:45, 20 May 2006 (UTC)

New Image[edit]

I have changed the picture to some java source I had lying around. People have asked for something from a well known project, but I thought, in this limited space, I would add something which is self contained. Those with limited or no programming experience may comprehend what the source is doing.

Sorry for 4 saves in a row... Changed the uploaded picture for a better aspect ratio.

Christiancatchpole 04:02, 16 July 2006 (UTC)

I think this image needs a new version:

  • That's not a method, its a constructor.
  • Don't do external actions in a constructor (showing the frame), its bad form. Change this to a main method.
  • Since Java 5, it is no longer necessary to get the contentPane and add to that, you can call add directly on the frame.
  • Don't use show() its deprecated, use setVisible(true) instead.
  • The frame.show() is not indented, and clips off the comment unnecessarily.
  • About 25% of the left code is clipped out. I can understand just showing a snippet, but as it is it just looks odd.

E.g. (needs more comments) just the main part of this code:

import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
public class Test {
   public static void main(String[] args) {
      //Remind: better title
      JFrame frame = new JFrame("Hello");
      JButton button = new JButton("Click Me");
      button.addActionListener(new ButtonListener());
      //TODO: add menu
      frame.add(button);
      frame.pack();
      frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
      frame.setVisible(true);
   }
 
   private static class ButtonListener implements ActionListener {
      public void actionPerformed(ActionEvent e) {
         JOptionPane.showMessageDialog((Component)e.getSource(),"Hello World!");
      }
   }
}

Current image[edit]

The present image doesn't display correct Java source code - the last statement should precede the closing }. Can the author please fix this? Please compile your examples before you put them here. Rp (talk) 09:17, 4 May 2010 (UTC)

Bad Comments[edit]

I noticed that someone spotted my incorrect JavaDoc comments... :) The original method could process 0-9, but I shortened it for Wikipedia.. I forgot to change the JavaDoc.. oops.

Christiancatchpole 04:51, 27 July 2006 (UTC)


software anomalies[edit]

Hello, my addition to the "see also"-link: Anomaly_in_software was removed on 24th December.

Please rethink, because I think this would be appropriate, reason: anomalies/bugs are also often in sourcecode besides being in docs and somewhere else. I give in the article different examples like: "data flow anomaly" and "control flow anomaly". I would appreciate any discussion on the matter. Thx, ----Erkan Yilmaz (evaluate me!, discussion) 15:32, 27 December 2006 (UTC)

Hyphenation[edit]

Shouldn't source code be hyphenated as "source-code"? SharkD 02:11, 30 March 2007 (UTC)

Source is not just source code[edit]

You write correctly in the article why we name it code, but you doesn't mention why it is source:
The sources of a software consist of not only code files but other files like images, string resources, version data etc.
The source in that sense is such a file which cannot be re-created from the other sources in the process of building the softvare.
An assembly file could be the source code if it is not generated from another file in the course of building or it could be a transient file if it generated from a C file respectively.


Faller 11:49, 6 August 2007 (UTC)

Need further explaining[edit]

Including differences with binary code (example with software you can download binary code(see http://xml.apache.org/xindice/download.cgi)) And new wiki entries for Binary Code (software builds), and explaining how to build source code from binary code —Preceding unsigned comment added by 88.149.242.34 (talk) 23:39, 21 February 2008 (UTC)

rewrite[edit]

Since there's opposition to my rewrite from Derek farn, I'll give a fuller explanation for the parts.

  • "In computer science, source.." : 1) too broad. Source falls under software engineering/programming and programming language design. Compsci is a big field, and many of its subfields are irrelevant to source. 2) This sounds like a disambig page, doesn't follow style, and becomes obvious/redundant in the same sentence when programming languages are mentioned.
  • "(commonly just source or code)" : "Robert Jones (also 'Rob Jones' or 'Bob Jones')" - obvious and unnecessary
  • "any sequence of statements and/or declarations" : 1) Too technical. A statement is something people say, a declaration is when someone says it with conviction (or something like that). Wikipedia isn't a reference, and we shouldn't expect average people to know definitions more advanced than the article they're learning from. 2) Incidental. The important thing about source code is that it's the original, non-compiled form of the program.[1][2] Then we talk about why we need it (human readable, etc.), and what it's used for (it gets compiled.)
  • 'Source tree' and 'code base' redirecting here is not sufficient reason to give those subjects much consideration in the lead. They don't even need to be in the lead, "working with and handling source code" can have its own section.

Anyway, that's a start. Other problems are the casual tone, the redundancy, the lack of citations (I listed these in my edit comment). Since I don't know what the objections to my version are, I can't really give more detail. Now that I've given some info, I'll revert, and wait for Derek farn to respond. –MT 06:19, 25 May 2008 (UTC)

Yes it is a broad introduction, just what a reader new to the article would appreciate. Is the HTML of a web page source code (some people do not consider it to be a computer language)? Derek farn (talk) 07:20, 25 May 2008 (UTC)
It is not obvious that a two would phrase can be split into single word forms, there are many that cannot be so split. Derek farn (talk) 07:20, 25 May 2008 (UTC)
Source code need not be compiled, it can be interpreted as-is. I appreciate that statements/declarations sounds technical, but then people want to know what source code contains. Derek farn (talk) 07:20, 25 May 2008 (UTC)
Happy either way, so lets move the material to a subsection. The rewrite was not clearer. Derek farn (talk) 07:20, 25 May 2008 (UTC)
Please don't make major changes to an article that has had substantial work one on it. Work out major new wording changes here first. Derek farn (talk) 07:20, 25 May 2008 (UTC)
Please don't respond into the middle of comments. 1) There's some confusion: I stated that compsci is too broad a supercategory for source code, not that the intro was too broad. If anything, it's too narrow. I'm not sure what your comment about HTML is in reference to. 2) Comments about word use seem to be more lexicographic than encyclopedic, and "code" or "source" are informal. 3) Right - and my edit stated that code might be interpreted. Again, the main point is that talking about 'statements' and 'declarations' doesn't help anyone except people who already know what code is. 4) Ok
Your suggestion that major changes to an article should be discussed on the talk page strikes me as absurd. I made the edits in good faith, and this is not a controversial article. I gave reasons for my edit, and asked you to explain why you reverted it. It seems the only reason you gave for reverting it was "don't change substantial work". You pointed out that the rewrite was not clearer, but didn't give reasons why. Please point out which parts of my edit were less clear, and specifically what was technically inaccurate.–MT 09:26, 25 May 2008 (UTC)

java?[edit]

i think java isa terrible example of code, its not a real programming language

While many people may not "like" Java, it's clearly a "real" programming language, and a very widely- and well-known language too, which makes it very suitable for example purposes. Do you have a suggestion of a better language for example code? jsled (talk) 16:49, 3 December 2008 (UTC):
A more widely used and accepted programming language is C++ or C#, that would be a better example.
I don't believe either is more widely used, actually. I'd love to see hard data either way. The TIOBE index, while totally lame and flawed in its own ways, does regularly list Java (and C) well ahead of C# and C++ in terms of demand. http://langpop.com/ also has Java at or near the top of many of the lists. See Measuring programming language popularity for more on this. jsled (talk) 21:49, 23 June 2009 (UTC)
Indeed, maybe we should switch to a classical and less complex example like Hello World in C:
 main()
 {
        printf("hello, world");
 }

cheers Shaddim (talk) 13:27, 2 July 2013 (UTC)

Licensing, GPL[edit]

I reverted a change making the Licensing section specific to the GPL, instead of general. My motivation for doing so was:

  1. The GPL – while hugely important – is not the exclusive means by which "free" software is licensed.
  2. I think the claim that "most" free software is licensed under the GPL need some justification.

I do think it's be reasonable for the GPL to have a line or two in the Licensing section, but the wording as reverted was just too strong. jsled (talk) 14:50, 5 March 2009 (UTC)

This page cited by US District Court[edit]

For general information, the third paragraph of this article:

A computer program's source code is the collection of files needed to convert from human-readable form to some kind of computer-executable form. The source code may be converted into an executable file by a compiler, or executed on the fly from the human readable form with the aid of an interpreter.

was cited by the United States District Court, D. Utah, Northern Division, in footnote 42 of a controversial [3] order against ASUS, Phillip M. Adams & Associates, L.L.C., v. Dell, Inc., 2009 WL 910801 (D.Utah March 30, 2009). Changes to that paragraph should be more deeply considered than usual. travisl (talk) 16:01, 6 May 2009 (UTC)

Does this imply I shouldn't have changed it? (Thought experiment: a human reading PostScript, or APL.) Rp (talk) 00:20, 21 January 2011 (UTC)

Multicourt law making[edit]

I am looking for the word or concept that describes nefarious effect of multiple legal disputes (as in the same [potential] violation investigated [or ruled upon] by multiple courts simultaneously). I am looking for such a term in either applied law, or in law theory litterature.

To the (small) extent that law can be compared to indeterministic computer code. Trying to match by analogy:


Analogy between law and source code
legal computational
politics programming
laws computer code
(effective or ideal) jurisdiction (real or virtual) computer machine
evidence data,parameters
court case (including lawyers, judge,...) processor (including instruction fetching and interpretation and execution)
court ruling output
multiple simultaneous courts

(using evidence from the other courts)

multithreading
multicourt-safe law [making]

(ruling doesn't depend on variable order of progress in each court)

threadsafe program[ming]

In theoretical and applied programming the demonstrated nefarious effects of writing code from the assumption of 1 actor(theoretical)/processor(practical) has been demonstrated.

Is there a subject in law theory that describes the same theoretical problems or practical precedents? What is it called? —Preceding unsigned comment added by 157.193.12.146 (talk) 00:03, 28 December 2010 (UTC) A sort of lawlessness of concurrency in law. An important distinction between persons and institutions, is that organizations can arm themselves with LKBS software to find loopholes through this lawlessness whereas individuals in similar situations do not have this access to the law. —Preceding unsigned comment added by 157.193.12.146 (talk) 00:28, 28 December 2010 (UTC)

Offical source of the open source software that is used by Wikipedia itself.[edit]

Shouldn't there be a link somewhere for the very software used by WikiPedia?

http://www.mediawiki.org/wiki/MediaWiki

Maerklin44 (talk) 15:30, 10 November 2009 (UTC)

Source Code[edit]

The usage of Source Code is under discussion. It currently redirects to source code. The discussion is at Talk:Source Code (film) .

184.144.160.156 (talk) 04:53, 12 March 2011 (UTC)

"Corrections" of 72.234.84.49 and Rp[edit]

As 72.234.84.49 (talk · contribs) noted, there is an unclear terminology here. But lacks of clarity depends on the programming language/computer language terms confusing, see the article. Despite the tangle, no one classifies HTML as a programming language, but there is a term "HTML source code".

Next, I do not agree that an interpreter must translate something to machine code (there is at least two severe objections to it), and by no means a removal of {{fact}} request may be considered as some improvement or "cleanup". I reverted all changes of Rp (talk · contribs) as apparently non-constructive. Incnis Mrsi (talk) 09:34, 9 March 2012 (UTC)

Please, explain what is wrong. What are those objections? In what way is interpreting an interpreted language not translating it to a machine-executable form? Rp (talk) 15:19, 9 March 2012 (UTC)
Objection are directed to the word "translate [to machine code]". This wording suggests that an interpreter is a kind of self-modified program, which is usually far from being true. But even in a less literally sense an interpreter is not obliged to know anything about the machine language.
First, an interpreter program can be designed platform-independently and executed on a wide range of platforms, including virtual machines. If something is translated to machine code, then it is the source code of the interpreter, not a code to be interpreted.
Second, an interpreter not necessary is a program executed on one box. Imagine a web-application accepting requests written in some language. This application translates such language to, say, SQL and passes it to a MySQL server on another machine. Which machine's code is "the source code" translated to?
Incnis Mrsi (talk) 15:44, 9 March 2012 (UTC)
Thanks for clarifying. I don't understand how there is any suggestion of self-modifying code, but I agree with your first point. Rp (talk) 16:08, 9 March 2012 (UTC)

Human-readable[edit]

I've seen that Rp removed here the assertion that source code is human-readable. How is it debatable that source code "can be naturally read by humans"? The moment it can't be naturally read, it ceases to be source code but an intermediate representation. Also human-readable is opposed to machine-readable, which is explicitly understood as not-source-code. Diego (talk) 10:15, 9 March 2012 (UTC)

This is debatable because one person's intermediate form may be another person's source code (e.g. some people program in assembly language, others only use it as an intermediate form); most Lisp is compiled to a different form, but dedicated Lisp machines have been built; etc.) and all programming languages must be learnt, to a highly varying extent, before they can be read by humans. Furthermore, source code is machine-interpretable - it's just that in most (but not all) cases, the machine does so by first interpreting or compiling the code to a form it can interpret directly.
I removed the phrase specifically because the existing formulation "human-readable computer programming language." suggests that
  • All source code is in a programming language (which is not true).
  • There are also programming languages which are not human-readable (which is debatable) and text written in those is not called source code (which is also debatable).
and I didn't see a good way to fix those problems. It would be better to fix them. I do agree that source code is code written in a language designed to be more human-readable than, say, code in binary form as interpreted by machines. Rp (talk) 15:14, 9 March 2012 (UTC)
Rp what you say about each person's knowledge is true, but unrelated to the topic. What you describe are high and low-level programming languages, which are a different beast. The source/machine code distinction has always been about the initial form in which the programmer works at whatever the abstraction level.
Even for machine code there is a distinction between Assembly language, which is the text that the programmer edits, and the binary code created by the assembler. When the programmer enter a memory dump in Hex to tweak individual memory cells, that is not a programming language nor considered "the source".
The moment the text is detached from its symbolic human-readable representation and parsed by the interpreter/compiler, it's transformed into an abstract syntax tree that is no longer human-readable and usually only exists in memory; and then it's no source code anymore. Even in Lisp where the language and the program and the AST share the same structure there is a difference between the symbols as sequences as characters in source code and the symbols as references in the compiled memory structure. Some processes can mud the waters a bit (think Java to bytecode, bytecode to a JIT binary, to micro-ops, to transistor signals); but only the first one is the source.
In short, I find that the current version addresses your concerns and it's accurate. It's debatable that there are programming languages that are not human-readable (I can think of Jacquard looms and music boxes), but in that case we couldn't say that they have source code. Diego (talk) 16:09, 9 March 2012 (UTC)
It's not accurate: e.g. the untrue assertion that all source code consists of instructions, statements or declarations has crept back in. Rp (talk) 16:16, 9 March 2012 (UTC)
Good call - though the lead doesn't say that "all" source code is instructions, mentioning comments is sensible. Diego (talk) 16:37, 9 March 2012 (UTC)
(Why there isn't a section for commentary, BTW)? Diego (talk) 16:39, 9 March 2012 (UTC)
The issue is not just comments, but also the fact that many languages are not imperative programming languages. E.g. HTML elements, Prolog clauses, INI file entries, etc. etc. are not instructions; they may be called declarations, but it is not customary to do so. Rp (talk) 13:27, 12 March 2012 (UTC)
Ah, I understand your concern. However, I think as long as some text is called source "code", that's because it's seen as "instructions to a computer" even if those instructions are declarative in nature. Your HTML example would be "instrutions to display a rendered web page in a browser". This uses the meaning of "instructions" in English, not the technical jargon meaning to "instructions available in a processor's instructions set or a programming language's API". Diego (talk) 16:20, 12 March 2012 (UTC)
The act of instructing, teaching, or furnishing with information or knowledge: certainly there's furnishing of information, but what is the act? Rp (talk) 21:33, 12 March 2012 (UTC)

Repeated attempts to remove "computer language"[edit]

You can remove it a hundred of times, but this will not make HTML a "programming language". The fact that computer language is a redirect indicates confusing terminology and laziness of some Wikipedians which are unable to create an article existing in a dozen of languages. Any time these words will disappear, I will insert it back. Incnis Mrsi (talk) 18:10, 9 March 2012 (UTC)

Who is "you"? I agree with you 100%. Then again, you know how it is with languages. Many people have never thought of document formats as languages and have only heard of programming languages and natural languages. Rp (talk) 23:47, 9 March 2012 (UTC)

Lead[edit]

The lead seems a bit long to me. After the first paragraph, most of it should probably be in it's own section and/or removed.

Example: "The source code which constitutes a program is usually held in one or more text files stored on a computer's hard disk; usually these files are carefully arranged into a directory tree, known as a source tree. Source code can also be stored in a database (as is common for stored procedures) or elsewhere." That should either be removed, or added into the organization section. Thoughts? CharmlessCoin (talk) 22:49, 18 February 2013 (UTC)