Which url in your opinion would be a good or even the best example of
javascript usage in a set of pages at least say 10 or more pages? How to use
css, how to split js-code to files, how to code for good
maintainability,objects, names, how to take care of older browsers, how to
optimize the coding time, etc
It might be easy to have strong opinions in the theory 'how other people
should organize their js-coding' (but I do not show mine). But who could
show an example: 'This is very good example in my opinion, and I believe I
can defend my opinion in every detail'.
A too small an example is not useful, the problems of maintainability etc
are totally different in them compared to having tens of interdependent
pages.
This far the best pages I have seen are http://developer.yahoo.com/yui/index.html
but as a newbie programmer I would be eager to see even better examples.
Learning by looking at good examples. 9 1711
optimistx wrote: Which url in your opinion would be a good or even the best example of javascript usage in a set of pages at least say 10 or more pages? How to use css, how to split js-code to files, how to code for good maintainability,objects, names, how to take care of older browsers, how to optimize the coding time, etc
Aren't you pre-supposing the validity of the notion that for javascript
there is a generally applicable "best"? It strikes me as much more
likely that the context for which scripts are written should guide the
design criteria. So while writing for the public Internet genuinely
cross-browser code with fully planed out clean degradation to a viable
underlying system may be the best that can be achieved, while when
writing for an Intranet neither of cross-browser code nor clean
degradation may be applicable issues at all. A large e-commerce site may
suggest designing and building what is effectively an OO application
framework with javascript, while for a small site presenting essentially
static information doing that would be ridiculously over the top and
inappropriate.
<snip> A too small an example is not useful, the problems of maintainability etc are totally different in them compared to having tens of interdependent pages.
You are probably wrong there. There may be a tendency for unmaintainable
code to be exponentially more of a pain to work with the more of that
code there is but that does not excuse writing small systems that are
unmaintainable.
This far the best pages I have seen are
http://developer.yahoo.com/yui/index.html
A page that commences with the words "The Yahoo! User Interface Library
is a set of utilities and controls, written in JavaScript, for building
richly interactive web applications using techniques such as DOM
scripting, HTML and AJAX", so if you are not building "richly
interactive web applications" even Yahoo may question the
appropriateness of their code.
but as a newbie programmer I would be eager to see even better examples. Learning by looking at good examples.
Looking won't necessarily help unless you can get access to the
reasoning behind the design decisions made in the creation of such code.
Richard.
optimistx wrote: Which url in your opinion would be a good or even the best example of javascript usage in a set of pages at least say 10 or more pages?
There are many different theories on how javascript should be used, so
reaching a concensus on 'best' would be impossible. You should look at
several different approaches, styles, and techniques, and hopefully learn
enough to decide for yourself which approach you think best matches your
needs.
My Javascript site is http://www.JavascriptToolbox.com which, I think, shows
a number of good designs and practices. It surely also has some cons. Nobody
is perfect, especially when working on sites at 1:00am after the wife and
kids are asleep ;)
How to use css, how to split js-code to files, how to code for good maintainability,objects, names, how to take care of older browsers, how to optimize the coding time, etc
One thing to keep in mind: If everything could be broken down into clear and
simple instructions to do things in the "best way" then there wouldn't be
much need for programmers. It would be trivial to wite code generators to do
all the work. The reality is, development is far too complex and there are
too many factors to consider to make a single approach the law which should
be applied in all situations.
I have a "best practices" document for Javascript which I plan to expand
soon to be a little more accurate and clear, and also to cover some of the
questions you seem to be asking: http://www.JavascriptToolbox.com/bestpractices/
You are welcome to ask me questions (here) about any specific decisions or
approaches taken on my site(s). Discussions on topics like these can be very
helpful to many.
--
Matt Kruse http://www.JavascriptToolbox.com http://www.AjaxToolbox.com
"Richard Cornford" <Ri*****@litotes.demon.co.uk> kirjoitti viestissä
news:e2*******************@news.demon.co.uk... Aren't you pre-supposing the validity of the notion that for javascript there is a generally applicable "best"?
In one's _opinion_ the best. Like 'I would like to be able to write
systems like that'.
It strikes me as much more likely that the context for which scripts are written should guide the design criteria.
ok, a little more specific wish list.
Let us look at only publicly available sites, not intranets, not simple
'Hello world'-type of sites.
Sets of pages, which could perhaps be constructed by some manmonths of
effort, not some hours or few days.
You are probably wrong there. There may be a tendency for unmaintainable code to be exponentially more of a pain to work with the more of that code there is but that does not excuse writing small systems that are unmaintainable.
Of course one should try to write as modular systems as possible.
Looking won't necessarily help unless you can get access to the reasoning behind the design decisions made in the creation of such code.
So, if I want to get a Nobel Prize in literature and want to read good books
first before writing my own, there are no good books? :)
But thanks anyway for your opinions.
optimistx wrote: Richard Cornford wrote:
<snip> It strikes me as much more likely that the context for which scripts are written should guide the design criteria.
ok, a little more specific wish list. Let us look at only publicly available sites, not intranets, not simple 'Hello world'-type of sites.
Excluding only the trivial does not do much to narrow the criteria. But
my point was that the thing that is useful to learn is not how to create
code of any particular single situation but instead how to choose
appropriate design criteria and implementation strategies for whatever
situation that comes along.
Sets of pages, which could perhaps be constructed by some manmonths of effort, not some hours or few days.
When some people can do in hours what others would take months over that
doesn't really mean much.
<snip> So, if I want to get a Nobel Prize in literature and want to read good books first before writing my own, there are no good books? :)
<snip>
Literature is art, you need talent for that. Would you win the prize for
physics only observing good examples of the physical, or would
understanding the current theory, and the though process behind it,
help?
Richard.
"Matt Kruse" <ne********@mattkruse.com> kirjoitti viestissä
news:e2********@news2.newsguy.com...
.... My Javascript site is http://www.JavascriptToolbox.com which, I think,
shows a number of good designs and practices. It surely also has some cons.
Nobody is perfect, especially when working on sites at 1:00am after the wife and kids are asleep ;)
Thanks for your valuable link. I have been studying them already several
weeks ago. Their contents, especially the words 'best practices' partly
made me start this thread. Your pages are an valuable example for me, and I
became interested in seeing other examples. Reading one good book makes one
eager to read more.
....
The reality is, development is far too complex and there are too many factors to consider to make a single approach the law which
should be applied in all situations.
We agree. There are many good styles and selecting one is a matter of
opinion. We might say '_in my opinion_ this code is thus far the best, and
I wish I could write code like this'. I am interested in opinions, not the
one and only truth.
The creator of PHP wrote a simple example of the code he thought was good.: http://toys.lerdorf.com/archives/38-...framework.html
The discussion was heated but very useful and educational. I thought people
would dare to stick out their head here too :). You did, and I appreciate
that . An example need not be one's own pages, of course..
optimistx said the following on 4/24/2006 4:44 AM: "Matt Kruse" <ne********@mattkruse.com> kirjoitti viestissä news:e2********@news2.newsguy.com... .... My Javascript site is http://www.JavascriptToolbox.com which, I think, shows a number of good designs and practices. It surely also has some cons. Nobody is perfect, especially when working on sites at 1:00am after the wife and kids are asleep ;)
Thanks for your valuable link. I have been studying them already several weeks ago. Their contents, especially the words 'best practices' partly made me start this thread. Your pages are an valuable example for me, and I became interested in seeing other examples. Reading one good book makes one eager to read more.
And what you have seen in this thread so far should point out the fact
that what one considers a good book may not be a good book to another.
The same goes with scripting. And, as Richard pointed out, what
qualifies as a "good solution" depends - directly - on the problem being
solved. The reality is, development is far too complex and there are too many factors to consider to make a single approach the law which should be applied in all situations.
We agree. There are many good styles and selecting one is a matter of opinion. We might say '_in my opinion_ this code is thus far the best, and I wish I could write code like this'. I am interested in opinions, not the one and only truth.
There is no "one and only truth", there are only opinions when it comes
to coding style. There are one and only truths when you get to
particular problems and particular solutions.
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
optimistx wrote:
<snip> ... . I thought people would dare to stick out their head here too :). ...
<snip>
Having made a post announcing your support for people wasting the time
of the contributors to this group (by encouraging them not to
familiarise themselves with the FAQ) is it really surprising that there
are not many left willing to expend time on you?
Richard.
Richard Cornford wrote:
.... Having made a post announcing your support for people wasting the time of the contributors to this group (by encouraging them not to familiarise themselves with the FAQ) is it really surprising that there are not many left willing to expend time on you?
....
Good question :).
I stated the obvious fact that if people are supposed to spend many hours of
their time before their first posting, then many of them do not spend.
A cure would be to have a condensed short part of FAQ, which would list the
absolute minimim requirements for an acceptable post. Those minimum
requirements would be presented here once every day or so. If a person
presents a question breaking those requirements the old experienced
js-experts could leave the post unanswered, instead of writing detailed,
conscise, unfriendly harsh remarks. 'You break our rules, go away'.
The more the js-experts spend their time here the more frustrated they get
during the years. The reason is simple: the portion of problems which are
interesting, educational and enough high quality for their own personal
developement goes asymptotically towards zero. Have you noticed that?
If the overall quality of the groups needs to be advanced, why not make a
new group 'advanced javascript' or 'newbie javascript'?
I have not felt similar irritation, annoyment, unfriendliness e.g. in
comp.lang.php, which might have higher volume of traffic compared to
this.comp. lang.javascript
Of course many people here are polite, friendly, symphatetic. But even a few
exceptions creates an uncomfortable atmosphere.
optimistx wrote: Richard Cornford wrote: ... Having made a post announcing your support for people wasting the time of the contributors to this group (by encouraging them not to familiarise themselves with the FAQ) is it really surprising that there are not many left willing to expend time on you? ... Good question :).
I stated the obvious fact that if people are supposed to spend many hours of their time before their first posting, then many of them do not spend.
Observing that people may not always do what they should do was not all
you did, you also implied that their behaviour should be acceptable, and
so be consequence-free. As it is not you will have done harm to anyone
who takes you seriously and indeed those who choose to do as they
should, as the time needlessly squandered by the others will not be
available to the deserving.
A cure would be to have a condensed short part of FAQ, which would list the absolute minimim requirements for an acceptable post.
You haven't actually read the FAQ, have you? But in any event, a
formulation of words that sufficiently concisely explains the situation
is difficult to devise, and people are more likely to follow conventions
and advice when they understand why, which takes explanation and so
consequently time to study that explanation.
<snip> ... . If a person presents a question breaking those requirements the old experienced js-experts could leave the post unanswered, instead of writing detailed, conscise, unfriendly harsh remarks. 'You break our rules, go away'.
Precisely how many people have you seen telling others to go away? One
or two at best, and it is a meaningless proposal as this is an
unmediated, publicly accessible group. The most prevalent reaction to
recalcitrant disregarders of the conventions is to silently ignore them,
and you see plenty of evidence of that where top-posters and those who
will not quote appropriately are left to suffer each other's dubious
advice. And indeed here, where a subject that has resulted in worthwhile
debate in the past is passed over by at least half a dozen with
well-formed and interesting opinions on the subject.
The more the js-experts spend their time here the more frustrated they get during the years. The reason is simple: the portion of problems which are interesting, educational and enough high quality for their own personal developement goes asymptotically towards zero. Have you noticed that?
Not at all, the people who were trying to be interested and helpful when
they started posting to the group still seem just as keen to be
interested and helpful now, they (with the obvious exception) just tend
to be more knowledgeable and experienced now. The only apparent sources
of frustration are the number of times it is necessary to repeat the
same advice; such as explaining to people why "it doesn't work" is not
much good as an error report. It makes you wish someone would write
these things down and put them on the Internet so that it was not
necessary to repeat them ad infinitum, but that only saves everyone
effort if you can get people to go and read the material they are
referred to.
If the overall quality of the groups needs to be advanced, why not make a new group 'advanced javascript' or 'newbie javascript'?
And how is that supposed to work? A group of people who don't really
know what they are doing just talking to each other. That is hardly
going to help much, all that would do is propagate the "this 'works' for
me" code that is already at the root of a significant proportion of the
problems posted here. And what happens if a loony like VK gets in among
them and posts something like:-
<quote
cite="news:11**********************@o13g2000cwo.go oglegroups.com">
<script type="text/javascript">
void function dummy(args) {
alert('Booh!');
}
window.onload = dummy;
....
Function dummy is being parsed and allocated on script load,
but void operator prevents the script context to get a reference
on the allocated memory heap. So it becomes garbage collector
ready right away.
</quote>
- and there is nobody around who understands javascript well enough to
point out that it is total fantasy? Might it not be believed,
propagated, be integrated into a consistent but otherwise fantastic
conception of the language (added to with more contributions from the
same source)? Isn't the result going to be that everyone involved ends
up knowing less of javascript as time goes by (because knowing that you
don't know something is knowing more than believing that you know
something that is false)?
I have not felt similar irritation, annoyment, unfriendliness e.g. in comp.lang.php, which might have higher volume of traffic compared to this.comp. lang.javascript
Where "I have not felt ..." is significant; these are your perceptions,
not necessarily the reality.
Of course many people here are polite, friendly, symphatetic.
And you would have people needlessly waste their time regardless.
But even a few exceptions creates an uncomfortable atmosphere.
People cannot easily be prevented form posting to Usenet. But your
perception of the behaviour of one or two individuals does not alter the
benefit that posters will derive from reading the FAQ, they are
unrelated issues.
Richard. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Peter Foti |
last post by:
Simple question... which is better to use for defining font sizes and why?
px and em seem to be the leading candidates. I know what the general answer
is going to be, but I'm hoping to ultimately...
|
by: Mark Johnson |
last post by:
Oddly enough, I found it difficult, using Google, to find a list of
best-of sites based on the quality of their css packages.
So I'd ask. Does anyone know of particularly good sites which are in...
|
by: Jonas Smithson |
last post by:
I'm going to say something now that may seem to completely contradict
a previous post of mine, in which I basically said that taking a "who
cares" attitude about certain browsers (because of their...
|
by: DrUg13 |
last post by:
In java, this seems so easy. You need a new object
Object test = new Object() gives me exactly what I want.
could someone please help me understand the different ways to do the
same thing in...
|
by: Matt Kruse |
last post by:
http://www.JavascriptToolbox.com/bestpractices/
I started writing this up as a guide for some people who were looking for
general tips on how to do things the 'right way' with Javascript. Their...
|
by: Support |
last post by:
Hello:
I am deploying a new web site that will have over 100 pages.
In the ASP world, I would create templtes - include files, etc... to easily
"manage" the site.
In asp.net 2.0 I want to create...
|
by: Rich |
last post by:
Hi,
I would welcome any opinions on the best approach to developing a web
app in order to meet the following requirements:
a) the user interface can be easily styled by a graphic designer.
b)...
|
by: Petyr David |
last post by:
Just looking for the simplest. right now my perl script returns an
error messge to the user if the date string is invalid. would like to
do this before accessing the server.
TX
|
by: Milsnips |
last post by:
Hi there,
i have 2 pages: default.aspx and getTime.aspx
1. getTime.aspx has one line: "response.write(datetime.now())"
2. default.aspx has the following html code: "<script...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |