Beta

Slashdot: News for Nerds

×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

cancel ×

305 comments

Most important of all? (5, Insightful)

jaymz2k4 (790806) | more than 3 years ago | (#36055420)

possibly the most important of all the languages at this point in time

Not so sure I'd agree with that summary - I don't doubt the importance of JavaScript to the modern internet but I'd be more inclined to consider the C's of this world as the main foundation of the industry.

Re:Most important of all? (2, Funny)

thetoadwarrior (1268702) | more than 3 years ago | (#36055446)

C isn't web scale.

Wait until you fix your first Node.js disaster. (5, Insightful)

Anonymous Coward | more than 3 years ago | (#36055558)

Just wait until you've had to fix your first Node.js and MongoDB disaster. I'm working with one client to get rid of such a system. It is by far one of the worst gigs I've ever had, and I've had to clean up a whole lot of stupid shit before.

JavaScript barely works as a client-side scripting language, and even then the experience is totally shitty for developers and users alike. Slashdot is a really good example of how JavaScript can absolutely fuck up a site unnecessarily.

But it has absolutely no place for server-side development. It's just not up to the task in any way. It's missing basic language features necessary for large-scale server-side development. Its development tools are atrocious. Its runtime performance is horrible. Node.js is fucking stupid, and that's putting it nicely. Using it to query a data store is an extremely idiotic idea. All in all, it's a massive failure.

JavaScript "programmers" have put together some of the worst and most broken systems that I've ever dealt with, and I've been dealing with horrible systems written using languages like PHP, Visual Basic, PowerBuilder and Perl. JavaScript may be one of the biggest computing disasters of all time.

Re:Wait until you fix your first Node.js disaster. (2)

Anonymous Coward | more than 3 years ago | (#36055588)

here here! had similar experiences in my career - completely agree.

Re:Enough pussy-footing ... (5, Funny)

fygment (444210) | more than 3 years ago | (#36055636)

... how do you really feel?

Re:Wait until you fix your first Node.js disaster. (1)

thetoadwarrior (1268702) | more than 3 years ago | (#36055662)

I believe you should read this [google.co.uk] .

Re:Most important of all? (5, Insightful)

VortexCortex (1117377) | more than 3 years ago | (#36055576)

C isn't web scale.

I'm not sure if you're going for funny or not -- Just to clarify, CGI was traditionally done via C. Apache is written in C. To this day, I still write processor intensive server side code in C or C++ (with a few C libs to support cross platform code & CGI) -- Even dinky hosing services like 1&1 offer remote SSH, have C/C++ compilers installed (G++, GCC), as well as GIT.

I wouldn't develop on any system that doesn't at least support this minimal setup -- for web development or otherwise...

Perhaps you mean C isn't a cross platform client side sand-boxed language?
Neither is JavaScript:

It's not cross platform -- The amount of conditional cruft you have to add to ATTEMPT a cross-browser solution is rediculous, so much so that there are entire libraries and frameworks for client side JS just to get most of the way there, and even then, some browsers are left behind.

It's not sand-boxed -- Modern browsers compile JS to machine code and run that... Because the language requires features that make it slow, to do it any other way (bytecode in a VM), is terribly slow.

I use JS, but it's not all it's cracked up to be... Most devs I know only use it as a client side language because it's available -- not because the language is so great.

Re:Most important of all? (5, Insightful)

anonymov (1768712) | more than 3 years ago | (#36055626)

It's not cross platform -- The amount of conditional cruft you have to add to ATTEMPT a cross-browser solution is rediculous

That's not the problem of javascript - that's the problem of implementation. Do you really think it would be any better if someone invented SomeBetterScript back then - and then MS made EvenBettererScript, which would be almost, but not completely, unlike the SomeBetterScript, and then Mozilla added their own extensions, and then other browsers implemented those extensions in incompatible way, adding some of their own in process, and ...

You see what I'm talking about? JS by itself is quite nice language - web client bindings for JS is awful thanks to all the implementors.

And yes, libraries and frameworks are good thing and they do make browser JS crossplatform - think about how AWT/Swing/SWT makes Java crossplatform and what would happen if you had to have your own bindings and workarounds.

It's not sand-boxed -- Modern browsers compile JS to machine code and run that.

And that's pure bullshit. "Compile to machine code and run that" has nothing to do with sandboxing - that's what all the languages that give a bit of concern about performance do, after all. Please come back when you learn the difference between "sandboxing vs non-sandboxing" and "interpreting vs JIT compiling".

Re:Most important of all? (2)

BenoitRen (998927) | more than 3 years ago | (#36055766)

And yes, libraries and frameworks are good thing

I disagree. The web browser has to parse all of that JavaScript every time it loads a page with JavaScript that requires it. In most cases it's not even really necessary, as the JavaScript only uses a couple library functions that could easily be written by yourself (like XmlHttpRequest).

Re:Most important of all? (1)

the eric conspiracy (20178) | more than 3 years ago | (#36056034)

That's not the problem of javascript - that's the problem of implementation.

The language and its implementation are not separable for practical purposes. If either one or the other is no good, the whole is no good.

Web browser/server (1)

Roger W Moore (538166) | more than 3 years ago | (#36055998)

C isn't web scale.

Really? Then what language was your Web Browser or the Web server you connect to written with? It's most likely C/C++.

Re:Most important of all? (1, Insightful)

x*yy*x (2058140) | more than 3 years ago | (#36055448)

I don't think C/C++ are so important anymore. Sure, a lot of underlying stuff is done with them. But so much more that billions of people see everyday is done with html and javascript. More stuff is created directly with those than C/C++. Besides, there's C#, Object Pascal, Assembly, Java and tons of replacements for C/C++. That isn't really the case with JavaScript.

Re:Most important of all? (5, Insightful)

mhh91 (1784516) | more than 3 years ago | (#36055462)

C (and its derivatives) power almost all web servers in use today, and without servers, there's no web. Most browsers are written in C++ today, JS saw the light of day working inside browsers. A lot of programming languages have their main implementations written in C (Ruby, Python, PHP). So, yes, C/C++ are still important in the days of the web.

Re:Most important of all? (5, Insightful)

jepaton (662235) | more than 3 years ago | (#36055468)

Virtually every device has substantial amounts of code written in C or C++. Javascript would be useless on the microcontroller I write C code for. If C and C++ were to vanish overnight we'd be back in the stone age. I won't comment on whether C and C++ belong in the stone age, but it's great that many programmers don't have to think at the lower levels of machine abstraction.

Re:Most important of all? (3, Funny)

Anonymous Coward | more than 3 years ago | (#36055644)

If C and C++ were to vanish overnight we'd be back in the stone age.

Uuum, C/C++ is the stone age!
If one would have written that stuff today instead of in the stone age, one would use the radical cool new language of today: Haskell.

Re:Most important of all? (1)

JamesP (688957) | more than 3 years ago | (#36055776)

Virtually every device has substantial amounts of code written in C or C++. Javascript would be useless on the microcontroller I write C code for. If C and C++ were to vanish overnight we'd be back in the stone age. I won't comment on whether C and C++ belong in the stone age, but it's great that many programmers don't have to think at the lower levels of machine abstraction.

Well, think about this for a second.

Of course most compilers for embedded systems and small microcontrollers are C

However, I wouldn't put past someone to take a subset (or just core JS and some metadata) and write a compiler. And I think it would be very good.

Of course, the processor would have to have at least some 100's of KBs of memory, but I think it would be amazing.

Think about this: JS is already very similar to C. Add Arrays, Maps and first order functions.

Problem: plugging pointers in JS (you could have something like Pascal though - mem[0x1234])

Re:Most important of all? (5, Insightful)

DiegoBravo (324012) | more than 3 years ago | (#36055830)

> If C and C++ were to vanish overnight we'd be back in the stone age.

If COBOL were to vanish overnight, C programmers wouldn't get their paychecks; that's stone age...

Just typical JavaScript ignorance. (3, Insightful)

Anonymous Coward | more than 3 years ago | (#36055470)

JavaScript isn't even that important to the modern Internet. It's pretty isolated to the Web, and even there it's only seriously used by a small number of sites. It just gets a lot of undeserved hype.

Indeed, C and its derivatives and related languages are in fact the main foundation of virtually all software. For every line of JavaScript in a given web site, there will be hundreds, if not thousands, of lines of C or C++ code doing the real work within the JavaScript interpreter, the web browser, the client's OS, the routers between the client and server, the server's OS, the web server, the back-end web app (or the language it's implemented in), the back-end database server, and so forth.

Re:Just typical JavaScript ignorance. (5, Insightful)

itsdapead (734413) | more than 3 years ago | (#36055764)

JavaScript isn't even that important to the modern Internet. It's pretty isolated to the Web,

Yup, and the web isn't very important to the modern Internet at all.

and even there it's only seriously used by a small number of sites.

Just a few tiny, insignificant ones like Slashdot, Google (Docs/Maps/GMail) and any other website that contains anything more interactive than a form submit button. Except the ones that use Flash (but then the ActionScript language used by Flash developers is a superset of ECMAScript.) - or Java, which really is "only used seriously by a small number of sites" (for given values of "small" and "seriously").

Its also the only game in town if you want to target iOS, Android and desktop browsers with the same codebase. Meanwhile, Java's star seems to be falling, .Net/C#/VB (however well respected) are effectively Microsoft-only.

For every line of JavaScript in a given web site, there will be hundreds, if not thousands, of lines of C or C++ code doing the real work within the JavaScript interpreter

Well, yes, that will be true of any "scripting" language.

The statement in TFA that Javascript is "possibly the most important of all the languages" is flamebait, but your position is equally absurd.

The "contest" is probably Javascript vs. Python/Ruby/Perl/PHP. ("CoffeeScript", mentioned in TFA seems to be an effort to make JavaScript look more like the first three of those to appease the haters of curly brackets - where's the campaign to make Javascript look more like PHP, I ask !? :-) ).

Thank you for your ignorance. (1, Interesting)

Anonymous Coward | more than 3 years ago | (#36055836)

In the whole scheme of things, no, the Web isn't overly important. Yes, it's very visible and very hyped in the media, but it's still a comparatively small part of the Internet as a whole. BitTorrent traffic alone far outweighs Web traffic. Then there are more traditional uses like FTP and email. Voice and video teleconferencing are always becoming more prevalent. Then there's also gaming. Don't forget DNS. And there are many other more technical uses that I know you won't be familiar with.

Sites that use Flash and/or JavaScript heavily tend to be rather useless. Slashdot has gotten progressively worse to use as more JavaScript has been introduced. Likewise, Flash doesn't really add anything useful to the table. We could download and play games long before Flash existed. We could stream videos using RealPlayer and other technologies long before YouTube existed. In fact, those real applications are often much effective to use than the Flash- or JavaScript-based "equivalents". GMail, for example, will never be as usable as real email clients like mutt, Thunderbird, and even Outlook.

iOS is already on its way out. Android is absolutely crushing it. Every sensible developer is moving to Android, and the language there isn't JavaScript. It's Java.

JavaScript is nearly irrelevant in the big picture. As a JavaScript advocate, I know you have trouble seeing that. But that's just because of your ignorance. You just aren't aware of the greater scene. Of course JavaScript will look important to you, because it seems that JavaScript is the only thing that you know. Not everyone is as ignorant as you, however. We see that JavaScript is merely a small turd in a huge toilet.

Re:Thank you for your ignorance. (0)

Anonymous Coward | more than 3 years ago | (#36055982)

Why measure importance based on bits transferred, what about time spent? People might leave their bittorrent downloading in the background, but how much time do they spend actually using and interacting with it compared to web pages? I think human minutes is a better measure of importance than bits transferred.

Secondly, while you might prefer non-flash methods of downloading video, even if we agreed flash was a worse method, that wouldn't reduce the importance of youtube and web-embedded video in general, based on how much video people view/share with it. A large and ever increasing amount of news, tv shows, and personal videos are distributed this way.

Android might be overtaking ios, but ios is still massive, and javascript works on both, as well as many different desktop operatings system, and web-pages with javascript require no real installation. This is one of the main reasons it's so popular and will continue to be.

So what you mean when you say it's "irrelevant" is hard to determine, except perhaps it's irrelevant to those kinds of application you consider good or valid. If we simply consider the number and popularity of programs, then web-pages with javascript are clearly towards the top of the relevance scale.

It may be true that for every line of javascript there's a thousand lines of c supporting it, but for every c program that supports the basic structure of the web, there's a thousand web-pages with javascript that run on top of it.

Re:Just typical JavaScript ignorance. (0)

Anonymous Coward | more than 3 years ago | (#36055936)

"where's the campaign to make Javascript look more like PHP, I ask !? :-) )."

It's right here: http://phpjs.org/
A large number of PHP functions implemented in pure javascript.

Re:Just typical JavaScript ignorance. (1)

Rhaban (987410) | more than 3 years ago | (#36055976)

where's the campaign to make Javascript look more like PHP, I ask !? :-) ).

here: http://phpjs.org/ [phpjs.org]

Re:Just typical JavaScript ignorance. (1, Flamebait)

TheGratefulNet (143330) | more than 3 years ago | (#36055908)

when I turn JS off (which is 90% of the sites I visit) I don't miss a thing. in fact, turning it off saves me from a lot of spam.

I have zero respect for javascript and less for a creator who thought we NEEDED this junk.

Re:Most important of all? (0)

Anonymous Coward | more than 3 years ago | (#36055548)

possibly the most important of all the languages at this point in time

Not so sure I'd agree with that summary - I don't doubt the importance of JavaScript to the modern internet but I'd be more inclined to consider the C's of this world as the main foundation of the industry.

^ Agree completely with this. If you took any code done in C away from all devices on the planet today, there wouldn't be a whole lot of reason to live until tomorrow.

Re:Most important of all? (3, Insightful)

somersault (912633) | more than 3 years ago | (#36055582)

"At this point in time" however, the Cs are just doing the same as what they have been doing for decades, whereas JavaScript is becoming a more and more important part of rich, highly cross platform applications. C is good for that too, of course, but it tends to just be a part of the background implementation just now. It is generally not a driving force or limiting factor in how we choose to implement high level applications, whereas JavaScript is.

Already other comments are streaming in (dynamically via JavaScript!) pointing out how basically all devices have software written in C at some level. I know this, the submitter probably knows it, and it doesn't change which is more important right now. For example, JavaScript has done more for making Linux viable on the desktop than C or Java ever has. So many apps these days can be written as web apps, and run on any OS and any hardware, as long as they have a decent web browser. It is currently changing, and will continue to change how we use our computing devices.

Slashdot was better without JavaScript. (1)

Anonymous Coward | more than 3 years ago | (#36055606)

Slashdot, and most other web sites, were far better without JavaScript. Over successive site "redesigns", Slashdot has become increasingly harder and less-efficient to read, and it's much more of a pain in the ass to post comments now.

One used to be able to view all comments in a story by merely changing a dropdown and clicking a button. Now, in order to do the same, we have to drag that stupid JavaScript "Score" slider thing at least twice, with it usually fucking up and not dragging properly a few times. Then we have to scroll to the bottom of the page and click the "Get More Comments" button. This usually has to be done at least 5 to 10 times, since most stories have a few hundred comments. It's far, far worse than it was before.

I know there's a "classic" mode for registered Slashdot users, but I'm not such a user, and never will be. Even then, I hear it's just the previous not-as-shitty-but-still-shitty version that uses JavaScript, just not as stupidly as the current version.

Re:Slashdot was better without JavaScript. (1)

drinkypoo (153816) | more than 3 years ago | (#36055900)

I know there's a "classic" mode for registered Slashdot users, but I'm not such a user, and never will be.

Since your comment was so entertaining, perhaps you will tell us why you won't subscribe, if it doesn't come down to simple incompetence. For me it's that and slashvertisements.

Re:Most important of all? (1)

DarwinSurvivor (1752106) | more than 3 years ago | (#36055694)

JavaScript has done more for making Linux viable on the desktop than C or Java ever has. So many apps these days can be written as web apps, and run on any OS and any hardware, as long as they have a decent web browser.

Most linux users I know actually use c/c++ apps instead of the "web apps". Thunderbird, pidgin, gwibber, etc all beat the pants off gmail, eBuddy, twitter, etc.

Re:Most important of all? (2)

xTantrum (919048) | more than 3 years ago | (#36055814)

mod u up. Must have been a web developer who summarized the article. It's so irritating to me with the advent of web 2.0, that everyone is so focused on the web. Not the internet, the web. As a result i feel like innovation and creativity have been lost in a sea of AJAX, PHP scripts and social networks. I'm very sad to see the commercialization of the internet and seeing us so focused on just this one aspect of computing - which is really just the GUI to the net. I'm hoping thinks like the Kinect will stir things up and bring along some much needed spice in this quagmire of hodgepodge technologies hacked togeter to create a pretty face. As for the person who summarized the article. C my sig.

i still hate it (2)

Torvac (691504) | more than 3 years ago | (#36055444)

its incomplete and stupid at so many parts. i still wait for script type=text/lua or text/python

The community is worse than the language. (2, Interesting)

Anonymous Coward | more than 3 years ago | (#36055510)

While the JavaScript language, development environments and implementations are absolutely terrible, as I see you're well aware, those are not the worst parts of it all. By far, the community is the most atrocious thing related to JavaScript. The people are generally nice enough, but my gosh, are they ever ignorant when it comes to computing.

JavaScript tends to drive away everyone who is even remotely a good programmer, as such people can usually see just how flawed JavaScript is, and they want nothing to do with it. So what we have left over is a bunch of non-skilled "programmers" who think they know what they're talking about, but in reality have absolutely no clue. They continually produce some of the shittiest code that has ever been written.

The scariest part is how they want to start getting involved with server-side development. This was typically one area of web development were good developers could use good technologies to get the job done well. But now the JavaScript community has put together very half-assed Erlang clones like Node.js, and have been hyping them as viable server-side technologies (when they clearly aren't). This is going to be a huge disaster, caused solely by the ignorance of the JavaScript community, and those who are foolish enough to hire such people to develop software.

Re:i still hate it (1)

camcorder (759720) | more than 3 years ago | (#36055562)

I doubt that web browser developers are very inclined to put massive work on coding a python interpreter and optimize it for web. Power of JS comes from the interpreters that web browsers have today. Python framework with web browser would be a new start and interpreters of web browsers would give you more trouble than JS language gives you now. Of course in a long-run it would be better. But JS does the job, so why devs should bother if there is no apparent need for other scripting languages.

I agree (0)

Anonymous Coward | more than 3 years ago | (#36055658)

I would be embarrassed if created a language of Javascript quality for widespread use. I just wish Python was the standard browser programming language. Heck, PHP or Perl would be a significant improvement!

I have a suggestion. (1, Interesting)

mikael_j (106439) | more than 3 years ago | (#36055450)

I know this may be considered radical and groundbreaking for those who design the language but perhaps putting in some way of letting the developer decide if he/she wants to copy an object or just create a new reference to it when doing assignment?

For those who don't know what I'm going on about:

var myObj = new Object();
myObj.foo = 1;
var newObj = myObj;
newObj.foo = 5;
alert(myObj.foo);

That will display a dialog with "5" in it because newObj and myObj are basically the same object which is the opposite of how it works in most other languages that are commonly used these days.

Oh, and there's no magic "DON'T FUCKING DO THAT!" operator either...

Re:I have a suggestion. (1)

gamblenic (835393) | more than 3 years ago | (#36055476)

When you say "most other languages" which ones are you thinking of, because that displaying 5 is exactly what I would expect from most other languages.

Re:I have a suggestion. (1)

mikael_j (106439) | more than 3 years ago | (#36055486)

Look at that example again. It's not alert(newObj.foo), it's alert(myObj.foo).

Re:I have a suggestion. (1)

maxume (22995) | more than 3 years ago | (#36055504)

Any language with objects and names (instead of variables and memory) behaves that way.

Re:I have a suggestion. (3)

mikael_j (106439) | more than 3 years ago | (#36055542)

Yes, I just re-read what I've been posting here and I'm not sure what exactly I was trying to argue. I'm going to blame my hangover and the fact that I spent several days last week battling datetime handling in JavaScript (which I will maintain is an abomination simply on the grounds of not supporting ISO-8601 formatted dates in a world where everything else uses ISO-8601).

I'm actually baffled by the fact that I managed to crank out two posts before realizing that I was rambling incoherently. Now I'm going to go drink some water and try to make my headache go away...

Re:I have a suggestion. (3, Informative)

bunratty (545641) | more than 3 years ago | (#36055612)

You're arguing for value semantics (as in C++), as opposed to reference semantics (as in Java, Python, and JavaScript). In the latter languages, what many programmers think of as objects are really references to objects. In your code, myObj and newObj are two references that point to the same single object. Don't feel bad -- I talk to many Java programmers who still don't quite grasp this concept. Good old pointer diagrams make it clear; get a book that shows references as boxes with arrows that point to the objects they refer to.

Re:I have a suggestion. (2)

dr2chase (653338) | more than 3 years ago | (#36055792)

Yes, but (speaking as a language designer and implementer, and this problem is a big one) you more or less admit that the program doesn't stand on its own ("Good old pointer diagrams make it clear"). One problem with programming languages is that they are often designed by compiler writers or interpreter writers, for whom such pointy data structures are ever-so-useful, but in the so-called real world, by-value is much more often the case. "Value" is also much more useful when you set out to do things in non-micro-managed parallel; anything shared and mutable gives you the ability to observe Before and After, and sometimes your program depends on that.

Re:I have a suggestion. (1)

Jamu (852752) | more than 3 years ago | (#36055502)

var newObj = myObj.copy()?

Re:I have a suggestion. (1)

Timmmm (636430) | more than 3 years ago | (#36055506)

C++ at least. It's one of the biggest things I miss in Java-like languages. That and RAII.

Re:I have a suggestion. (0)

Anonymous Coward | more than 3 years ago | (#36055514)

Lots of C++ libraries seem to miss RAII. I'm looking at you, member function, Create.

Re:I have a suggestion. (0)

Anonymous Coward | more than 3 years ago | (#36055578)

Lots of C++ libraries seem to miss RAII. I'm looking at you, member function, Create.

Unfortunately, that's a hack to deal with another problem in C++, tight-binding of classes. Unless you force yourself to always use pImpl, it is very hard to maintain binary compatibility with objects since users of classes are reliant on the old size when allocating storage from the stack or heap for it.

A well designed library will generally see this problem and avoid it by using pImpl, only lightweight classes and templates need their guts exposed. You can hack around the failure to use a proper design with a handle/smart-pointer class ('external' pImpl) that re-abstracts that Create function back into a constructor.

C++ is still my language of choice, but it really could have been so much better without beating the "don't pay for what you don't use" drum so hard. An invisible global const holding the sizeof(Class) would have done the trick, the compiler could just generate code that pulled the value of the const, subtract that many bytes from the stack, create a pointer to there and run the constructor. Instant forward compatibility.

Re:I have a suggestion. (0)

Anonymous Coward | more than 3 years ago | (#36055720)

couldn't you create a CRTP template and a size_of-like function to do that for you?

Re:I have a suggestion. (0)

Anonymous Coward | more than 3 years ago | (#36055570)

You've been coding in Java or another language that uses references heavily . . . Java does this to improve performance (using memory addresses) and security (not giving you access to pointers).

In C/C++, this would output "1" and the same goes for any other language that lets you choose if you want to make a copy or use a reference.

If you want C/C++ to behave like Java, the line would read:

var * newObj =

If you want Java to behave like C/C++, the line would read:

var newObj = myObj.clone( );

Re:I have a suggestion. (0)

Anonymous Coward | more than 3 years ago | (#36055638)

Looks like Slashdot filtered out the ampersand in my comment. That should have read:

If you want C/C++ to behave like Java, the line would read:

var * newObj = 'ampersandCharacter'myObj;

Re:I have a suggestion. (0)

Anonymous Coward | more than 3 years ago | (#36055488)

That's exactly how most languages work, among those that have reference semantics for objects: Java, C#, Python, PHP, Ruby, Lua, Object Pascal. C++ is a counterexample, but it hardly counts as "most languages".

Re:I have a suggestion. (0)

mikael_j (106439) | more than 3 years ago | (#36055498)

Uh, if I create an object in C# then use the "=" operator to create a copy of the object then that is a copy which mean that these are two different identical objects. If I change the data inside one of these objects only this object is changed. With JavaScript the "=" operator just creates a reference to the original object and thus changing data in the "new" object actually changes the original.

Also, the same is true with PHP. Unless you explicitly create a reference to the original object you create a copy of the object which means changing one does not change the other.

Re:I have a suggestion. (0)

Anonymous Coward | more than 3 years ago | (#36055516)

You sir must be a terrible C# programmer if you think assignment copies objects.

Try this:

using System;

static class Program
{
                class Foo
                {
                                public int foo;
                }

                static void Main (string[] args)
                {
                                var myObj = new Foo();
                                myObj.foo = 1;
                                var newObj = myObj;
                                newObj.foo = 5;
                                Console.WriteLine (myObj.foo);
                }
}

Re:I have a suggestion. (1)

nogginthenog (582552) | more than 3 years ago | (#36055522)

No it doesn't. In C# "=" creates a second reference, exactly like your javascript example.

Re:I have a suggestion. (1)

h4rr4r (612664) | more than 3 years ago | (#36055878)

Yet another reason to avoid C#. If I want a pointer to an object I will use that.

Re:I have a suggestion. (0)

Anonymous Coward | more than 3 years ago | (#36055546)

two different identical objects

Fucktard.

Re:I have a suggestion. (1)

Dr_Barnowl (709838) | more than 3 years ago | (#36055610)

I can't speak for PHP, but in C# that only applies to primitive types. C# has exactly the same behaviour as your JavaScript snippet. As does every other language that supports reference types.


public class RefAssign {
        public int change;
}

public class Program {
        public static void Main(string[] args) {
                RefAssign oldObject = new RefAssign();
                oldObject.change = 1;
                RefAssign newObject = oldObject;
                newObject.change = 5;
                System.Console.WriteLine(oldObject.change); // Emits '5' on the console
        }
}

Re:I have a suggestion. (0)

Anonymous Coward | more than 3 years ago | (#36055540)

Got to love when someone who has no clue what they're talking about makes "suggestions" for a language.

Re:I have a suggestion. (1)

dr2chase (653338) | more than 3 years ago | (#36055804)

Yeah, but if you're designing a language, people like that are going to be using it. If your language design can help confused people (i.e., most people) avoid "stupid" (i.e., human, common) errors, that's a win.

Because otherwise, it devolves down to one of those stupid "real men spray III's and V's onto Si" pissing contests.

Re:I have a suggestion. (0)

Anonymous Coward | more than 3 years ago | (#36055654)

That's not suprising in the least. What part of the new operator do you not understand?

Re:I have a suggestion. (0)

Anonymous Coward | more than 3 years ago | (#36055670)

You only made one object (new Object()), so why would you expect there to be more than one object?

nothing to talk about; stage of unpopulationing (-1)

Anonymous Coward | more than 3 years ago | (#36055464)

less (people) is now mandatory. which might fly, except for the motives for the biblically required reductionalizations. passed over again? don't fret, most of us get to die horribly, for god, from terror, so no surprises. coffee costing itself out of use? fuel of the unchosen?

disarmament is ongoing, despite the endless advertisements disacknowledging same. thanks from everybody everywhere. as our self-appointed chosen leaders lament though; it's not over until they're long gone, & they have no plans to leave, ever.

fix JavaScript, please (2)

t2t10 (1909766) | more than 3 years ago | (#36055480)

While I generally don't like stuff coming out ouf technical committees, sometimes the alternative is worse... like in the case of JavaScript.

I call BS (1)

Anonymous Coward | more than 3 years ago | (#36055482)

JavaScript is currently an important language â" possibly the most important of all the languages at this point in time.

bullFUCKINGshit.

Javascript is a disaster (2, Insightful)

mlwmohawk (801821) | more than 3 years ago | (#36055490)

The problem with javascript is that it is one of the WORST languages and environments. I dare to say Brandan owes the whole industry a great big apology. If he were japanese, there is a traditional act he should perform. Javascript doesn't have types to speak of, doesn't handle numbers very well, I mean seriously "+" appends two numbers? No scope to speak of. It looks object oriented, but has no real notion of classes. No inheritance. All of the features that have made languages "safer" and "easier" to program in, javascript lacks. I can't think of one innovative or positive aspect of javascript, and lament that it is, alas, the only option at this point. Visual Basic is a better language, and I hate VB too.

Javascript is a hack by a person who didn't know better and we are stuck with it. I shake my head. For decades people have been creating new computer languages. ruby, java, perl, erlang, c++, c, pascal, basic, cobol, fortran, etc. All of these had an objective, to allow some some form of expressiveness or simplicity. Yet, javascript is on all the browsers. Irony for sure.

Re:Javascript is a disaster (1)

anonymov (1768712) | more than 3 years ago | (#36055592)

either you're just trolling or you don't have an idea what are you talking about.

"doesn't have types" can be said about half of modern languages - you mention ruby and perl, f.e.

"+" doesn't append _two numbers_, but it can append _number to string_ - which you can have in any language with operator overloading.

"looks object oriented, but has no real notion of classes" and "no inheritance" comes from your ignorance, you should read up on prototype-based OO, really.

P.S.: Insightful? Mmmm, yeah, that gave me an insight in the mind of ignorant haters a bit.

Re:Javascript is a disaster (5, Interesting)

maraist (68387) | more than 3 years ago | (#36055676)

""+" doesn't append _two numbers_, but it can append _number to string_ - which you can have in any language with operator overloading."
function foo(x,y) { return x + y; }
foo("5",6) == "56"

In every other language I've seen, the CORRECTly expected result is 11 or error. Perl, C++, etc. The point is that you can never trust your input if you are expecting numeric.

You must guard the inputs with explicit (and thus inefficient/unreadable casts). If you're using a 3rd party library, you'll be pulling you hair out trying to figure out what went wrong.

The language is full of such wtf's. While you can happily redefine most core operations (e.g. how jQuery fixes IE), you can't overload the + operator. Call my cynical, but I don't like languages that let you corrupt basic building blocks.

That being said, javascript is excellent at what it was designed for - and passable for what it's currently used for, but I fear for the future if it's the basis of future industrial strength applications.

One place I WOULD like to see it extended is DB's.. CouchDB has a very nice java-script based map-reduce framework - it leads to concise and expressive code (that's really NASTY if plsql, etc are used).

Basically javascript is excellent fragment-code. But HORRIBLE for modular libraries - having to write an entire library (like jquery) in a scoped wrapper then assigned to a mutable/corruptable symbol is sick. (Especially since library A will mutate library B without permission - hello 1970s!!)

Re:Javascript is a disaster (1)

Migala77 (1179151) | more than 3 years ago | (#36055774)

""+" doesn't append _two numbers_, but it can append _number to string_ - which you can have in any language with operator overloading."
function foo(x,y) { return x + y; }
foo("5",6) == "56"

In every other language I've seen, the CORRECTly expected result is 11 or error. Perl, C++, etc. The point is that you can never trust your input if you are expecting numeric.

If you think Javascript is weird, try executing this in C:
"123"+1

Re:Javascript is a disaster (0)

Anonymous Coward | more than 3 years ago | (#36055602)

I mean seriously "+" appends two numbers?

In what context? If you simply have two numbers (and nothing else), "+" adds them together, exactly as you'd expect.

Javascript is a hack by a person who didn't know better

I don't think it was ever intended to be that "serious" a language when it started out, only a simple scripting tool, so I'm not sure the "didn't know better" criticism is valid. I'd guess it's a "hack" insofar as most of the more advanced features were added in a semi ad-hoc manner, starting from a base that you probably wouldn't have started from in advance if you'd known what you were aiming for.

But that's with the benefit of hindsight.

Re:Javascript is a disaster (4, Informative)

TheRaven64 (641858) | more than 3 years ago | (#36055614)

It looks object oriented, but has no real notion of classes. No inheritance.

I agree with most of your points, but not this one. Class based and object oriented are orthogonal. Simula was class based, but not object oriented. JavaScript and Self are object oriented, but not class based. And JavaScript does have inheritance, a reduced form of the same differential inheritance that Self has (only one parent, can only be assigned at construction time). New objects inherit from the object in the prototype field of the constructor object.

Re:Javascript is a disaster (2)

ltmon (729486) | more than 3 years ago | (#36055632)

I really don't think you understand Javascript quite enough to be commenting this strongly on it.

It does have types, to speak of and to use. They are in the spec, they are in the language, they work. http://bclary.com/2004/11/07/#a- [bclary.com]
Since when has "+" appended 2 numbers? When they are strings I would imagine, which is exactly what most languages do. You might need to get your head around javascript types to stop this happening.
Javascript has scope -- it's quite well defined.
Object oriented does not mean classes, there are other ways of doing it. In particular, the prototype pattern which is followed by javascript. It can have inheritance because of this pattern also.

Javascript has been an ECMA standard for the last 15 years, and cannot be thought of as a one-person hack in any way.

I shake my head.

Re:Javascript is a disaster (1)

mlwmohawk (801821) | more than 3 years ago | (#36055820)

Since when has "+" appended 2 numbers?

Two objects that have always contained numerical values, were assigned numerical values, are treated as strings. You always have to explicitly cast them as numbers. Which is bogus. Just the typing alone hurts my fingers.

Javascript has scope -- it's quite well defined

Yes, its well defined as being almost pointless, but, yes, you are right it has "scope."

Object oriented does not mean classes

Umm, yes it does. You may call them what you wish, but "object oriented" has a definition and means something. Inheritance, polymorphism, etc. Of which, javascript has not.

Javascript may be a standard, but it is a bad "standard."

Re:Javascript is a disaster (1)

multipartmixed (163409) | more than 3 years ago | (#36055960)

Wikipedia defines "Object-Oriented Programming" as

a programming paradigm using "objects" â" data structures consisting of data fields and methods together with their interactions â" to design applications and computer programs.

I know you probably only went to a school which taught Java, and so don't understand that object oriented programming can look like something other than Java, but, in fact, it can. Classical inheritance, polymorphism, etc, are good companions but they do not define the paradigm.

> Two objects that have always contained numerical values,
> were assigned numerical values, are treated as strings

Please explain how you meaningfully assigned numerical values to an object in JavaScript.

Re:Javascript is a disaster (0)

Anonymous Coward | more than 3 years ago | (#36055640)

It looks object oriented, but has no real notion of classes. No inheritance

Your ignorance is astounding!

Re:Javascript is a disaster (5, Informative)

roman_mir (125474) | more than 3 years ago | (#36055650)

Javascript doesn't have types to speak of

str = "10" + 2; - becomes "102"
num = 10 + 2; - becomes 12
num = 10 + 2 + "2"; - becomes 14

num = "10" - 3; - becomes 7
num = 10 / "2"; - becomes 5
num = "2" * 4; - becomes 8

num = 35.00;
str = "VALUE IS: " + num; - this becomes "VALUE IS 35".

--

Sure, it's a bit strange, but nothing extraordinary.

---

No scope to speak of

well, it's not true really. In the following example x will have global scope and y will be local to its function:

x=2;
function test() {
    y = x + 3;
}

--

no real notion of classes

function Person(name, gender) {
        this.gender = gender;
        this.language;
        this.name;
        this.toString = function() {
                return '' + this.gender + ' ' + language;
        };
}

Person.prototype.getName = function() {
        return this.name;
};

var person = new Person('Bob', 'male');
person.language = 'English'; ...

person.gender - this is 'male'
person.language - this is 'English'.
person.toString() - this is 'male English'.
person.getName() - this is 'Bob'.
--

Of-course you can also just evaluate a string into a class on the fly, few language allow that:
eval('
var person = {
        name: "Bob",
        gender: "male",
        toString: function () {
                return this.name + " " + this.gender;;
        }
}
');

person.name - this is 'Bob'
person.gender - this is 'male'.
person.toString() - this is 'Bob male'.

No inheritance

- well, there is the keyword "inherits" and it does allow an object to be extended and you can use the 'prototype' to have multiple inheritance.

--
I am not saying this language is wonderful, whatever, but saying it is lacking various features, that it clearly has, even though they look different from other languages... it's disingenuous.

As to the question whether this language has anything that others do not, again, how about on the fly reflection via evaluation of strings into objects? When I first saw that over a decade ago, I thought it was a neat concept then, I still think it's a neat concept today.

Re:Javascript is a disaster (1)

johnbellonejr (1293910) | more than 3 years ago | (#36055730)

well, it's not true really. In the following example x will have global scope and y will be local to its function:

x=2; function test() { y = x + 3; }

--

That's quite wrong. Both y and x will be global scope. You just declare y with "var" in order for it to be a function scope variable. The major problem with Javascript is that it is a hodge-podge of different languages mixed together where the semantic syntax is "C-like"; so you get a bunch of programmers who are arguing over the logic of scope when they really don't understand the rules of the language well enough.

Re:Javascript is a disaster (1)

roman_mir (125474) | more than 3 years ago | (#36055760)

You are correct, I missed 'var'.

It does not change the fact that there is scope, it only means I made a syntax error.

Re:Javascript is a disaster (0)

Anonymous Coward | more than 3 years ago | (#36055738)

In the following example x will have global scope and y will be local to its function:

x=2;
function test() {

    y = x + 3;
}

--

Not. Unless you explicitly make y local (using var) it is treated as a member of the global object (i.e. it is globally accessible).

Re:Javascript is a disaster (1)

roman_mir (125474) | more than 3 years ago | (#36055770)

yes, I said I made a syntax error. [slashdot.org]

I expect another 5 comments about this, but it does not change the fact that there is scope if you do not make the same syntax error as I did.

Re:Javascript is a disaster (1)

Nocturnal Deviant (974688) | more than 3 years ago | (#36055780)

Mod this guy up, one of the few intelligent responses on this entire article and, the only one to give examples of why he is correct instead of blithering around like he knows everything.

Even openly admitted to making an error.

Re:Javascript is a disaster (1)

roman_mir (125474) | more than 3 years ago | (#36055844)

just in case... this is /. after all, there is another error there, I should have said

this.name = name;

in the first 'Person' function.

Oh, and with the 'eval' function, you should have the entire contents of that in one line, not split across multiple lines, or use escapes there...

Re:Javascript is a disaster (2)

roman_mir (125474) | more than 3 years ago | (#36055872)

and more :)

num = 10 + 2 + "2"; - becomes 122

and the corrected "Person " functions is:

function Person(name1, gender) {
                this.gender = gender;
                this.language;
                this.name1 = name1;
                this.toString = function() {
                                return '' + this.gender + ' ' + this.language;
                }
};

missed 'this.' before 'language' in the 'toString'.

Oooh well.

Re:Javascript is a disaster (0)

Anonymous Coward | more than 3 years ago | (#36055858)

Thanks for bringing some facts to this smorgasbord of javascript bashing. Perhaps it's a greatly flawed language, but its features and merits deserve a fair hearing too.

Re:Javascript is a disaster (0)

Anonymous Coward | more than 3 years ago | (#36055978)

Perl's had eval() (which is "on the fly reflection via evaluation of strings into objects") before javascript ever did.

Re:Javascript is a disaster (1)

roman_mir (125474) | more than 3 years ago | (#36055992)

and I said: 'few languages allow that', didn't I? Also do we have Perl running inside a browser nowadays?

Re:Javascript is a disaster (0)

Anonymous Coward | more than 3 years ago | (#36055666)

Javascript is responsible for more bad websites than <blink>.

Re:Javascript is a disaster (1)

Anonymous Coward | more than 3 years ago | (#36055816)

Whilst I agree with the thrust of your argument, there are a few mistakes.

No scope to speak of.

JavaScript has scopes. A variable declared in a function goes away at the end of the function, same for the body of an if, a loop, etc. Standard C/C++ rules apply that a variable declared in the parent scope carries into a child scope (variables declared before a function are accessible inside the function. Things get screwy with closures, of course, but that's typical functional crap.

It looks object oriented, but has no real notion of classes. No inheritance.

Yes and no. JavaScript is object oriented in that everything is an object, it just doesn't follow the traditional model. Unfortunately, this is trumpeted as a feature rather than a bug (The concept of a class is a useful refinement over the more primitive object soup style used by JS since it makes it far easier to reason about the system's behaviour — open for extension, closed for modification). The JS object model is more abstract and less intuitively helpful which makes it more difficult to use correctly but you can implement inheritance using the prototype member. eg. [mozilla.org]

function Class1() {
    this.my_value = 5;
}
Class1.prototype.something = function() { return this.my_value; };
function Class2() {
    Class1.call(this);
    this.my_value = 10;
}
Class2.prototype = new Class1(); // inherit
Class2.prototype.constructor = Class2; // constructor points to Class1() due to above
Class2.prototype.something_else = function() { return 6; }; // extend
var obj = new Class2();
alert(obj.something() + obj.something_else()); //16

All of the features that have made languages "safer" and "easier" to program in, javascript lacks.

I agree with this notion, unfortunately, I see "safer and easier" as being in direct opposition to the current trend of dynamic/duck-typing in newer languages (auto-typing [type inference] is fine). I like compiler errors, they find bugs before the program crashes, or worse, results in a production system that appends a number to a string instead of adding two numbers causing the output to be completely wrong when a difficult to trigger code path runs.

I can't think of one innovative or positive aspect of javascript

JavaScript is the bastard child of Scheme/Lisp, Smalltalk and Java. It inherits the polished turd ugly syntax of C/C++ (from Java), a poor implementation of everything as an object (Smalltalk) and an obsession with minimalist abstract syntax like recursive closures from Lisp. This is pretty much a match made in hell.

Re:Javascript is a disaster (1)

the eric conspiracy (20178) | more than 3 years ago | (#36056000)

Mod parent up some more.

It may have some of these features, but they are a trap. People talk about it being object oriented and so on, and there are some features that make it look that way, it is a trap that leads you into programming hell.

Then the fact that every implementation of the language is some variant or another and you need browser specific code in real world Javascript.

All all of these libraries? They sound nice and all, but when you go to use them you quickly find yourself dropping to low level code to get teh speed.

In other words I just don't like it.

Readability (2)

Timmmm (636430) | more than 3 years ago | (#36055508)

When did it become acceptable to have the content take up only 1/4 of the page width?

Re:Readability (1)

Inda (580031) | more than 3 years ago | (#36055604)

1/6 of the screen here.

The blank areas are probably full of adverts. ;p

Re:Readability (1)

game kid (805301) | more than 3 years ago | (#36055688)

Content? Content!? Don't you get it? Internet is the new TV, and it needs more 2-hour-long commercials for Coca-Cola, Ford, and Bing [wikipedia.org] . Who cares who wins? It's all about who fights, who's dating, and who's the 1,000,000th page view (CLICK HERE [example.org] to claim your prize!).

Javascript might be in *it's* most important time (1)

plaukas pyragely (1630517) | more than 3 years ago | (#36055518)

..but in no way it's the most important programing language of all.

Re:Javascript might be in *it's* most important ti (1)

BenoitRen (998927) | more than 3 years ago | (#36055798)

What you emphasise isn't even written correctly. Please retake your grammar classes.

Continual tinkering: required? (1)

Compaqt (1758360) | more than 3 years ago | (#36055526)

Isn't Javascript flexible enough to let programmers define their own programming styles without the need to tinker with the language proper?

It seems to me most of the innovation in the Javascript space is taking place in libraries/frameworks (like jQuery, Dojo, Scriptaculous, Prototype, YUI, GWT and so on), as it should.

What will the point of some new syntax be?

jQuery, Dojo, YUI, etc. are not innovations. (0)

Anonymous Coward | more than 3 years ago | (#36055690)

Those aren't "innovations". They're merely hacks to get around some serious deficiencies with JavaScript and its browser-based runtime environment.

jQuery, for instance, wouldn't even be useful if the DOM weren't so horribly fucked up, and if JavaScript and DOM implementations didn't vary so much between different browsers.

Perfect example of popularity over quality (1)

Anonymous Coward | more than 3 years ago | (#36055544)

I hate Javascript. I've hated it since the early days of the web when I saw that it was just a half-assed scripting version of real C-syntax programming languages (take your pick on which one). Web programming is much more complicated than it needs to be due to the combination of a crappy client-side programming language (Javascript, I'm looking at you) and a presentation layer that was never designed to support software (that's HTML lurking in the corner). These two are the foundation of every standard web app made today. The world has evolved this way because they are the least common denominator technologies and because they were easy for the script kiddies who grew up to be today's web programmers.

Re:How is popularity over quality bad? (1)

fygment (444210) | more than 3 years ago | (#36055672)

Maybe the failure was that no one who was tech savvy deemed it worthwhile to create a language that could be popular.

So here's a challenge: instead of bitching about js come up with something that can draw users away from js.

If you can't, then who's the failure?

Re:How is popularity over quality bad? (1)

Hognoxious (631665) | more than 3 years ago | (#36055750)

So here's a challenge: instead of bitching about js come up with something that can draw users away from js.

If you can't, then who's the failure?

At logic, it's you.

I don't need to have made any movies to know that Uwe Boll is shit.

Re:Perfect example of popularity over quality (-1)

Anonymous Coward | more than 3 years ago | (#36055704)

This is what the industry is, take it or leave it.

Sounds like you probably need to quit programming altogether, or maybe just stick to programming microcontrollers. Have fun with that.

Re:Perfect example of popularity over quality (2, Insightful)

Lennie (16154) | more than 3 years ago | (#36055864)

Most of what is bad about JavaScript isn't so much the language, but the environment. People still drag their IE6 on to the internet and they expect things to work and it seems many website builders try to oblige them. They work around the problems in that 10 year old software. Many things have changed since then.

I do not know what you do, but let's say you are a Java programmer, when you code do you always keep in the back of your mind it should still work on the 1.3 runtimes from 10 years ago ? And do you check/test it too ?

If you are a C-programmer developing programs which run on Linux, you always create 2 code paths ? One which compiles and runs on Linux 2.2.x/gcc 2.95.x ? And some #ifdef where you take advantage of the newer features which Linux and other modern operating systems offer you ?

Or do your programs still compile against the libraries of KDE3 ? QT from before 3.0 ? Or the GTK1.2 ? And do you test this ? And regularly ?

So yes, there is some cruft. That doesn't mean the newer stuff can be exciting to people.

The HTML5 and other new specifications has a lot of good things in it, the WHATWG was specifically created to create a new specification for creating applications, which has now grown into the HTML5-specification as it is now. JavaScript it self has some really interresting properties.

Re:Perfect example of popularity over quality (1)

Lennie (16154) | more than 3 years ago | (#36055940)

I could also ask you something else: do you think you could have created something better in 10 days ? That is the time it took Brendan Eich to create something from scratch, 10 days from doing to language design to a working and shipping version.

Crockford on JavaScript (2)

aixylinux (1287566) | more than 3 years ago | (#36055916)

I don't see where anyone has yet mentioned Doug Crockford's excellent videos on JavaScript. These are all on YUI theater. http://developer.yahoo.com/yui/theater/ [yahoo.com] All the criticisms mentioned here are discussed in depth. Crockford deals with the good and bad parts of JavaScript from the perspective of years of detailed research on it. And like it or no, JS is available in a useful, common subset on all modern browsers. The whole HTML, CSS, DOM, JavaScript ball of wax is a kludge that happened by the chaos of historic accident. But we are stuck with them, and Crockford's notions of how to do JS right are worth your time in viewing the videos.
Load More Comments
Slashdot Account

Need an Account?

Forgot your password?

Don't worry, we never post anything without your permission.

Submission Text Formatting Tips

We support a small subset of HTML, namely these tags:

  • b
  • i
  • p
  • br
  • a
  • ol
  • ul
  • li
  • dl
  • dt
  • dd
  • em
  • strong
  • tt
  • blockquote
  • div
  • quote
  • ecode

"ecode" can be used for code snippets, for example:

<ecode>    while(1) { do_something(); } </ecode>
Create a Slashdot Account

Loading...