My teacher is teaching HORRIBLE THINGS

A place to discuss the implementation and style of computer programs.

Moderators: phlip, Moderators General, Prelates

afarnen
Posts: 157
Joined: Mon May 05, 2008 12:12 pm UTC

My teacher is teaching HORRIBLE THINGS

Postby afarnen » Mon Mar 09, 2009 5:31 am UTC

I'm taking AP Computer Science at my high school, and in the same classroom, Web Design is being taught by the same teacher. So, when I'm busy screwing around in Java, I often overhear some of the things that he teaches his students. Sometimes I just want to interrupt the class... or teach it myself!

For example, they're learning HTML. Some things the class has learned:

The great <marquee> tag
Not closing <p> tags or <img> tags, etc.
Not enclosing attribute values in quotes, e.g. <img border=2 src=..>
"PNG images aren't supported by all browsers", so they only use JPEG (lossy compression) and GIF (patent infringement). And they don't even know about SVG!

So pretty much, if there's a web standard, this class teaches the opposite. The only exception to this (I was very surprisingly pleased) was that the teacher taught the students the difference between the WWW and the Internet.

Another thing that slightly ticked me off was when I found out that the material my class was learning was out-of-date Java (see http://forums.sun.com/thread.jspa?threadID=5370348&tstart=0). I use the correct syntax in my code, but my teacher doesn't make the effort to follow a freaking standard, so the class doesn't either.

So has anyone else been in some similar situation that just pissed them off like this? Or am I just too nitpicky?

EDIT: BTW since when is writing simple Java programs considered to be a course in "Computer Science"?

Imagist
Posts: 15
Joined: Sat Mar 07, 2009 8:53 pm UTC

Re: My teacher is teaching HORRIBLE THINGS

Postby Imagist » Mon Mar 09, 2009 5:43 am UTC

Assuming you're taking AP Comp Sci as a lead-in to taking CS in college, which is a lead-in to a CS job, get used to this as soon as possible. Your CS profs in college will probably be a bit better than most, but there are still a LOT of people who teach and write code with bad coding practices (non-standards-compliance is just the tip of the iceburg). Even more fun news - YOU will write bad code too.

The key is, keep learning and do everything you can to leave every piece of code you touch better than you found it.

To answer your question; you aren't being too nitpicky; nitpicky=ness is what will make you a better programmer. It's just that there's little point applying your nitpicky-ness to your teacher, since there's not much you can do about him. Apply your nitpicky-ness where it can make a difference.
I realize this post will not endear me with most of its readers. If everything agrees with what you say, it's not worth saying.

User avatar
Likpok
Posts: 471
Joined: Tue Feb 20, 2007 6:21 am UTC
Location: :noitacoL
Contact:

Re: My teacher is teaching HORRIBLE THINGS

Postby Likpok » Mon Mar 09, 2009 6:56 am UTC

afarnen wrote:"PNG images aren't supported by all browsers", so they only use JPEG (lossy compression) and GIF (patent infringement). And they don't even know about SVG!


JPEG is great. Understanding why it is great is far beyond an undergraduate course, however (at least at my school, information theory is reserved for the grad students).
There's an art to cooking toast
Never try to guess
Cook it till it's smoking
Then twenty seconds less.

User avatar
hotaru
Posts: 1045
Joined: Fri Apr 13, 2007 6:54 pm UTC

Re: My teacher is teaching HORRIBLE THINGS

Postby hotaru » Mon Mar 09, 2009 7:14 am UTC

afarnen wrote:GIF (patent infringement)

didn't that expire?

Code: Select all

factorial product enumFromTo 1
isPrime n 
factorial (1) `mod== 1

afarnen
Posts: 157
Joined: Mon May 05, 2008 12:12 pm UTC

Re: My teacher is teaching HORRIBLE THINGS

Postby afarnen » Mon Mar 09, 2009 7:36 am UTC

hotaru wrote:
afarnen wrote:GIF (patent infringement)

didn't that expire?

Oh, it has. Oops. I could make an excuse about being too tired to verify things before I post them...

TZer0
Posts: 16
Joined: Fri Nov 07, 2008 11:52 am UTC

Re: My teacher is teaching HORRIBLE THINGS

Postby TZer0 » Mon Mar 09, 2009 7:41 am UTC

Happens all the time. Some people just shouldn't touch code.

sje46
Posts: 4730
Joined: Wed May 14, 2008 4:41 am UTC
Location: New Hampshire

Re: My teacher is teaching HORRIBLE THINGS

Postby sje46 » Mon Mar 09, 2009 7:44 am UTC

Are you in my class? My teacher doesn't close <p> tags either. And I wished he told us to close <hr> and <br> and stuff like that. I do it anyway.

Question: is it good practice to capitalize HTML code? It bothers me when he does it, and I just do mine in all lowercase. I know it doesn't matter for this language, but still.
General_Norris: Taking pride in your nation is taking pride in the division of humanity.
Pirate.Bondage: Let's get married. Right now.

User avatar
jemthealmighty
Posts: 145
Joined: Fri May 23, 2008 6:55 am UTC
Location: Dubbo, NSW, Australia
Contact:

Re: My teacher is teaching HORRIBLE THINGS

Postby jemthealmighty » Mon Mar 09, 2009 7:50 am UTC

sje46 wrote:Question: is it good practice to capitalize HTML code? It bothers me when he does it, and I just do mine in all lowercase. I know it doesn't matter for this language, but still.


As far as I understand, I haven't actually gone and looked up the specs, it is fine for html but incorrect for xhtml.

User avatar
Xeio
Friends, Faidites, Countrymen
Posts: 5101
Joined: Wed Jul 25, 2007 11:12 am UTC
Location: C:\Users\Xeio\
Contact:

Re: My teacher is teaching HORRIBLE THINGS

Postby Xeio » Mon Mar 09, 2009 8:20 am UTC

afarnen wrote:I'm taking AP Computer Science at my high school
Sadly, this seems to be how a majority of high school classes are. My class taught using an ancient book (like, 12 years old...), with a compiler that barely seemed to work all the time, and a teacher whom had never actually taught the subject before (actually, the class itself hadn't even been taught for a few years because of no interest...).

I didn't even realize how bad it actually was until I started my college courses. I'm just glad none of the bad practices I learned took root.

User avatar
squealer
Posts: 9
Joined: Sat Sep 22, 2007 1:22 pm UTC
Location: Perth, W.A.

Re: My teacher is teaching HORRIBLE THINGS

Postby squealer » Mon Mar 09, 2009 8:23 am UTC

jemthealmighty wrote:
sje46 wrote:Question: is it good practice to capitalize HTML code? It bothers me when he does it, and I just do mine in all lowercase. I know it doesn't matter for this language, but still.


As far as I understand, I haven't actually gone and looked up the specs, it is fine for html but incorrect for xhtml.


Correct, all XHTML tags must be lowercase.

sje46
Posts: 4730
Joined: Wed May 14, 2008 4:41 am UTC
Location: New Hampshire

Re: My teacher is teaching HORRIBLE THINGS

Postby sje46 » Mon Mar 09, 2009 8:43 am UTC

squealer wrote:
jemthealmighty wrote:
sje46 wrote:Question: is it good practice to capitalize HTML code? It bothers me when he does it, and I just do mine in all lowercase. I know it doesn't matter for this language, but still.


As far as I understand, I haven't actually gone and looked up the specs, it is fine for html but incorrect for xhtml.


Correct, all XHTML tags must be lowercase.

UUUGGG. I thought so. And the funny thing is that he's going to teach us XHTML in the class too! I guess he wants us to learn things incorrectly so that he can have something to teach about whne he gets there? Stupid.
General_Norris: Taking pride in your nation is taking pride in the division of humanity.
Pirate.Bondage: Let's get married. Right now.

User avatar
Emu*
Posts: 689
Joined: Mon Apr 28, 2008 9:47 am UTC
Location: Cardiff, UK
Contact:

Re: My teacher is teaching HORRIBLE THINGS

Postby Emu* » Mon Mar 09, 2009 9:27 am UTC

He's right about png, a lot of people still use IE6 [shudders] because it came with XP and they just use "the internet"... Bane of many a webdev's life.

IE6 does not support PNG-alpha, and IE7, FF and Safari each have different ideas about colour spaces (so using photoshop for PNG is actually not a good idea).
Cosmologicon wrote:Emu* implemented a naive east-first strategy and ran it for an hour, producing results that rivaled many sophisticated strategies, visiting 614 cells. For this, Emu* is awarded Best Deterministic Algorithm!

mrkite
Posts: 336
Joined: Tue Sep 04, 2007 8:48 pm UTC

Re: My teacher is teaching HORRIBLE THINGS

Postby mrkite » Mon Mar 09, 2009 9:34 am UTC

Emu* wrote:He's right about png, a lot of people still use IE6 [shudders] because it came with XP and they just use "the internet"... Bane of many a webdev's life.

IE6 does not support PNG-alpha, and IE7, FF and Safari each have different ideas about colour spaces (so using photoshop for PNG is actually not a good idea).


That's no reason to not use PNGs. PNGs are smaller than GIFs and IE6 does support 1bit transparency with PNGs (same as GIFs).

And PNGs saved for web don't have a color profile... so you don't need to worry about that either.

User avatar
Emu*
Posts: 689
Joined: Mon Apr 28, 2008 9:47 am UTC
Location: Cardiff, UK
Contact:

Re: My teacher is teaching HORRIBLE THINGS

Postby Emu* » Mon Mar 09, 2009 9:57 am UTC

Even without a colour space, IE and FF render differently; iirc, IE ends up lighter.

This means you can't use a top-attached repeat-x background to fade the top of a box without messying the markup or looking rubbish.
Cosmologicon wrote:Emu* implemented a naive east-first strategy and ran it for an hour, producing results that rivaled many sophisticated strategies, visiting 614 cells. For this, Emu* is awarded Best Deterministic Algorithm!

User avatar
Cosmologicon
Posts: 1806
Joined: Sat Nov 25, 2006 9:47 am UTC
Location: Cambridge MA USA
Contact:

Re: My teacher is teaching HORRIBLE THINGS

Postby Cosmologicon » Mon Mar 09, 2009 11:28 am UTC

afarnen wrote:Not closing <p> tags or <img> tags, etc.
Not enclosing attribute values in quotes, e.g. <img border=2 src=..>

So pretty much, if there's a web standard, this class teaches the opposite.

Huh? What's wrong with that? I don't put quotes around attributes if I don't have to, nor do I close p or img tags. (I can see a case for closing p's, but you probably shouldn't close img's or br's.) I also don't close td's or li's, and I use whatever capitalization I feel like. I learned HTML by reading the W3C standard.

I get the impression that some people think that you should work at the intersection of HTML and XHTML. But I think it's better to pick one and stick with it.

User avatar
jemthealmighty
Posts: 145
Joined: Fri May 23, 2008 6:55 am UTC
Location: Dubbo, NSW, Australia
Contact:

Re: My teacher is teaching HORRIBLE THINGS

Postby jemthealmighty » Mon Mar 09, 2009 12:00 pm UTC

Cosmologicon wrote:Huh? What's wrong with that? I don't put quotes around attributes if I don't have to, nor do I close p or img tags. (I can see a case for closing p's, but you probably shouldn't close img's or br's.) I also don't close td's or li's, and I use whatever capitalization I feel like. I learned HTML by reading the W3C standard.

I get the impression that some people think that you should work at the intersection of HTML and XHTML. But I think it's better to pick one and stick with it.

True that in html most of these things will validate and never cause a problem but they are still bad practice and makes for generally unstable (rendering differences between browsers with unpredictable results) web pages.

User avatar
Cosmologicon
Posts: 1806
Joined: Sat Nov 25, 2006 9:47 am UTC
Location: Cambridge MA USA
Contact:

Re: My teacher is teaching HORRIBLE THINGS

Postby Cosmologicon » Mon Mar 09, 2009 12:12 pm UTC

jemthealmighty wrote:
Cosmologicon wrote:I don't put quotes around attributes if I don't have to, nor do I close p or img tags. (I can see a case for closing p's, but you probably shouldn't close img's or br's.) I also don't close td's or li's, and I use whatever capitalization I feel like.

True that in html most of these things will validate and never cause a problem but they are still bad practice and makes for generally unstable (rendering differences between browsers with unpredictable results) web pages.

No it doesn't. Name one instance.

User avatar
phlip
Restorer of Worlds
Posts: 7573
Joined: Sat Sep 23, 2006 3:56 am UTC
Location: Australia
Contact:

Re: My teacher is teaching HORRIBLE THINGS

Postby phlip » Mon Mar 09, 2009 12:28 pm UTC

Closing <p> tags in HTML is optional... I do it, mostly from habit, but if you don't it's valid, and behaviour is well-defined. Closing img/br/etc tags in HTML is invalid.

Quoting attributes is also optional in HTML (but invalid in XHTML), but a good idea anyway (it's rather touchy... including the quotes is a good idea for the same reason it's a good idea to include braces around a single-statement block in a C-like language... makes it less likely to break if you come back and change something later).

HTML and XHTML are different beasts. Sure, they've got a lot of similarities, but it's important to know the differences. Sure, using the things that are valid in both (quoting attributes, closing <p> tags, using lowercase) are all well and good, but if you try to put something XHTML-only in an HTML document (like <br></br> or, worse, <br />) then you're doing it wrong.

Code: Select all

enum ಠ_ಠ {°□°╰=1, °Д°╰, ಠ益ಠ╰};
void ┻━┻︵​╰(ಠ_ಠ ⚠) {exit((int)⚠);}
[he/him/his]

User avatar
Emu*
Posts: 689
Joined: Mon Apr 28, 2008 9:47 am UTC
Location: Cardiff, UK
Contact:

Re: My teacher is teaching HORRIBLE THINGS

Postby Emu* » Mon Mar 09, 2009 12:37 pm UTC

Browsers in HTML mode should accept <br /> and <img ... />, treating the / as an attribute (like "selected")
Cosmologicon wrote:Emu* implemented a naive east-first strategy and ran it for an hour, producing results that rivaled many sophisticated strategies, visiting 614 cells. For this, Emu* is awarded Best Deterministic Algorithm!

User avatar
phlip
Restorer of Worlds
Posts: 7573
Joined: Sat Sep 23, 2006 3:56 am UTC
Location: Australia
Contact:

Re: My teacher is teaching HORRIBLE THINGS

Postby phlip » Mon Mar 09, 2009 1:26 pm UTC

No, attributes must be alphanumeric (plus hyphens) and start with a letter.

Strictly speaking, browsers in HTML mode should accept <br /> as a line break with a "null end tag", followed by a greater-than sign (ie the same as <br>&gt;). Though, the only browser I know of that actually reads NET shorttags properly at all is lynx, and even that will read <br /> as a single line break, not a line break + greater-than.

Plug "NET shorttag" into Google to get more arcane and useless information than you ever wanted to know about SGML.

Try it: plug

Code: Select all

This is a <b/phrase in bold/, this word is <em/emphasised/.
into an HTML document. Lynx will render it correctly. The other common example is a link:

Code: Select all

<a href=http://www.example.com>Text</a>
is strictly equivalent to:

Code: Select all

<a href="http:"></a>www.example.com&gt;Text</a>
(complete with invalid extra close-tag).

Code: Select all

enum ಠ_ಠ {°□°╰=1, °Д°╰, ಠ益ಠ╰};
void ┻━┻︵​╰(ಠ_ಠ ⚠) {exit((int)⚠);}
[he/him/his]

User avatar
sparkyb
Posts: 1091
Joined: Thu Sep 06, 2007 7:30 pm UTC
Location: Camberville proper!
Contact:

Re: My teacher is teaching HORRIBLE THINGS

Postby sparkyb » Mon Mar 09, 2009 4:23 pm UTC

I've never heard of that usage but I do know that most browsers even in HTML mode will correctly handle <br /> as if it were the same as the XHTML equivalent. However, I've done some tests and although that form seems to work with <br>, there were a number of other tags that don't contain text (and therefore don't need to be closed) where it did not render correctly.

User avatar
Cosmologicon
Posts: 1806
Joined: Sat Nov 25, 2006 9:47 am UTC
Location: Cambridge MA USA
Contact:

Re: My teacher is teaching HORRIBLE THINGS

Postby Cosmologicon » Mon Mar 09, 2009 4:28 pm UTC

phlip wrote:Closing <p> tags in HTML is optional.... Closing img/br/etc tags in HTML is invalid.

To be clear, there are several tags that, like p, have optional end tags. These are colgroup, dd, dt, li, option, tbody, td, tfoot, th, thead, tr, and, apparently, head, body, and html. The end tag column of this document gives a complete list.

sje46
Posts: 4730
Joined: Wed May 14, 2008 4:41 am UTC
Location: New Hampshire

Re: My teacher is teaching HORRIBLE THINGS

Postby sje46 » Mon Mar 09, 2009 4:29 pm UTC

Sorry, I'm confused. IS it a bad idea to close <br> tags in html, or is it just unnecessary? It's okay for some browsers but not for others?
General_Norris: Taking pride in your nation is taking pride in the division of humanity.
Pirate.Bondage: Let's get married. Right now.

User avatar
Cosmologicon
Posts: 1806
Joined: Sat Nov 25, 2006 9:47 am UTC
Location: Cambridge MA USA
Contact:

Re: My teacher is teaching HORRIBLE THINGS

Postby Cosmologicon » Mon Mar 09, 2009 4:35 pm UTC

sje46 wrote:Sorry, I'm confused. IS it a bad idea to close <br> tags in html, or is it just unnecessary? It's okay for some browsers but not for others?

It's invalid (meaning it doesn't comply with the official standard, but it'll work on 99.999% of your users' browsers. Whether that makes it a bad idea depends on whom you ask. (I say it is.)

User avatar
headprogrammingczar
Posts: 3072
Joined: Mon Oct 22, 2007 5:28 pm UTC
Location: Beaming you up

Re: My teacher is teaching HORRIBLE THINGS

Postby headprogrammingczar » Mon Mar 09, 2009 5:07 pm UTC

Cosmologicon wrote:
sje46 wrote:Sorry, I'm confused. IS it a bad idea to close <br> tags in html, or is it just unnecessary? It's okay for some browsers but not for others?

It's invalid (meaning it doesn't comply with the official standard, but it'll work on 99.999% of your users' browsers. Whether that makes it a bad idea depends on whom you ask. (I say it is.)

That, and closing the <br> has no function. On say, <b>, closing it with </b> has an obvious effect (ending the boldness). Even ending <p> has a bit of an effect, defining the end of the paragraph for selection systems that let you triple-click to select paragraphs. <br> is a line break. It might as well be an ASCII character rather than a tag. Closing line breaks makes about as much sense as ending sentences with <.></.>.
<quintopia> You're not crazy. you're the goddamn headprogrammingspock!
<Weeks> You're the goddamn headprogrammingspock!
<Cheese> I love you

Random832
Posts: 2525
Joined: Wed Oct 10, 2007 4:38 pm UTC

Re: My teacher is teaching HORRIBLE THINGS

Postby Random832 » Mon Mar 09, 2009 5:11 pm UTC

More specifically - the purpose of XML's rule that (among other rules to the same end) tags always have to be closed is so that it can be parsed into a DOM tree by a parser that has no idea what any of the tag names mean. HTML does not share this philosophy, so it defines various tags as optional, to be closed in context based on knowledge that they cannot contain anything or that they cannot contain their next sibling or that they close when their parent element closes (this last could be applied to XML as well, but it's not because it's easier to parse if you know exactly what you're looking for in a closing tag)

User avatar
xulaus
Posts: 136
Joined: Thu Jul 03, 2008 11:09 am UTC

Re: My teacher is teaching HORRIBLE THINGS

Postby xulaus » Mon Mar 09, 2009 6:41 pm UTC

sje46 wrote:Sorry, I'm confused. IS it a bad idea to close <br> tags in html, or is it just unnecessary? It's okay for some browsers but not for others?

It is not recomended in HTML. In XHTML, however, it is required. If in doubt, validate
Meaux_Pas wrote:I don't even know who the fuck this guy is

User avatar
Xanthir
My HERO!!!
Posts: 5426
Joined: Tue Feb 20, 2007 12:49 am UTC
Location: The Googleplex
Contact:

Re: My teacher is teaching HORRIBLE THINGS

Postby Xanthir » Mon Mar 09, 2009 9:05 pm UTC

I apologize for not seeing this thread earlier. I'm a skilled web developer by trade, and I participate actively in both the HTML5 and CSS working groups. I can correct some mistakes, and clear up some misunderstandings.

OP, the teacher is a moron. Unfortunately, this will be distressingly common. Teachers are, almost by definition, not practicing their trade. Usually they haven't practiced it in many years. Web standards have evolved significantly in the past decade. As well, most people writing things on the web are idiots. This is a general rule, as any programmer knows - 90% of programmers are stupid. (This is merely a specific application of Sturgeon's Law.)

There are at least three major web authoring standards currently extant. Many of the things you'll learn in school will be for HTML4 (or earlier ::shudder::). HTML4 is well over a decade old now. It contains many presentational elements (the aforementioned <marquee>, plus <center>, <u>, etc.), end tags are optional on many elements (such as <p>, <li>, and <dd>), and attributes can be unquoted.

XHTML was an attempt to 'clean up' this mess, by striking out all the presentational elements and defining the language in terms of XML, which is quite a bit stricter. (HTML was previously loosely based on SGML, though browsers purposely ignored many SGML rules when parsing1.) Most importantly, it used XML error handling, which consists of "If there's an error, ABORT". A lot of good things came out of the XHTML movement, but there were many fundamental mistakes made in its execution. If any browser were to start using XHTML's error model, frex, at least 97% of the web would be unviewable (this is based on empirical tests performed by Ian Hickson). Even amongst pages which explicitly claim to be XHTML-compliant, a majority of them contain at least *some* error, or are open to error injection (for example, in blog comments).

HTML5 is the current effort to tie all this up in a usable package. It very explicitly defines error handling in a way that matches current browser behavior (an enormous amount of work, but absolutely necessary, as currently every browser has to reverse-engineer other browsers by themselves in order to display pages 'correctly'). It defines many things in a similar way to XHTML, but with a recognition that the current content on the web must be displayable, even if it's not 'valid'. (It also comes in an XML flavor, XHTML5, which is slightly stricter in some aspects that XML requires, but still utilizes realistic error handling.)

In HTML5, all tags *need* to be matched with an end tag, but error handling is defined to handle when an author doesn't. It recommends lowercase symbols for tagnames and attribute names. It doesn't require attribute quoting (XHTML5 does), but encourages it. It allows you to self-close <br> and <hr> tags, but discourages it (in XHTML5, you must).

Phlip is pretty much completely right in everything he says.

1: Like Phlip says, officially <br /> defines a shorttag in SGML, and the > is then part of the content afterwards. Nobody does this, though (clarification - no browser that people actually use does this). XML is a simplification of SGML that removes many of those obscure rules, and HTML5 is explicitly not an SGML-based language.
(defun fibs (n &optional (a 1) (b 1)) (take n (unfold '+ a b)))

afarnen
Posts: 157
Joined: Mon May 05, 2008 12:12 pm UTC

Re: My teacher is teaching HORRIBLE THINGS

Postby afarnen » Mon Mar 09, 2009 9:46 pm UTC

phlip wrote:Closing <p> tags in HTML is optional... I do it, mostly from habit, but if you don't it's valid, and behaviour is well-defined. Closing img/br/etc tags in HTML is invalid.


When I say closing img, br, hr, etc. tags, I mean this:

Code: Select all

<img src="asdf.asdf" /><br /><hr />


Not this:

Code: Select all

<img src="asdf.asdf"></img><br></br><hr></hr>


Where NOT closing them would be this:


Code: Select all

<img src="asdf.asdf"><br><hr>

User avatar
Xanthir
My HERO!!!
Posts: 5426
Joined: Tue Feb 20, 2007 12:49 am UTC
Location: The Googleplex
Contact:

Re: My teacher is teaching HORRIBLE THINGS

Postby Xanthir » Mon Mar 09, 2009 9:48 pm UTC

In HTML4, it's officially invalid, but browsers accept it anyway. In HTML5, it's accepted but discouraged. In any XML-based language (like XHTML1 or XHTML5) it's required.

As I code in HTML5, I write them without the /.
(defun fibs (n &optional (a 1) (b 1)) (take n (unfold '+ a b)))

User avatar
phlip
Restorer of Worlds
Posts: 7573
Joined: Sat Sep 23, 2006 3:56 am UTC
Location: Australia
Contact:

Re: My teacher is teaching HORRIBLE THINGS

Postby phlip » Mon Mar 09, 2009 10:07 pm UTC

xulaus wrote:
sje46 wrote:Sorry, I'm confused. IS it a bad idea to close <br> tags in html, or is it just unnecessary? It's okay for some browsers but not for others?

It is not recomended in HTML.
afarnen wrote:When I say closing img, br, hr, etc. tags, I mean this:

Code: Select all

<img src="asdf.asdf" /><br /><hr />
But, as mentioned: <br /> in HTML is not an empty br tag, like it is in XML. It validates, but means the same as "<br>&gt;". The validator warning is just telling you that if you actually meant "<br>&gt;", you probably won't get it, 'cause 99% of browsers don't do that. The validator says the same thing with <b/bold/ shorttags, for instance.

HTML is in the annoying position of there being a real Standard (with a capital S), that declares many things to be Correct, and other things to be Wrong... but when you actually make an HTML parser/renderer, given the state of the web, you have to ignore the standard in many places, and instead treat it like a natural language... whatever's "right" is whatever most people are doing. Which naturally makes it suck a lot more. Treating "<br />" in HTML the same as in XHTML is just one of those concessions.

[edit] OK, so after reading Xanthir's post fully, I should mention that I haven't done much with HTML5 yet... whenever I say "HTML" , read "HTML4 (or earlier)".

Xanthir wrote:Phlip is pretty much completely right in everything he says.
Curse my policy of not putting quotes in my sig!

Code: Select all

enum ಠ_ಠ {°□°╰=1, °Д°╰, ಠ益ಠ╰};
void ┻━┻︵​╰(ಠ_ಠ ⚠) {exit((int)⚠);}
[he/him/his]

User avatar
imontheroof
Posts: 44
Joined: Mon Feb 23, 2009 10:46 am UTC

Re: My teacher is teaching HORRIBLE THINGS

Postby imontheroof » Tue Mar 10, 2009 6:32 am UTC

afarnen wrote:The great <marquee> tag
Not closing <p> tags or <img> tags, etc.
Not enclosing attribute values in quotes, e.g. <img border=2 src=..>
"PNG images aren't supported by all browsers", so they only use JPEG (lossy compression) and GIF (patent infringement). And they don't even know about SVG!


<center>!

My favorite browser eating valid piece of code is .. <marquee> on a java applet in a <div> at 60% transparency over a large animated gif at 40% transparency.

Oh wait, thats a website I made, sorry kpavery :D

User avatar
OOPMan
Posts: 314
Joined: Mon Oct 15, 2007 10:20 am UTC
Location: Cape Town, South Africa

Re: My teacher is teaching HORRIBLE THINGS

Postby OOPMan » Tue Mar 10, 2009 6:48 am UTC

I work in XHTML at present so well-formedness is the law...
Image

Image

User avatar
jakemaheu
Posts: 78
Joined: Fri Jan 23, 2009 2:49 am UTC

Re: My teacher is teaching HORRIBLE THINGS

Postby jakemaheu » Tue Mar 10, 2009 6:56 pm UTC

OOPMan wrote:I work in XHTML at present so well-formedness is the law...


^^This.

As to the previous complaints about different rendering engines, there are differences.

*cough*CSS3 opacity*cough*

If you have IE8, look at what happens to my website's opacity.
Dauric wrote:Rent more backhoes and order more fill-dirt. This molehill needs to be a mountain by day's end.

sje46 wrote:It's not if when you get married the husband ceremoniously places his dick in his wife and a baby

User avatar
Xanthir
My HERO!!!
Posts: 5426
Joined: Tue Feb 20, 2007 12:49 am UTC
Location: The Googleplex
Contact:

Re: My teacher is teaching HORRIBLE THINGS

Postby Xanthir » Tue Mar 10, 2009 7:59 pm UTC

Oh, just noticed the bit up top about PNGs.

8-bit PNGs are well-supported by every current browser, *including* IE6. The drawback? 8-bit PNGs use GIF-style transparency, where you specify that one color in the image is the 'transparent' color. This is useful, but you still have to make sure that the background color is correct, or else your anti-aliasing will look horrific. You'll often see this effect on old sites overflowing with transparent gifs.

32-bit PNGs support a full alpha channel, so any pixel can be any degree of transparency. This is *real* transparency. All the modern browsers support it, including IE7. IE6 is the only one that doesn't. However, there are many good javascript libraries that can activate the hack that IE6 provides to allow partial support of them. You can even pop it into a conditional comment that only targets IE6, so no one using a decent browser has to download and execute extra code!

In conclusion, your teacher is stupid, and there's no reason not to use PNGs. (This gets back to my point where most web teachers are at least 10 years out of date.)
(defun fibs (n &optional (a 1) (b 1)) (take n (unfold '+ a b)))

User avatar
jordan
Posts: 106
Joined: Thu Mar 15, 2007 2:41 pm UTC
Location: Coventry

Re: My teacher is teaching HORRIBLE THINGS

Postby jordan » Tue Mar 10, 2009 8:26 pm UTC

Damnit, Xanthir said everything I was going to say, and very well too.

Personally, I seldom close paragraph tags, and never close list items (including definitions and terms in definition lists), table rows or table cells, nor the head, body or html elements. Indeed, of the latter three, I only open the html element with regularity (to set the document language), and sometimes head if I want to use the profile attribute. I figure I'm in good company: Anne van Kesteren, one of the Opera developers and a prominent figure in HTML5, did not open or close any of these elements explicitly in his blog. I actually find this more aesthetically pleasing now; like a t-shirt after you've plucked off all the lint.

User avatar
Xanthir
My HERO!!!
Posts: 5426
Joined: Tue Feb 20, 2007 12:49 am UTC
Location: The Googleplex
Contact:

Re: My teacher is teaching HORRIBLE THINGS

Postby Xanthir » Tue Mar 10, 2009 8:34 pm UTC

I'm strict about closing my elements, because I know how much trouble the unclosed element handling causes when you're trying to add new elements to the language.

Plus, this way I don't have to remember which elements will self-close. It's all symmetric.
(defun fibs (n &optional (a 1) (b 1)) (take n (unfold '+ a b)))

User avatar
jemthealmighty
Posts: 145
Joined: Fri May 23, 2008 6:55 am UTC
Location: Dubbo, NSW, Australia
Contact:

Re: My teacher is teaching HORRIBLE THINGS

Postby jemthealmighty » Tue Mar 10, 2009 8:42 pm UTC

Xanthir wrote:I'm strict about closing my elements, because I know how much trouble the unclosed element handling causes when you're trying to add new elements to the language.

Plus, this way I don't have to remember which elements will self-close. It's all symmetric.

Agreed, and it makes the code look way nicer, and much easier to work with, when you indent each child as you go (which any good coder should do anyway).

User avatar
Cosmologicon
Posts: 1806
Joined: Sat Nov 25, 2006 9:47 am UTC
Location: Cambridge MA USA
Contact:

Re: My teacher is teaching HORRIBLE THINGS

Postby Cosmologicon » Tue Mar 10, 2009 11:25 pm UTC

Xanthir wrote:8-bit PNGs are well-supported by every current browser, *including* IE6. The drawback? 8-bit PNGs use GIF-style transparency, where you specify that one color in the image is the 'transparent' color. This is useful, but you still have to make sure that the background color is correct, or else your anti-aliasing will look horrific. You'll often see this effect on old sites overflowing with transparent gifs.

32-bit PNGs support a full alpha channel, so any pixel can be any degree of transparency. This is *real* transparency. All the modern browsers support it, including IE7. IE6 is the only one that doesn't. However, there are many good javascript libraries that can activate the hack that IE6 provides to allow partial support of them. You can even pop it into a conditional comment that only targets IE6, so no one using a decent browser has to download and execute extra code!

In conclusion, your teacher is stupid, and there's no reason not to use PNGs.
Look, I'm sure you're an excellent web designer, but it seems to me like you're being way too quick to disparage anyone who makes different design decisions from you. Based on what you said, I think the teacher is being reasonable. Your options are:

1. Have something that breaks on IE6.
2. Use a javascript library that activates a hack on IE6, along with a browser-sniffing conditional comment.
3. Avoid 32-bit PNGs.

I think that any of the three options is defensible. I choose #1, but IE6 is still prevalent enough that I can't fault someone who doesn't. You like #2, but I started sleeping better the day I removed garbage like that from my webpage, and I strongly disagree that there's anything wrong with avoiding #2 either. That leaves #3, avoiding 32-bit PNGs.

Although I haven't used them in years, GIFs are not as black as you're painting them, and it's okay to expect beginning students not to grasp the nuance between 8-bit and 32-bit PNGs. In which case "use GIF, not PNG" is a fair rule of thumb to teach.

User avatar
Xanthir
My HERO!!!
Posts: 5426
Joined: Tue Feb 20, 2007 12:49 am UTC
Location: The Googleplex
Contact:

Re: My teacher is teaching HORRIBLE THINGS

Postby Xanthir » Tue Mar 10, 2009 11:49 pm UTC

Look, I'm sure you're an excellent web designer, but it seems to me like you're being way too quick to disparage anyone who makes different design decisions from you.

People can certainly make different design decisions. Sometimes they are valid differences. Sometimes they're flat-out wrong. And sometimes they're simply *bad* decisions, that can be technically defended, but really shouldn't be. This is the latter.

Based on what you said, I think the teacher is being reasonable. Your options are:

1. Have something that breaks on IE6.
2. Use a javascript library that activates a hack on IE6, along with a browser-sniffing conditional comment.
3. Avoid 32-bit PNGs.

I honestly don't give a crap about IE6 at this point, personally. It's been technically obsolete for 3 years now. I consider things breaking in IE6 to be a *bonus* whenever I can, as it's one more point forcing people to upgrade to a halfway-decent browser. Luckily for me, the higher-ups in my company agree, and so whenever an app of mine is broken in IE6, their solution is "get the user to upgrade", not "fix the app". ^_^ So, (1) is perfectly fine for me, though probably not for an educator wishing to teach their students best practices.

(2) is 100% fine. Conditional comments are *not* browser-sniffing, at least technically. They are absolutely bullet-proof, unlike all browser-sniffing - every IE since 5 recognizes the syntax and works appropriately, and every other browser treats it as a comment, like they should. Throwing in a CSS hack via javascript shouldn't be necessary, but it is, and it's a *simple* fix. The only people it leaves out are those using IE6 *and* browsing without Javascript. Those users fall into two categories: people who know what they're getting into, and people trapped behind an ancient corporate IT policy. The former can take care of themselves, and the latter can't be helped *except* by ensuring that the internet is broken enough under their policies that they have to upgrade.

(3) is just lazy, and indicates a lack of current knowledge, which is what I said was the teacher's failing.

I think that any of the three options is defensible. I choose #1, but IE6 is still prevalent enough that I can't fault someone who doesn't. You like #2, but I started sleeping better the day I removed garbage like that from my webpage, and I strongly disagree that there's anything wrong with avoiding #2 either. That leaves #3, avoiding 32-bit PNGs.

I strongly prefer #1 as well, but a tiny hack in the <head> of my page, taking up maybe four lines, is nothing compared to the inconvenience of #3.

Although I haven't used them in years, GIFs are not as black as you're painting them, and it's okay to expect beginning students not to grasp the nuance between 8-bit and 32-bit PNGs. In which case "use GIF, not PNG" is a fair rule of thumb to teach.

Oh, certainly not. They have their place. But they *are* used badly quite commonly, because people don't understand how transparency works. You don't really even need to teach students the difference between 8-bit and 32-bit PNGs, because most programs make it difficult to save something as an 8-bit PNG. Just teach the difference between GIF and 32-bit PNG and you're golden. This lesson *does* have to be taught in a webdesign course - how to deal with transparency is an important issue in website design.
(defun fibs (n &optional (a 1) (b 1)) (take n (unfold '+ a b)))


Return to “Coding”

Who is online

Users browsing this forum: No registered users and 9 guests