Profile

Cover photo
Douglas Crockford
Works at PayPal
Lives in San Jose
19,002 followers|2,266,522 views
AboutPosts
People
Have him in circles
19,002 people
Costel Andreescu's profile photo
Britische Andrews's profile photo
Moisès Trullàs Parrot's profile photo
dammsy alisa's profile photo
Joel Powers's profile photo
Nitish Chavan's profile photo
Kevin Katzke's profile photo
Alex Wingrove's profile photo
Betty Jane's profile photo
Communities
Places
Map of the places this user has livedMap of the places this user has livedMap of the places this user has lived
Currently
San Jose
Story
Tagline
_ __ ___ ____ _____ In the Twenty First Century!
Introduction
On the internet, nobody knows you're a Doug.
Bragging rights
I discovered the JSON Data Interchange Format. I also discovered that JavaScript has good parts. That was the first important discovery of the 21st Century.
Work
Occupation
The Boss of You
Employment
  • PayPal
    present
Basic Information
Gender
Male

Stream

Douglas Crockford

Shared publicly  - 
 
Since the feds have failed to repair their broken patent system, the states are starting to act.
Virginia is for lovers...as long as you don't love patent cases
15
3
Ivan Pierre's profile photoRodney Dawes's profile photo

Douglas Crockford

Shared publicly  - 
 
Everything you receive from a browser must be properly filtered. Everything you send to a browser must be properly encoded. When you fail to do that, this happens.
19
10
Selva Ganesh (selvagsz)'s profile photoPasquale Casciano's profile photo

Douglas Crockford

Shared publicly  - 
 
I added some math functions (acos  asin  atan atan2  cos  exp  exponentiate   log   root  sin   sqrt  tan) for DEC64. They are a placeholder and should be replaced with something faster and more accurate.
DEC64 - Decimal floating point
13
2
Greg A. Woods's profile photoDong Nguyen's profile photo

Douglas Crockford

Shared publicly  - 
 
I will be headlining at Fluent.
Date, Event, City, Venue. Feb 10, Forward Web Technology Summit, San Francisco, CA. Mar 8, ESRI Developer Summit, Palm Springs, CA, Palm Springs Convention Center. Mar 9, Fluent (discount: friend ), San Francisco, CA, San Francisco Marriott Marquis. Apr 16-22, , Orlando, FL ...
11
1
Ivan Pierre's profile photo

Douglas Crockford

Shared publicly  - 
 
second : 1
minute : 60
hour : 3 600
day : 86 400
week : 604 800
month : 2 629 746
year : 31 556 952
10

Douglas Crockford

Shared publicly  - 
 
Google doesn't trust Symantec.
16
2
Dor Kleiman (configurator)'s profile photoCraig Anderson's profile photoChiang Lin Ng's profile photo
 
Well Symantec isn't especially trustworthy. 
Have him in circles
19,002 people
Costel Andreescu's profile photo
Britische Andrews's profile photo
Moisès Trullàs Parrot's profile photo
dammsy alisa's profile photo
Joel Powers's profile photo
Nitish Chavan's profile photo
Kevin Katzke's profile photo
Alex Wingrove's profile photo
Betty Jane's profile photo

Communities

Douglas Crockford

Shared publicly  - 
 
FORTRAN was not the first language to make the mistake of using the equal sign to mean assignment, but it was popular and influential. There were later languages that did not repeat that mistake, including ALGOL and BCPL. Unfortunately, C followed FORTRAN's example, compounding the mistake by making == the equality operator. JavaScript compounds C's mistake by making == unreliable. The fix, adding a === operator, does not seem much like a fix.

There is a very good argument that programming languages should not have any sort of assignment operator at all, but the mainstream of our profession is still not ready to hear that argument. But if there is an assignment operator, common sense should demand that it not be confused with the equality operator. Sadly, common sense rarely prevails in the design of popular programming languages. That is why JSLint prohibits use of assignment in expression position, comparison in statement position, and == in any position. Those prohibitions allow you to easily avoid a class of nasty bugs. JSLint's prohibitions do not prevent the crafting of good programs. They actually make it easier.

But reasoning about programming style is surprisingly difficult. For example, someone recently wrote this in the G+ JSLint community:

    I have definitely found cases were using assignment
    expressions create beautifully compact code that I
    think is much easier to read than the alternative.

The appeal to beauty gives this the appearance of a powerful argument. But beauty is at best subjective. Certainly in the arena of computer programs, there is not a standard of beauty, so that leads to the conclusion that all representations are acceptable because everything must be attractive to somebody.

But programs have a requirement that they be completely free of error. This requirement is imposed by the computers, because they give themselves license to do terrible things when our programs are not perfect. Perfection, not beauty, must be our goal. I too used to make emotional arguments about programming, and I too had no awareness of how vacant my arguments were.

JSLint has been my mentor on programming style. I did not write JSLint to force my sense of beauty on others. I wrote it to find defects in programs, specifically in my programs. JSLint taught me that if I care about the correctness of my programs, and that should always be our first concern, then I needed to correct my idea of what a good program looks like. We should seek to increase the visual distance between a good program and a bad one. We should not be creating beautiful pockets in which bugs can hide when there are better alternatives.
63
7
Евгений Орехов (Evgeny Orekhov)'s profile photoАнатолий Демидович's profile photoLuca Luve's profile photodaniel low's profile photo
5 comments
 
This needn't be subjective. Measure what % of seeded bugs developers find in alternative formulations of a program. That will depend on developer skill but particular formulations may come up on top in any case.

Douglas Crockford
owner

Discussion  - 
 
JSLint now has a multivar option that tolerates multiple names being declared in a single var, let, or const statement.
7
James Long's profile photoBen Quarmby's profile photoDaniel Langdon's profile photoR Bailey's profile photo
7 comments
 
@Daniel- It's a complete 180. See 
http://javascript.crockford.com/code.html
... and...
http://stackoverflow.com/questions/34862541/expected-and-instead-saw-jslint-multivar-setting

From the Code Conventions link:

"It is preferred that each variable declarative statement and comment [be on their own line?]. They should be listed in alphabetical order if possible."

... after which the sample is...

    var currentEntry; // currently selected table entry
    var level;        // indentation level
    var size;         // size of table

Note there's a least one sample on the conventions page that doesn't follow this rule, though I assume it's an oversight.

            var array,                // array of class names
                ncn = node.className; // the node's classname

My best guess so far is that it's a sort of extension of, "Each line should contain at most one statement," mentioned on that same page.

But yes, it causes a pretty serious refactoring if you don't use the multivar directive (which wasn't in the repo earlier today, at the least).
Add a comment...

Douglas Crockford

Shared publicly  - 
 
Where is the third party?

I have no confidence that the Republicans or the Democrats will provide us with acceptable presidential candidates in next year's election. I need a better option. 
34
2
Kartik Singhal's profile photoBrian Kardell's profile photoShaunak Jadav's profile photoRoy Adams (roytoo)'s profile photo
3 comments
 
At least half of the time this is the case right? First past the post, partially closed primary nomination system controlled by 2 parties, then 2 party general with electoral college virtually guarantees that the candidates who would actually make the most people the most happy will be statistically eliminated.


Douglas Crockford
owner

Discussion  - 
 
Should the global declaration only be allowed with the Assume a Browser option?
47 votes  -  votes visible to Public
Yes
72%
No
28%
1
Douglas Crockford's profile photoRyc O'Chet's profile photo
21 comments
 
AMD does depend on global variables - which should be called "require" and "define" but may be called something else (RequireJS also registers "requirejs" etc) - and is usable on pretty much all JS platforms. AMD is also only one way to have good coding practices that relies on a global (though it's probably 99% of the need while keeping good practices). Larger projects and businesses are more likely to have an absolute requirement for globals when testing due to interactions between server technologies and JS...
Add a comment...

Douglas Crockford

Shared publicly  - 
 
A good presentation on the problem.
12
5
nilesh patel's profile photoChris Tracy's profile photo