Welcome to WebmasterWorld Guest from 54.166.178.177

Forum Moderators: open

Message Too Old, No Replies

Code Comparisons for a Simple JavaScript Rollover

As created in different HTML editors...

     
5:43 am on Oct 24, 2001 (gmt 0)

WebmasterWorld Administrator robert_charlton is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month


Code Comparisons for Simple JavaScript Rollover
  Dreamweaver 4 Adobe GoLive5 FrontPage 2000 Hand Coding
Lines (softwrap on) 41 132 640 28
Characters 1,468 4,139 14,654 783
Good JS? No No Not Even Close Yes
W3C valid HTML? No No Snicker Yes
4:39 pm on Oct 24, 2001 (gmt 0)

WebmasterWorld Administrator robert_charlton is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



(Brett - Thanks for posting the above table for me. I thought it would make a good addendum to the "what's your favorite text editor" thread elsewhere on this forum.)

The information comes from a lecture on JavaScript by Tom Negrino & Dori Smith (who just wrote a new book on Javascript for the World Wide Web), and I'm using it with their permission. They were discussing what happens when you use various authoring programs to write your JavaScript... not completly analogous to having these programs write your html, but similar enough. The Dreamweaver code, they say, can be improved by enhancements to the program. I don't think this chart is in the book.

4:50 pm on Oct 24, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



>> FrontPage 2000
640 lines of code!? How, how can a rollover script be that long? How?

What does it do - draw the images itself?

5:28 pm on Oct 24, 2001 (gmt 0)

WebmasterWorld Senior Member mivox is a WebmasterWorld Top Contributor of All Time 10+ Year Member



not completly analogous to having these programs write your html, but similar enough

I'd have to argue that is not even close to analogous. I use GoLive for my HTML (with some minor hand tweaking) and CSS (ditto).... The HTML and CSS output is suprisingly clean and standards compliant if the end user knows what they're doing when they configure their preferences. (I've heard rumors from experienced FrontPage users that even FP can output clean HTML, if used correctly! ;) )

I can crunch out a basic, standards compliant HTML page in a LOT less time with GoLive than if I hand-coded everything... (YMMV) Javascript, OTOH, should never be generated with a WYSIWYG HTML editor... for the very obvious reasons listed above. For JS, I use BBEdit.

5:44 pm on Oct 24, 2001 (gmt 0)

WebmasterWorld Administrator robert_charlton is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



>>I'd have to argue that is not even close to analogous.<<

No argument... it was a comment I dropped in without first hand experience (except for the ordeal of trying to optimize a FrontPage site), and I retract it. What I meant to suggest, which I think is true, is that hand coding will probably give the leanest code, followed by Dreamweaver, then GoLive, then FP.

Regarding the time saved by WYSIWYG programs, this was a question that came up with regard to JavaScript. Dori pointed out that she almost never writes JavaScript from scratch... she usually modifies code she already has. I'm sure WYSIWYG is still faster.

Re BBEdit, which was highly recommended at the lecture, there was an interesting tip if you don't already have it... BBEdit offers a discount of $40 if you are upgrading from a competitive product, and one of the products included in the list of programs from which upgrades are allowed is BBEdit Lite. BBEdit Lite, they point out, can be downloaded free. ;)

6:05 pm on Oct 24, 2001 (gmt 0)

WebmasterWorld Senior Member mivox is a WebmasterWorld Top Contributor of All Time 10+ Year Member



trying to optimize a FrontPage site

Been there! ;) Apparently, (and this is all stuff I've heard from FP users) FP becomes a problem when you use the "wizards". That's where you end up with the incomprehensible navigation coding and other gobbledegook. When I was asked to change a couple of photos in a "wizard-ized" FP site, I ended up tearing the whole thing down & patching it back together in GoLive.

As for lean code... I think Dreamweaver & GoLive are about the same (in the hands of an experienced user) having seen code from both. And both programs give you easy access to your code, so you can edit it by hand without leaving the program.

It's a really just a matter of preference and other software... If you use Fireworks or Freehand for your gfx, maybe you should stick with Macromedia for your WYSIWYG editor? I'm a militant Adobe devotee, so... ;) (And I actually started using GoLive before Adobe bought it.... when they still had an $80 "Personal Edition")

I also never hand-code javascript... ;) Probably couldn't if I tried! But I've gotten very good at taking free scripts and extensively editing them to meet my particular needs (same with Perl cgi scripts). Then I plug in the necessary script calls, etc., in GoLive's code editing window.

8:46 pm on Oct 24, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Lol... 640 lines of code for a mouseover?

I noticed that they added "softwrap on" so maybe they've got their window resized to 20 or 30 pixels wide? :-)

It would seem that way because I could write a mouseover in 4 or 5 lines WITHOUT soft wrapping.

9:08 pm on Oct 24, 2001 (gmt 0)

WebmasterWorld Administrator robert_charlton is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



Looking at the line lengths from the above chart, FP does in fact have the shortest line, 23 characters (not pixels)... with hand coding having 28 characters, GoLive 31, and Dreamweaver 36. I forget exactly why they said they put softwrap on... had something to do with trying to get the fairest comparison, though.

The best comparison is actually in the number of characters (where FP code is 19 times larger than hand coding).

 

Featured Threads

Hot Threads This Week

Hot Threads This Month