|
never asked "bunch of times".
Here's the IDE (https://twitter.com/JagexAsh/status/856549607135948800):
Ruby's not good, its aids and cancer mixed into one catastrophic mess.
Nothing bad about that. Enumerations didn't get put into SE until version 5.
ID's can be still common practice for definitions today. C# literally binds an int to a key, there's no concept of an object.
"Unique values with unexplained meaning or multiple occurrences which could (preferably) be replaced with named constants"
https://en.wikipedia.org/wiki/Magic_..._(programming)
Yes they are.
Named constants pretty much enum's without proper encapsulation. I do agree that named constants are a better choice but I still disagree that hard coded values are a bad option here considering it wasnt too long ago from that date that people were still using assembly for full application development.
no, they're not. you wouldn't refer to the ID of a database row as a magic number... it's an identifier.
the nature of magic numbers is that you don't know what they represent without digging into the code to see what their behaviour effects. identifers aren't magic, they're inherently tied to a data structure, and thus there is no "magic" aspect with regards to their behaviour/responsibility...
i know...Named constants pretty much enum's without proper encapsulation.
this makes no sense, you agree that they were better and they've been around far before RS was a thing, but yet you think they're not a bad option?I do agree that named constants are a better choice but I still disagree that hard coded values are a bad option
that's not a valid argument at all. there's always going to be crazy stuff being done, that doesn't justify ignoring the fact that these design patterns have been around far longer than RS.considering it wasnt too long ago from that date that people were still using assembly for full application development.
rollercoaster tycoon was written in x86 assembly in 1999, but books that discuss design patterns like the gang of four's book with the same name were published 5 years earlier. both of these came before runescript was a thing.
I mean u can't get any worse than arbitrary numbers in the middle of your code so how can it not be a bad option? there's no inferior alternative
If assembly was used for an entire application then it was 50 years ago, before alternative/useful programming languages were mainstream; once C became well-known very few people wrote entire applications in asm anymore, with the typical practice to write the hot spot in asm if necessary. Even rollercoaster tycoon, the game scu linked (and is well known for being completely insane for the amount of asm in it) is partially C.
That aside, whether or not people used to use a supposedly worse option is completely irrelevant to whether or not something is bad. It's pretty obvious that magic numbers are confusing and make code less readable, and pretty obvious that giving them names is a lot better
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |