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
zootm
Aug 8, 2006

We used to be better friends.

NotShadowStar posted:

What crazytown language doesn't vomit a stack dump when you get an uncaught exception?
Interestingly if you're using java.util.concurrent you do not get a stack trace if your task dies, you have to check the return value of your Future instance when it completes. This catches people out when they're using them as "a nicer way to spawn threads".

Adbot
ADBOT LOVES YOU

zootm
Aug 8, 2006

We used to be better friends.

NotShadowStar posted:

And of course the dripping pit of Aspergers, Stackoverflow, just rip into him instead of actually guiding him.
My favorite instance of this form of nerd rage was in an IRC channel, where someone continually rked into a beginner's program's time complexity instead if helping the guy with his elementary syntax problem. The internet's supply of self-righteous arseholes is seemingly inexhaustible.

zootm
Aug 8, 2006

We used to be better friends.

NotShadowStar posted:

I'm taking a numeric analysis course this semester, and the second chapter is literally all about floating point errors and bounds checking and how much this is going to gently caress you over and over until you get it right.
As much as it should, I would be impressed if the chapter mentions the x87 weirdness that causes this particular issue. Whoever thought it would be a good idea that your value can change when it moves from a register to memory ought to be shot.

zootm
Aug 8, 2006

We used to be better friends.

Ugg boots posted:

I don't think that the Java problem is the same x87 weirdness as PHP. Their algorithm is different (approximating toward the target from the other direction), and also it seems to work (not work) on 32-bit and 64-bit hardware.
Good point. I think it would be best if I resolved to stick to the natural numbers henceforth, all of this stuff hurts my brain.

Otto Skorzeny posted:

Why do so many libraries and runtimes use the correction loop method to begin with?
I believe they're falsely assuming that the value will always converge, but with some subnormal numbers the result does not. It's common, I think, because it's the "standard" way of doing this (although I could be wrong about that). This blog article from the same guy as wrote about the Java one seems to have a pretty good explanation.

zootm
Aug 8, 2006

We used to be better friends.

Janin posted:


This is apparently a method which can return a varied number (using the Random) or a constant depending on what type of block (allegedly what the class represents) it is. It's sadly not a coding horror.

zootm
Aug 8, 2006

We used to be better friends.

Internet Janitor posted:

zootm: Wouldn't it make more sense to make methods like that take no arguments and access a static Random instance somewhere if they need one?
Maybe. I don't think that it's a terrible horror, though. Avoiding centralised static instances isn't a particularly poor coding pattern, given that even in this case it couples everything that uses a Random together. Having said that passing the Random in to the constructor might have made it easier to deal with, and the static reference would hardly be a sin in a monolithic codebase like Minecraft or 90% of other software.

zootm
Aug 8, 2006

We used to be better friends.

Outlaw Programmer posted:

I think that might be better expressed in a properties file like:
code:
block.grass.numRubble=2
block.grass.sprite=path/to/grass.png

block.snow.numRubble=2+rand(2)
block.snow.sprite=path/to/snow.png
Honestly, I see this sort of argument a lot and it's simply not the case. For example, in this instance have defined a properties file with an arbitrary expression language (there are drop-in ones, of course, but you still need to define your function scope, for example "rand") for a property which never changes at any time other than compile time. Essentially you are suggesting replacing some code with a little custom framework which parses and interprets configuration files, which is pretty much precisely what the compiler already does!

This is the fatal mistake made by frameworks like Spring XML, as well. As awful as Java can be, it is not improved by replacement with XML. These "configuration" files are always deployed along with the application and are never changed at run time. They dictate the wiring and behaviours of code and are rarely anything other than a representation of a shorter Java program. These configuration files are, in other words, code, albeit code with little to no compile-time checking and a more verbose syntax.

Outlaw Programmer posted:

Even without Lua or another scipting framework, externalizing these things can give you a lot of flexibility. This isn't just specific to Minecraft; I've seen it in production business code as well. Java developers are almost infamous for favoring complex type hierarchies when some other options might be simpler and more flexible.
Your argument is not one of flexibility (both approaches are equally flexible), it's one of convenience. Is Lua a "better fit" for describing these sorts of rules? Probably, yes. Java is not an expressive language. Having said that, the types described do not form a "complex type hierarchy", and wiring in a scripting language to describe game rules which do not change is (as has been pointed out) a massive up-front cost.

In any case, the trichotomy between "scripts", "configuration" and "code" is a false one. All three of these items are code describing the behaviour of the game world. The properties file example has literally no advantages over encoding the items in code unless 1) you plan on changing them a lot and 2) you have a lot of examples. The syntax is slightly less cumbersome than Java code, but it has less expressive power (unless you feel like going to town on that expression language you don't need) and introduces a new unnecessary syntax into your project.

The Lua-like-language solution makes sense if one really does not want to encode the game world in Java (wouldn't blame you, although Lua in particular is usually used to avoid scripting game worlds in C or C++, which are considerably more dangerous to fool around with in a world description), but if you're comfortable writing your game world in Java there's no real problem with that here.

zootm
Aug 8, 2006

We used to be better friends.

ToxicFrog posted:

^^ I don't disagree, but where zootm's argument goes off the rails in the assumption that any use of external scripting or configuration falls into this category. The experience of Adobe, Blizzard, Gas Powered Games, Firaxis, and Relic directly contradicts this, and shows that such an architecture has very real benefits.
I'd like to make it clear that I don't advocate against the scripting approach in all cases. There's a huge benefit to describing your world in a language better-suited to that task if your world is complex enough. It's just a fairly large up-front cost to build that integration. Furthermore as I also mentioned system-level languages like C/C++ really are not suited for this task, so said integration makes more sense from the get-go.

In any case, though, I think the scripting approach is sound; I hoped to defend the non-scripting approach in the case where one has a relatively simple world and is already using a high-level (Java jokes go here) language. I didn't intend to malign scripting as a general approach, it's both sensible and proven.

zootm
Aug 8, 2006

We used to be better friends.

Outlaw Programmer posted:

If you've ever played Minecraft, you'll see that most of the blocks (dirt, stone, sand, gravel, snow) are really similar. The differences between them are mostly superficial: their appearance, what tools work best on them, whether or not they are affected by gravity, etc. I feel that each of these behaviors would be better implemented as parameters or properties instead of subclasses.
I don't disagree with that in general but due to Java's general suckiness, passing in a dynamic value like this as a parameter is non-trivial. Unless you want to pass in an implementation of some obscene interface called BlockDispersalCalculator or something, you're stuck. It is a language limitation though, what you suggest is generally sensible.

quote:

Anyway, I would agree that in many cases, I would rather just express this stuff in pure Java code. However, I feel like notch really backed himself into a corner here, maybe because he didn't anticipate how popular Minecraft would become. His inheritance approach probably did speed up his initial development, but now that there is demand for a true mod community, he might be better off with a different approach.
I think that generally you're right, although I don't necessarily think the inheritance is the main problem here. There seems to be plenty of things blocking easy modding and this doesn't strike me as a major one.

zootm
Aug 8, 2006

We used to be better friends.

Ugg boots posted:

Correct me if I'm wrong, but by passing in a dynamic value you don't mean passing in an enum value do you?
I mean a value that can change on subsequent calls (i.e. a value defined by a function, rather than a simple value).

Having said that ninjeff's suggestion (which I would quote if I wasn't on a mobile phone) above makes perfect sense assuming people don't want to screw with the distribution.

zootm
Aug 8, 2006

We used to be better friends.

shrughes posted:

Purely Functional Datastructures is a nice read and has practical uses for nonfunctional programming.
As much as I like this book, it's hard to argue that the effort/reward ratio is a good one for non-academic uses. A workmate of mine has pointed out that if you don't care too much about proofs and don't feel like figuring out which parts are safe to skim it's not necessarily a fun book to read.

zootm
Aug 8, 2006

We used to be better friends.

Janin posted:

HTML5 is a web markup spec, based on XHTML.
Not really true; it borrows elements from both HTML 4 and XHTML 1.0, but is not a direct derivative from XHTML.

Janin posted:

Its native markup language is XML, but it has a special compatibility syntax for parsing basically arbitrary text.
This is a misrepresentation. The HTML syntax (which you keep wrongly referring to as the "compatibility" syntax) is the recommended syntax. The XML syntax is for situations where your document is for whatever reason generated with XML tools (as many templating engines do), or if you want to use XML features (namespaces is the only cited example). Its overly-punitive approach to error handling (especially for insignificant errors) makes it a poor choice for pages where puny humans have had any input into the content.

Janin posted:

This syntax is based on browser's "quirks mode" parsing.
The spec defines "fallback" behaviour for parsing so that invalid documents are still interpreted consistently. This does not prevent documents being marked invalid. This does not make the specification more ambiguous. This does not prevent the HTML syntax from being the "format suggested for most authors".

Janin posted:

Correct parsers represent it as an XML document, *not* an SGML document.
Browsers represent it as an HTML DOM (this version being the HTML5 DOM), which is similar to an XML DOM. This DOM is the authoritative representation of a document, rather than the markup, so that different markup languages can be valid for a given document.

Janin posted:

So, if anything, it's HTML that's dead. The next version of XHTML will be named "HTML5", and will be supported by every modern browser.
The recommended syntax of HTML5 is the HTML syntax. The current version of XHTML is called "XHTML5" and is a lesser-used syntax defined in the HTML5 specification.

Janin posted:

Of course, 99% of the web will continue to be completely invalid and malformed pseudo-markup that not even browsers can parse reliably.
Part of the "point" of HTML5 is that all browsers will now use the same rules for dealing with broken content.

zootm fucked around with this message at 08:44 on Apr 1, 2011

zootm
Aug 8, 2006

We used to be better friends.
He was talking about the bit I linked (which advocates HTML over XHTML most of the time). It's non-normative because it's advice not specification but I'm not getting back into this argument since it's silly.

zootm
Aug 8, 2006

We used to be better friends.

Geekner posted:

The same program threw generic Exceptions from EVERY function, then ignored them in main().
If your desire is to crash when an exception occurs, this is not a terrible way to go about it. Not narrowing the exception type is unprofessional but checked exceptions make people do terrible things.

The actual code you posted is pretty stupid, though.

zootm
Aug 8, 2006

We used to be better friends.

tef posted:

is it wrong to want a version of awk that handles xpath :catdrugs:
There's a few random libraries for doing obscene awk-like things with streams of "anything", including this one: https://github.com/benbernard/RecordStream

zootm
Aug 8, 2006

We used to be better friends.

tef posted:

It also does matrix operations reasonably fast, without having to write more than A * B
The fun thing about Matlab in that respect is that you have to use matrices and lists for almost everything, as the language itself is so slow that your only hope is translating your input so there is some library function that takes you directly to your desired output.

zootm
Aug 8, 2006

We used to be better friends.

ohgodwhat posted:

But what if they try to add three or more of them together??? :v:
Clearly all days should be 0001-01-01, in case someone starts multiplying them.

zootm
Aug 8, 2006

We used to be better friends.

Ithaqua posted:

A friend and former boss of mine once accidentally dropped a production database.
I did this not long after starting my current job. In hindsight having about 12 windows open to devo and 1 open to prod basically amounts to "database roulette."

Happily the site hadn't launched and everything was recalculable.

Adbot
ADBOT LOVES YOU

zootm
Aug 8, 2006

We used to be better friends.

qntm posted:

Some people set up their terminals so that terminals pointing at a production machine have unmissable bright red backgrounds or red text or something.
I actually did exactly that afterwards, though I've since list the config I was using. I'm sure I'm more careful now. I mean, I must be, right?

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