WRT: Lisp - Its real power comes from being a metacircular language (like smalltalk, javascript, lua et al.) and you eval expressions (trees) not sequences. Comparing two language so far apart in paradigm doesn’t really make sense. Things easy in one are hard in the other and vice-versa. Attempts to push too many paradigms into a single language (have to date been) failures.
The Jetbrains MPS thing looks very cool. It seems to do a good job at incorporating (unsurprisingly, coming from Jetbrains - they seem to do really good work as a rule) the idea that any DSL should almost be forced to give the IDE enough information to allow its effective use, something that most languages and IDEs have sadly ignored.
It’s too bad that this is so tightly tied to IntelliJ, as a concept (language-oriented programming) I’d love to see it spread much further, but that’s unlikely if there’s only one IDE that has any support for it!
Hmmm on second thought this really doesn’t sound too bad. I mean if you look at how verbose properly using all the collection classes are and can be for some simpler effects.
Granted you’re also going to want to find a way to drastically limit new keywords. I mean you would be talking about 30 some new keywords.
I would recomend adding a new feature to the for each loop, a conditional.
for(PowerUps powerlist : activePowerUps : powerList.isActive)
validPowerUp.add(activePowerUps);
Then again that isn’t the best solution.
Thats not the real problem here. LISP and it’s cousins are used in applications that would be impossible or very hard to work with Java or C++. To be used with Java games we would need a very efficient LISP to bytecode compiler. The simple way the Java VM handles call frames makes it difficult to do an efficient LISP compiler.
The Java language isn’t very bad. What pisses me mostly is the mess of mixing primitives with real objects and the half-assed implementation of generics without real-time type checking RTT. The compiler should be smart enough to know when to use primitives internally and use RTT automatically. This is why we use an high level language, so that we don’t need to bother with small optimizations.
This old essay/rant from Steve Yegge expresses far more eloquently the gist of I’ve been trying to get at in this thread, even if it’s not directly related to inline SQL syntax: http://steve.yegge.googlepages.com/next-big-thing
Don’t be too quick to write off Yegge as just another Java-hater that wishes the whole world coded Lisp - Yegge wrote and maintained a large Java roguelike (Wyvern - http://www.cabochon.com/) as a hobby for quite some time, which apparently grew upwards of half a million lines of Java code, which I’d imagine is a more substantial game codebase than most people here have ever encountered, and he must be a pretty good Java coder, because he’s been at Google a while now.
Not that an appeal to authority means much, but it might at least make you (everyone) re-think whether you’re really content with the language as it is, or if you’ve perhaps grown too comfortable with its flaws and limitations to consider how much easier it could make your life with some small but powerful tweaks here and there…
That’s a lovely rant, and absolutely spot on until he goes on about Ruby, which I really don’t like at all
Cas
There’s some nice stuff in there, but also a lot of ignorant crap… Like this (referring to generics), “…It may be more ‘statically’ type-safe, whatever that means, but my program does actually have to run someday, and then, when it really matters, it doesn’t help me at all.”
Bullshit it doesn’t help you at all. He apparently doesn’t even know what he’s talking about, but feels he can criticize it anyway.
Look at it this way: For many programs, if static type checks were perfect, runtime type checks would be useless because you could prove that they are impossible before ever running the code.
Generics are complicated - I don’t understand the wildcards… but I use the bits I do understand all the time, and it make my code clearer and coding less error-prone.
Anyway… I’m all for evolving the language… but I would like it to happen in ways that seem to fit naturally… the problem I guess is that I’m already biased as to what seems natural… :-
I think JavaFX has done some neat things. If you could write mixed Java and JavaFX in the same source file and deal with the whole array thing then you would have something.
other suggestions that he makes totally break some fundamental goals of java and the list goes on.
but its a rant so it’s quite forgiveable that some stuff hasn’t been tough through… Where there is smoke there’s usually fire though.
Hm I’ve got a phone interview with Google in a few days and Yegge is listed as some pre-interview reading. Have a look at this rant by him about phone-screening programming candidates for Google. Now, I’ve been around for a while, programming for just under 30 years, and commercially for 15. I’ve made quite a few people very rich (even myself, relatively speaking, for a while). I’ve got a games production company with several award winning if not necessarily successful titles, and I’m a shareholder in the market leader in Local Government Performance Management, a company whose flagship product I architected. People generally come to me for advice rather than the other way around. And yet I’d flunk his phone screen at the drop of a hat. I have no idea what the O-complexity is of any of the basic datastructures. I’ve never needed to know but if I did need to know I’d find out on the spot.
So though I agree with some of what he says about the Java language (he was, of course, totally wrong about the Next Big Thing :)), I also suspect that he is one of those slightly-above-normal-cleverness programmers who likes to lord it over anyone not as brilliant as himself, a trait far too common in engineers which effectively amounts to an intellectual’s revenge for being bullied in the playground for being physically meek. The arrogance in the phone interview article shines through the generics rant like the words in a stick of Blackpool rock.
Maybe I’m reading a bit too much into it
Knowing my luck he’ll follow the incoming web links to his rant and be the guy who interviews me on Monday. I will dazzle him with my ignorance and incompetence.
Cas
I doubt that’s true - you may not have been forced to actually prove your intuitions are right, but I all but guarantee you know enough about it (probably more than you even realize) to figure out time estimates for most of the examples he gave there, even if you can’t rattle them off the top of your head.
I think the point with these types of questions is to a) make sure that you have some sense what the data structures are (don’t forget trees!) and why you’d use them, and b) see if you understand how the structures are implemented, and why. Not to see if you’ve memorized the stuff.
The only non-obvious trick to big-O estimates: if divide and conquer is involved, that probably leads to a log N factor somewhere. Binary search? O(log N), because you cut the search space in half each iteration. Binary search over a linked list? Well, a random access lookup takes O(N) time (gotta walk the list!), and the “binary search” bit takes O(log N) lookups, -> O(N * log N) operations total (but nobody does that since a linear search (O(N)) is faster on a linked list). Balanced tree lookup? A binary tree cuts out half the possibilities each time you choose a branch, which means good old O(log N). Worst case (unbalanced) tree lookup? A heavily unbalanced tree is just a linked list, so O(N). Etc and so on.
In any case, it’s probably a decent idea to brush up on some of this stuff before the phone screen - it would probably take an hour or two max to go through all the basic structures and see what the performance characteristics are, just coming up with the barest of “stories” to tell yourself as to why. And it might save you a missed question or two.
Brush up on your trees, if there’s one data structure that’s going to be important at Google and fairly underexercised in most Java code, it’s the tree!
BTW, in other stuff I’ve read by Yegge on the interview process he’s mentioned several times that what he really looks for is a complete fail in each of these areas, not just a bit of thinking, unfamiliarity, or struggling. Can’t find the specific essay where he says that at the moment, but he’s got some other advice at his newer blog, see http://steve-yegge.blogspot.com/2008/03/get-that-job-at-google.html that might be worth looking through as well. Anyone doing screening at Google has almost certainly read his stuff and taken it to heart, so be prepared…
Good luck with the interview, I hope it goes well! I’m sure you’ll do just fine.
On the topic of the Next Big Language, Yegge appears to have shifted, some of his later blog entries indicate that he’s putting his money on Javascript lately, not Ruby. Which in some ways I’m lot happier about (years ago I used to do some of my lighter analysis in Javascript for convenience, and as long as you focus on the language and not the browser integration, it’s surprisingly clean and easy to get pretty sophisticated stuff done in).
It’s funny you should say that, I’m specifically looking to learn Javascript at Google. It’s now probably more ubiquitous than Java, and getting faster. I suspect in many ways it’s crappier but I couldn’t care less if it’s all over the place.
Cas
do have a look at Google’s GWT, I’ve been using it for a while now and its a pretty awesome java to javascript library.
Because of the way my brain works I’m afraid I’ll have to start from first principles before I go learning any libraries and toolkits.
Cas
Yeah it’s a LOT crappier and sadly it IS all over the place. It’s why I hated Google OS as soon as I heard about it When are people going to wake up and realize that a web browser is a shitty platform for applications? And if you do want an app in a browser try using a better language/tool like Adobe AIR or Silverlight or Java(FX)… don’t try to squeeze everything into the shittiest lowest common denominator that is javascript. The very fact that GWT exists is a big smell telling you that javascript is the wrong tool. It’s not like there aren’t several superior alternatives that work fine…
Sigh…
My knowledge of JavaScript is limited to: “It’s a prototype based language”, and that’s it. However it seems to me that it must be getting a worse rep than it should, unless they’ve really screwed up the implementation. I think that the choice of name was a really bad idea and a big part of the preception problem. JavaScript is closer to Lua (prototyped based) than any other currently popular language. Which is funny since the most venom against it seems to come from Lua fanatics. I’d expect that writting a source-to-source transformer from Lua to JavaScript would not be too hard. The reverse is not true since Lua’s low-level only directly supports a single numeric type (normally a double).
I think the name is an issue since people comming from a Java background expect something Java-like because of that. Where it has much more in common with SmallTalk than Java (in the OO world). If fact other than some syntax choices it really has nothing in common with Java.
The prototype based paradigm is very expressive since you can create basic elements of many other paradigms. The cost is that they tend to be (very) slow, but a large part of this is due to the runtime (which are currently still targeting scripting). Their weak point is that are not good for numeric intensive processing and (as noted) current version are not good for any computationaly expensive.
Note that the original point of this thread was a boiler-plate sytax issue. Since prototype language require first-class functions, stuff of this nature should be easy to write.
Again, I’ve never written a single line of JavaScript, so my comments are about how it should be.
This is a misconception. JavaScript does not require a browser.
Aye, but that’s where it’s mostly used. That and its ginger stepchild, ActionScript.
I did rather wonder why the JavaFX team went for a completely new language rather than just using JavaScript.
Cas
For what it’s worth: I’d suggest for anyone thinking about learning JavaScript to start by looking through some SmallTalk introductions and then maybe spend a couple of days hands-on mucking around with Lua.
Cas, Javascript is crap beyond belief. The tools are awful and debugging it is an exercise in self hate. Don’t do it.
I have used SmallTalk and Lua (in a commercial game). I don’t think your advice is very good - SmallTalk tools, for example, are usually excellent. JS tools and runtime environments are awful. JS isn’t hard to learn it’s hard to create anything big with it - it doesn’t handle complexity well. Your code will break without error warnings or with incorrect error warnings and incorrect error line numbers.
Well, in MSIE and (more or less) FF it is.
In Opera, you get DragonFly, which lets you step()/stepInto()/stepOver() code, and it builds proper stacktraces for you.
The only thing remaining is a potentially flawed DOM implementation, but you can’t really blame JavaScript.