I am a college student getting ready to take a Javascript class.
From what I hear it is pretty lame and I want to learn more
about javascript than what the class offers.
It is an unfortunate truth that much of what is taught in formal
javascript courses is between bad advice and technically wrong. It may
be very useful to you to have some ability to identify that while you
are being 'taught' it. Though you will likely be tested on the syllabus
as taught, not the reality.
While I am taking the class, I thought it would be a
good time to take my studies to the next level and
learn more things about it on my own.
Certainly if you want to end up with genuine knowledge in addition to a
formal qualification.
If you had the chance to design and teach a class on
beginner & mid-level javascript,
Designing a course for beginners would be very different form designing
a course for mid-level (self-assed or actual), and both would depend
quite a lot on whether the individuals taking the course(s) had
programming experience in other languages and which languages. I work
with server side programmers who use a language that has no concept of
objects at all, and with Java programmers for whom the concept is second
nature. In order to understand aspects of javascript the first group
need explanations that the second group would find patronising.
A likely (but fatuous) response to that would be "everything". It is
just a matter of thinking of everything and writing it down so you did
not forget to teach it.
What do you think is important for people to know about
coding in javascript?
For javascript it is extremely useful to be able to understand the
standard (ECMA 262) and how the way it formally defines required
behaviour relates to what javascript implementations do, what they may
not do, and what they may do beyond the specification.
Unfortunately that document is quite difficult to comprehend, and
certainly is not something a novice is easily going to just pick up and
learn from.
My strategy for teaching the use of the specification would be to take a
piece of code and walk the students through the grammar, syntax and
evaluation rules that applied to it, making sure that path went through
some of the more important aspects of the specification, such as
Reference types and the internal GetValue and PutValue functions, plus
internal methods and properties of objects and some implicit
type-conversion.
Some details of the language I would want to be certain that the
students had a good handle on would be:-
1. Type conversion; implicit (where, how and why it happens) and
explicit. In a loosely typed language like javascript it becomes
the programmers responsibility (and discipline) to understand the
types of the values that are being worked with and the
implications of those types in various contexts.
2. The scope chain resolution of Identifiers (and so scope chains and
property resolution on objects). And so the nature and implications
of lexical scoping.
3. The behaviour of the - this - value (as that is something that many
people find confusing and you are not really programming with
javascript until you are never in any doubt as to what the - this
- value will be in any context). So I would also want to ensure
that students understood that scope and the - this - value are
independent and unrelated entities (as that is an area where
many novices seem to become confused).
4. Property accessors; that there are two types (dot notation and
bracket notation) with the same behaviour but differing syntax
(and syntax rules). And that neither is Array related or specific
(as that is another thing that is commonly misconceived).
5. Object creation and prototype inheritance in their simplest form.
And the relationship between concepts from class-based languages
and javascript implementations of those concepts (to avoid people
being bamboozled into prematurely adopting some excessively complex
straightjacket of a 'classical' inheritance scheme).
... There will be much else besides that is not coming to mind at the
moment, but that is a reasonable start.
There are aspects of related technologies that would be important to
javascript students:-
1. HTTP; The request/response nature of the protocol and the fact
that the client initiates all HTTP exchanges. Types of requests,
particularly the difference between GET and POST requests.
Headers and their roles in asserting content type, character
encoding and influencing caching behaviour.
2. HTML; The direct relationship between (structurally valid) mark-up
and the resulting DOM that is to be scripted. And the XHTML
confusion, and its significance to scripting tasks.
Specifically for browser scripting I would want to ensure that the
students understood feature detection as a practice. Including how to
analyse issues with sufficient precision to enable the designing and
creation of feature detection tests.
But probably the most important thing to get across to students is the
fact that almost all sources of information on javascript and browser
scripting that are publicly available (books, web sites, etc) are
seriously flawed, that common practice world-wide is inept and that
trivial 'successes' tends to bread individuals with massive
overconfidence in their own abilities who then think that they should be
giving advice to others. That is; that a large pinch of salt should be
taken with any javascript 'information/advice' received, and that
critical examination should then be applied to it.
Richard.