Best way to learn programming

Chronos:

Well, actually you can write conditionals and loops in HTML. They’re probably not what you had in mind, but it is possible. I’m wondering at your requirement, though. If I write code in an accepted language (say C++), however I don’t actually write a loop or a conditional, does that mean I’m not programming?

But I digress; you asked for proof of looping and conditionals in HTML. A simmple loop can be constructed with the META / refresh element. You can have a page automatically load a different page and the second page automatically load the first, and so on. Granted, this loop is of limited usefulness, but it IS technically a loop. Conditionals are much easier to demonstrate and more useful. Consider the ‘ALT’ attribute for some elements. This option renders text IF the browser does not support rendering of the principle element. Also consider special elements like <NOFRAMES> and <NOSCRIPT>, that render pages differently, based on support conditions. On a very primitive level, all tags can be considered to be conditionals: IF <B> THEN TurnOnBoldFace … IF </I> THEN TurnOffItalicFace… OK, that may be stretching it a bit, but it’s not radically different than setting attributes in a language like LISP based on a predicate.

Also, to further blur the distinction between HTML and a “real” programming language, the HTML spec refers to data types, objects, classes, declarations, assignments, event driven actions, scope, inheritance and precedence. These are all programming constructs. Hyper links, especially to anchors in the same document or frames, look a lot like function calls.

Given the amount of time I’ve spent ‘debugging’ HTML code, it certainly feels like programming sometimes. So, if it looks sort of like a duck and it quacks sort of like a duck… maybe it’s a duck.

Intuitively, I agree with your premise (coding HTML is not programming), however I’ve yet to see strong evidence to the contrary, in this discussion or others, so I’m withholding my official judgement until someone says something truely definitive…

Arjuna34:

That’s too simplistic, I think. There are a number of non-Turing programming models ‘out there’. Analog computers, BBS machines, artificial neural networks, and finite directed graphs to name a few.

This isn’t a programmatic loop, its just a repetitive action that the browser performs. Having a META tag refresh the page does not involve any logic, so this still would not be considered “real” programming.

The alt tag shows text no matter what…the only difference is how the browser handles the display of the text (whether the text will entirely replace the image, or if it will just show up in a little box when the mouse hovers over the image). Thus it is the browser, not the HTML code, that is using conditional logic.

Again, I have to disagree with this along the same lines as the ALT example. The HTML is not conditionally deciding what data is being delivered to the client. Instead, ALL of the HTML is being sent to the client, and the browser then decides, conditionally, what to display. The HTML doesn’t have any say in whether the frames are going to be displayed or not. The browser is the only thing making a conditional decision here.

HTML code provides a set of instructions that a browser interprets. Is this really any different from an interpreted programming language like QBasic? After all, it is QBasic.exe that actually performs the logic, not the code itself.

(Of course, HTML would make a piss-poor programming language, even if it is one, but that’s beside the point.) :slight_smile:

      • A data base language is good to have also; most business programming will involve at least one database. - MC

But each of those can be modeled with a Turing machine, and vice versa, hence they are all programming systems. I can make a Turing machine out of Conways Game of Life, or a neural network. I can’t make one with HTML code, so it’s not a programming language.

Arjuna34

Starbury:

Ahh… well… if you’re going to further define ‘loop’, then of course, we could exclude nearly any programming language if we so chose. [wink] I disagree that it does not include any logic, however, because you can define the time it takes for the refresh to take effect. Again, I’m not professing that this is in any way an example of useful looping, I’m only saying that it COULD be construed to match one of Chronos’ criteria for a programming language.

I’m going to address the next two points somewhat out of order:

You seem to have your concepts confused. Of course, it’s the browser that is executing the conditional logic… in the same way that a perl interpreter is responsible for executing the conditional logic of a perl script or a java engine is responsible for executing the conditional logic of java code.

Actually, that’s browser dependent. Some browsers don’t pre-render the text. However, that’s really beside the point. At some point the browser is making a decision whether to render the prescribed element or not.
Arjuna34:

I’m confused. Are you talking about programmable systems or programming languages? I do not disagree that non-Turing systems can typically be modeled with Turing machines, but I fail to see the exact relevance to programming languages. Certainly, a Touring machine can process HTML, but if you’re trying to say that a programming language must be able to model a Turing machine, then I disagree. Many other generally accepted programming languages would be ruled out by this requirement.
Again, I reiterate, I’m not trying to defend HTML as a programming language - I’m just looking for a legitimate reason to rule out the possibility. On the other hand, I might note that the “Language List” a list of all known programming languages maintained on comp.lang.misc does, in fact, include HTML as a programming language. The opinions of experts is hardly proof, but it is an interesting data point, no?

The originial scope of the discussion was programming languages, but by bringing up neural networks and analog computers in your previous post, you widened it to programming systems. Limiting it to programming languages, if a “programming language” can’t be used to create a Turing machine, then it’s not a true programming language. I claim (without proof of course ;)) that that is a definition of a programming language. Can you name any “generally accepted” programming language that can’t??

I’m not sure, but maybe it’s possible with tricky use of the refresh time, and a huge number of small html files, to make a state machine, that could then be used to program an algorithm. I have a feeling that it wouldn’t work, but I’m not 100% convinced yet. One fundamental problem preventing HTML from being a true language is the lack of any state memory, but the refresh time just might be a way to cleverly encode state information.

Arjuna34

Frankly, the ONLY way to learn how to program is on a Commodore 64, in BASIC, at 3 in the morning when Mom and Dad think you are asleep, trying to get it to do half the stuff the kid in WarGames got his computer to do. Anything else is the wimpy way out. :stuck_out_tongue:

You bring up a fair point. I draw a distinction between a programming language and the act of programming. I was trying to indicate that one can program without benefit of a language, and therefore non-Turing programming architectures violate your premise. However I didn’t really articulate my point well and it’s really an argument about programming - not about programming languages, per se. Mea culpa.

I’m pretty sure that you would not be able to model a Turing machine in Prolog. Also, in early versions of common LISP there were no loop and goto/jump constructs (in fact, most LISP purist still refuse to acknowledge and use these control structures). Without these, I don’t think you could model a Turing machine in LISP (perhaps other functional languages would be similarly limited). I’m reasonably sure there are other ‘legitimate’ programming languages that would fail your new Turing test.

Ditto. You could use it to program a counter, slide show, or other sequential display function, but not much else.

Hey, now that’s a pretty good argument. I can’t think of any useful programming language that doesn’t support state memory and I can’t think of an HTML equivalent.

keeper0:

C’mon keeper. Even that’s wimpy by some standards. The first real program I wrote was around 1978 in assembly language on a Trash-80 (Radio Shack TRS-80). As I remeber, I had to squeeze it into 4K… Tic-Tac-Toe (in case you’re interested).

To continue hijaaking the OP … :slight_smile:

Here’s a link to a Prolog Turing machine:
http://kti.mff.cuni.cz/~bartak/prolog.old/samples.html

Here’s a link to a discussion of Lisp and Turing machine computability:
http://www.umcs.maine.edu/~chaitin/nv.html

Actually, that link is a little more general, but shows that Lisp has plenty of power to emulate a Turing machine. This link gives a good history of Lisp (one of the oldest languages). It was created specifically to avoid the constructs that Turing-type languages tend to have- goto, jump, etc., as you point out. However, it still has conditionals, and thus program flow control of SOME kind, enabling it to emulate a Turing machine. In fact, the first unix Fortran compiler was written in Lisp.

BTW, the only REAL way to learn to program is with your Sinclair ZX-81, which only had 1K of RAM (although since it tokenized BASIC programs, that was a fair amount). I had a 32K external memory “card”, but the computer would crash if it was jostled slightly due to the bad connection (I usually duct-taped it) :slight_smile:

The Trash-80 was a classic!

Arjuna34

Oops, forgot the link:
http://www-formal.stanford.edu/jmc/history/lisp/lisp.html

Arjuna34

Arjuna:

I stand corrected and thoroughly humbled.

I don’t remember my Prolog well enough to understand how their example works, but I’ll take their word for it. The LISP implementation was actually blindingly obvious and I was obviously blind… Now I can think of dozens of ways to do it.

Conditionals, recursion and a stack is all you need for any functional programming language to implement a Turing machine (I think).
Well, we’ve thoroughly ransacked this thread, but it’s been fun.

[PYTHON=1]
Luxury! Sheer luxury! You haven’t lived until you’ve programmed a racing game into a Casio graphing calculator in some crappy Basic clone, with your thumbs, trying to keep it small enough you can still run the damn thing with any speed! (The Casio calculator uses the same RAM for memory and program execution.) You get a good appreciation for just how simple a calculator can be and still accept programming code when you attempt that. But you try to tell that to the kids today and guess what? They won’t believe you! :smiley:
[PYTHON=0]

At least you had a crappy BASIC!! Try writing a program to compute trig functions, on a 4-bit microprocessor, in assembly language! This crippled processor only had a 6-bit program counter, so every 64 instructions you had jump to the next 64-byte page of code- argh! (Don’t ask why a 4-bit processor was computing 32-bit trig functions!)

Did I mention I had to walk to work uphill, both ways?
Well, I think the thread is completely off course now :slight_smile:

Arjuna34

      • Well, not quite.
  • The only person I know of who does commercial website related stuff for a large company knows not only a lot about HTML, but also a lot about JavaScript, some PERL, some CGI, different browsers, a fair amount about different server software peculiarities, web security and internet/web/network issues, as well as about stuff like Flash, Quicktime, and other things I’m likely forgetting. He doesn’t use all that stuff on every page, but he generally does know how it’s done, because he’s had to do it there before.
  • I note my local (somewhat thick) 2-year college has a class in Flash, but not one in any Unix/Linux OS, or any database language. - MC

Derleth:

Been there, done that, except it was a HP41CV calculator, there were no cushy bitmapped graphics (you had to do everything within 24 of those star-like, 16 element LCD characters), and of course the built-in language was too restrictive so I had to resort to byte-jumping and synthetic programming (machine code) to do anything interesting like animation. Synthetic programming on HP41s was not for the timid. First, it was not well documented - usually I was working from notes on the backs of cocktail napkins. Second, it was very tedious - it could take you days to code a 2K program. Third, it was not robust and not supported by HP - one slight misstep and you could lock up your ‘machine’ or wipe out your entire memory and have to start over…

Now THAT was programming!!!