Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Bongo Bill
Jan 17, 2012

Can't use numeric constants as enumerated values, for one thing.

Adbot
ADBOT LOVES YOU

Bongo Bill
Jan 17, 2012

1337JiveTurkey posted:

Semi-serious idea: Cut out the middleman and store the parse tree directly in an open format like XML, YAML or JSON. Then have editors use a grammar to display the file for editing and to save the edited file. Use stylesheets to format the displayed source code. If you don't give a gently caress about whitespace, then you might as well have a language that doesn't give a gently caress about whitespace.

Greenspun's Tenth Rule comes to mind.

Bongo Bill
Jan 17, 2012

Somebody was asking me about whether there was a way to define constants in Javascript. God help me, there is. This is the example I ended up giving them, along with a warning not to do it:

code:
(function(){
    var _g_ = Function('return this')();
    Object.defineProperty(_g_, 'DEFCONST', {value: function(name, val){
            Object.defineProperty(_g_, name, {value: val});
        }});
})();

DEFCONST('MY_CONST', 42);
MY_CONST = 5; // does nothing
alert(MY_CONST); // 42

Bongo Bill
Jan 17, 2012

I'm glad that study exists, because now it means I have a reason to pick a style and stick with it in solo projects.

Bongo Bill
Jan 17, 2012

Java's got a very mature ecosystem surrounding it. There are Java libraries for drat near everything and the standard library is quite featureful (some would say bloated). It basically defines what "enterprise" coding looks like, for good or for ill, which is to say it tends to encourage verbosity and is probably overkill for very small-scale projects. There are open-source and commercial tools for Java development that surpass most other languages in their sophistication; the most widely-used open-source IDE was originally developed for (and still best supports) Java development. JVM bytecode can be run virtually anywhere unaltered, and there are many other stable languages that target the JVM (and call Java libraries) if you don't like Java proper.

The language itself is basically a subset of C#. (Or, since Java is older, say that C# is a superset Java.) If your background is in C# then you might find Java a bit stifling and awkward but you won't have to learn any new tricks.

Bongo Bill
Jan 17, 2012

One way it was explained to me is something like this: Where functional programming works by modeling the solution, OOP works by modeling the problem. You approach the task from the opposite direction.

But a large part of the problem is that a lot of beginning CS students are treated (rightly or wrongly) like they have no understanding of taxonomy, which is a concept that comes up a lot in OOP even if it doesn't exactly correspond to what it's useful for in the real world.

Bongo Bill
Jan 17, 2012

Have you tried D?

Bongo Bill
Jan 17, 2012

OBAMA BIN LIFTIN posted:

Personally, not many women are in computers. There must be a solid empirical reason for this?

It's because there's not enough room for a woman inside of one. They're pretty small, mostly. Edit: computers, I mean

Bongo Bill
Jan 17, 2012

There are even fewer men in computers than women because men are larger.

Bongo Bill
Jan 17, 2012

This thread has a lot of wrong tools.

Bongo Bill
Jan 17, 2012

Subjunctive posted:

Fishing in the pond of "people who have their poo poo together enough to participate on github" is going to be better odds than the pond of "everyone who uploaded a resume"

Sentences like this make it sound like a requirement.

Bongo Bill
Jan 17, 2012

Being able to port existing code to a browser is valuable, apparently.

Bongo Bill
Jan 17, 2012

Type and symbol names changed, but otherwise unaltered:

code:
v.Field = (SomeEnum)15; // this means SomeEnum.Foobar

Bongo Bill
Jan 17, 2012

If the only thing that matters about a variable is that it is an instance of its type, then naming it after its type is the most appropriate choice.

Bongo Bill
Jan 17, 2012

It's always a good time to remember FizzBuzzEnterpriseEdition.

Bongo Bill
Jan 17, 2012

Don't switch statements get optimized into jump tables when compiling, or am I thinking of .NET?

Bongo Bill
Jan 17, 2012

C# properties are what you want. Java does not have syntax for them. Just use getters and setters. You'll get used to it.

Bongo Bill
Jan 17, 2012

NihilCredo posted:

I had a wild encounter in the F# subreddit and now I think I understand better the story about Babbage and the MPs.

This story is unfamiliar to me.

Bongo Bill
Jan 17, 2012

Using non-boolean values in boolean contexts should be avoided because the results are often surprising.

Bongo Bill
Jan 17, 2012

PHP is certainly the most Kafkaesque language.

Bongo Bill
Jan 17, 2012

It's not close to production-strength yet, but Stencila is germane to this topic.

Bongo Bill
Jan 17, 2012

Node was invented by someone who was looking for ideas for things to do with Javascript, and he misunderstood them when they told him to cram it in his backend.

Bongo Bill
Jan 17, 2012

Of all the problems with Javascript, namespace issues with the window events is way down on the list. I don't hate it most.

Bongo Bill
Jan 17, 2012


This is just verbose currying.

Bongo Bill
Jan 17, 2012

Some pairs of functions can be proven equivalent, but there's no general way.

Bongo Bill
Jan 17, 2012

Type systems can only enforce what they can prove.

Bongo Bill
Jan 17, 2012

We can't just not paint the bike shed.

Bongo Bill
Jan 17, 2012

HappyHippo posted:

When confronted with static typing some people jam everything into string literals to shut the compiler up. It's basically a form of weak typing. I've seen numbers, bools, and what ought to be enumerations handled this way.

It's called "stringly typed"

Bongo Bill
Jan 17, 2012

ROFLburger posted:

Ah yes, the monthly argument over testing.

Let's try and wrap this one up quick because I believe we're due for a debate over whether modern Javascript is Bad or Good.

bad

Bongo Bill
Jan 17, 2012

Lots of things have goto. C# has goto. Java doesn't even have goto (it reserves the keyword but doesn't use it), but they put it in C#.

Bongo Bill
Jan 17, 2012

The interview question is not "Write a good implementation of FizzBuzz."

Bongo Bill
Jan 17, 2012

Does it do what was specified?

Bongo Bill
Jan 17, 2012

It doesn't much matter what a student's first language is as long as it's not their only language. Java has a lot of ceremony that a teacher needs to remind the students to ignore until they're ready for it, however, which makes it a bit harder to start with.

Bongo Bill
Jan 17, 2012

For an introductory course, aimed at teaching the most basic elements of programming literacy (things like what is a variable, what is an expression, what is a subroutine), even a significantly worse language than Javascript could still get the job done (as long as it's not an esolang, I guess). Given that, being able to get code running with as few dependencies (both environmental dependencies and boilerplate code) as possible is a big advantage.

Plus, teaching languages and production languages have very different requirements, which is why you almost never see websites where the rendering is written in Logo, even though it's great. And contrary to some rumors, starting with a bad language, no matter how poor its capabilities, consistency, ergonomics, etc. won't cripple a developer, only change the order that they learn the concepts.

Someday we will be free of the curse of Javascript, but it won't be this year, or next.

Bongo Bill
Jan 17, 2012

Pollyanna posted:

What were pre-N64 games written in? Straight-up assembly?

Mostly, yes.

Bongo Bill
Jan 17, 2012

Some languages have indentation idioms that might break under a proportional font, but in general it's fine.

Bongo Bill
Jan 17, 2012

'Course, in cases like that, I prefer to do something like

code:
someLongFunctionName(
    someLongArgument,
    someOtherLongArgument,
    yetAnotherLongArgument);
but that's not the done thing in some style guides.

Bongo Bill
Jan 17, 2012

Here's the question that leads to further horror: is the ordering's randomness of cryptographic quality?

Bongo Bill
Jan 17, 2012

Doc Hawkins posted:

This code made me laugh.

I can't even copy and paste it, the entities get all messed up.

Racket is a trip.

Adbot
ADBOT LOVES YOU

Bongo Bill
Jan 17, 2012

Go 2 considered harmful

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply