|
nebby posted:Ha ha. It's obviously even more advanced than Hungarian, it's the elusive md5(rand()) notation. I like this scheme, it has the following advantages: Unique names without collisions, and it sorts the naming problem once and for all. By avoiding programmer input you can avoid a lot of arguments and debate. And of course with editor support you could link these 64 bit numbers to unicode characters to make them stand out visually. Although you aren't encoding the type information - you avoid an english language bias. This means that it is an even playing field for people in multi-lingual environments. You could probably have a large lookup table for each one per project, and once you start using these 64-bit numbers it will come naturally.
|
# ? Apr 2, 2008 08:56 |
|
|
# ? Mar 29, 2024 10:02 |
|
pokeyman posted:(Did I miss anything?) Return value seems to be undefined if string has length zero.
|
# ? Apr 2, 2008 09:01 |
|
code:
|
# ? Apr 2, 2008 11:15 |
|
tef posted:You could probably have a large lookup table for each one per project, and once you start using these 64-bit numbers it will come naturally. How about an IDE plugin that automatically translates them into something that's appealing to the reader? That way everyone can have their own crazy naming scheme without conflicts!
|
# ? Apr 2, 2008 11:17 |
|
MrMoo posted:Return value seems to be undefined if string has length zero. It won't simply return the empty string?
|
# ? Apr 2, 2008 11:23 |
|
pokeyman posted:It won't simply return the empty string? If it were C that would be a problem, I guess from your comment strings are by default valid and empty. So presumably count would default to 0 too, so no need to set it, however I saw this too: Delphi Basics posted:Strings are indexed with 1 for the first character (arrays start with 0 for the first element). MrMoo fucked around with this message at 11:50 on Apr 2, 2008 |
# ? Apr 2, 2008 11:47 |
|
dwazegek posted:
Seems rather obvious that the finally was actually supposed to be catch { Logging.TraceError(...); throw; }. Which is still stupid but a tiny bit more logical. Edit: Aha! I bet I know how it happened! The author first wrote this: code:
EssOEss fucked around with this message at 12:45 on Apr 2, 2008 |
# ? Apr 2, 2008 12:41 |
|
nebby posted:His input variable is named "str" and his aggregating one is named "newstring", if I try to put myself in his position, he probably said to himself, "ok, I'll name the input variable string and the output variable newstring. That makes sense. Oh, god drat it, I can't name a variable string because its one of those special colored in words. I guess I'll just call it str." Surely he did this after having the same mental exercise happen that resulted in Uppercase -> Upercase. function Upercase(streng : string) : string; This notation would've been far more consistent.
|
# ? Apr 2, 2008 16:32 |
|
Clearly the input should be s and the output should be ret.
|
# ? Apr 2, 2008 16:34 |
|
Yes it should.
|
# ? Apr 2, 2008 16:54 |
|
nebby posted:I mean, clearly this is generated code it's either generated or obfuscated. Either way, it's -really- poorly done. If it's generated, there is no reason to rely on guids for variable names - you gotta track 'em anyway, might as well give 'em decent names - especially where it bloats your code like it does in javascript. If it's obfuscated, why didn't it obfuscate the function names? My money is on a supershitty homemade code generator.
|
# ? Apr 2, 2008 17:43 |
|
Victor posted:Clearly the input should be s and the output should be ret. Why not just r?
|
# ? Apr 2, 2008 17:47 |
|
I reserve r for Regex instances.
|
# ? Apr 2, 2008 18:33 |
|
Victor posted:I reserve r for Regex instances. hey whoa when did we get a 'fixed' tag?
|
# ? Apr 2, 2008 20:35 |
|
rotor posted:hey whoa when did we get a 'fixed' tag? http://forums.somethingawful.com/showthread.php?threadid=2809983
|
# ? Apr 2, 2008 20:46 |
|
rotor posted:jesus christ what the hell Considering that it's a 128 bit number, I'm guessing he tried obfuscating things by just going through and doing a find-replace with the MD5 of all of the variable names, possibly flipping the occasional bit to make everything a valid identifier.
|
# ? Apr 2, 2008 20:52 |
|
I just found this little ripper in some code that, uh, I might of written many years ago. From memory I might not of been entirely sound of mind at the time....code:
A true hate crime against boolean logic. edit: (in_array($_REQUEST['context'],array(80)) lol duck monster fucked around with this message at 00:33 on Apr 3, 2008 |
# ? Apr 3, 2008 00:28 |
|
bitreaper posted:First day on my new job, confronted with this: Holy poo poo I laughed hard.
|
# ? Apr 3, 2008 01:59 |
|
Victor posted:I reserve r for Regex instances. Boo! I use re for regex. It's far less common than returning a value, so it can get the extra letter.
|
# ? Apr 3, 2008 03:48 |
|
So that javascript monstrosity I posted? It gets better. The variable names are generated each time you load the page. That's right, they change. I'm also now in contact with the author of the 'framework' and some of the things he's said lead me to believe this is for security. To, y'know, protect the integrity of the form. Check out some of these other quotes:quote:...the REDACTED environment; which is hundreds of times faster than XML and totally secure quote:I can provide all the services of a web 2.0 environment with a great deal more efficiency quote:...applications are deployed on two different sites. The ‘Static’ pages as I call them... quote:Internet explorer’s bugs make it some pages fall apart at the larger sizes but they promise to have those fixed in version 8 which is supposed to be out this fall... quote:I have objections to large slow loading graphics. They waste unnecessary processing time and band width and slow down all the applications running on the server. Also, and this is my favorite, he's using phpincludes as the storage backend.
|
# ? Apr 3, 2008 03:58 |
|
the talent deficit posted:So that javascript monstrosity I posted? It gets better. The variable names are generated each time you load the page. That's right, they change. I'm also now in contact with the author of the 'framework' and some of the things he's said lead me to believe this is for security. To, y'know, protect the integrity of the form. Check out some of these other quotes: Now that's comedy right there. I assume the redacted environment has nothing to do with XML being just a data format.
|
# ? Apr 3, 2008 05:27 |
|
biznatchio posted:Now that's comedy right there. The REDACTED is just the name of his framework. He keeps making bizaare comparisons. Like his framework is more secure than Apache. Except he's running it on Apache...
|
# ? Apr 3, 2008 08:28 |
|
Inside Intel's ipp mpeg2 decoder... nothing wrong with a 40+ line macro to do motion. (to add more fun they put ##stuff)code:
mracer fucked around with this message at 13:55 on Apr 3, 2008 |
# ? Apr 3, 2008 13:53 |
|
I love meth too.
|
# ? Apr 3, 2008 14:27 |
|
the talent deficit posted:So that javascript monstrosity I posted? It gets better. The variable names are generated each time you load the page. That's right, they change. I'm also now in contact with the author of the 'framework' and some of the things he's said lead me to believe this is for security. To, y'know, protect the integrity of the form. Check out some of these other quotes: Warning, pissy rant ahead! I never cease to be amazed at how people so ignorant can think themselves to be so loving smart. Also, the older I get, the more I want to physically assault programmers who inflict "cute", "awesome", "ingenious" or "brilliant" solutions like these - that are used by no other major framework/application - without considering the hurdles in maintenance, debugging, and overall (OVERALL) security. If you're coming up with cute JavaScript shenanigans at the coffee shop - don't loving integrate them into production systems that other people will have to deal with. The fantabulous thing about the Interwebs is you do have an opportunity to write new code, to do something nobody's ever done before. But jesus tittyfucking christ, do these things on your own time, blog about them, propose them as additions to open source projects that can benefit from them. If they're good they'll take off! Don't just slam them into any code that people rely on!
|
# ? Apr 3, 2008 15:20 |
|
Saw this today:code:
code:
|
# ? Apr 3, 2008 15:33 |
|
Victor posted:Clearly, return is a function. A little side story -- I've seen someone do this before when he was first learning to program and when I told him that he didn't need the parenthesis because return is not a function, he said that he was using the parenthesis not because he thought it was a function but because he wasn't sure of the order of operations. For instance, he thought return 1 + 3; might return the value 1 and then the rest of the expression was evaluated "after the return" and therefore not affecting the return value (in other words he thought return 1 + 3 could potentially behave something like (return 1) + 3 where "return 1" returned the value 1 and had a value in the encapsulating expression of 1). I was kind of puzzled for a second, but I was actually sort of impressed when I heard his rationale since it showed both that he questioned the effect of a type of return statement he had never seen before, as up until then he probably had only seen 1 term return statements, and he also realized that by using parenthesis there he could more safely assume the result that he wanted. He is now actually a very good programmer! Of course, that was someone who had only just started programming a week before, so he had an excuse to not know the behavior, and if I saw any experienced programmer doing it I'd definitely be a little bit more baffled (though honestly who really cares, some extra parenthesis never hurt anyone).
|
# ? Apr 3, 2008 15:48 |
|
Surge Strip posted:Our intern programmer makes me laugh some days. For example, he future proofed all his code, just in case the definition for a newline ever changes on Windows: When you consider that pascals unparallelled strongpoint is set mathematics, that example is even looper than you'd imagine. You can write a flawless uppercase function in a 4 lines of code, including the "function" "begin" and the "end" lines.
|
# ? Apr 3, 2008 16:13 |
|
That Turkey Story posted:(in other words he thought return 1 + 3 could potentially behave something like (return 1) + 3 where "return 1" returned the value 1 and had a value in the encapsulating expression of 1) In Haskell, this is broadly how the order of operations actually works, because return is actually a value-lifting monad constructor function and function application has higher precedence than any infix operator.
|
# ? Apr 3, 2008 16:49 |
|
Victor posted:Clearly, return is a function.
|
# ? Apr 3, 2008 17:20 |
|
Lexical Unit posted:Sometimes I'll do this like if I'm returning a the boolean value of an expression or using ?: or something, just to bring attention to it. So like return (foo ? "foo" : "not foo"); or return (a && (b || c));. I don't know, it also looks somehow cleaner to my mind. VV
|
# ? Apr 3, 2008 17:40 |
|
Nada, I agree there.
|
# ? Apr 3, 2008 18:11 |
|
But maybe after the program pops off the stack and returns to the other function it'll get bored or something and come back to it and evaluate the rest of the statement!!!
|
# ? Apr 3, 2008 18:26 |
|
That Turkey Story posted:A little side story -- I've seen someone do this before when he was first learning to program and when I told him that he didn't need the parenthesis because return is not a function, he said that he was using the parenthesis not because he thought it was a function but because he wasn't sure of the order of operations. For instance, he thought return 1 + 3; might return the value 1 and then the rest of the expression was evaluated "after the return" and therefore not affecting the return value (in other words he thought return 1 + 3 could potentially behave something like (return 1) + 3 where "return 1" returned the value 1 and had a value in the encapsulating expression of 1). I was kind of puzzled for a second, but I was actually sort of impressed when I heard his rationale since it showed both that he questioned the effect of a type of return statement he had never seen before, as up until then he probably had only seen 1 term return statements, and he also realized that by using parenthesis there he could more safely assume the result that he wanted. He is now actually a very good programmer! I sometimes put the return expression in parenthesis simply because I find it more readable. Is that really a coding horror?
|
# ? Apr 3, 2008 19:45 |
|
ShoulderDaemon posted:In Haskell, this is broadly how the order of operations actually works, because return is actually a value-lifting monad constructor function and function application has higher precedence than any infix operator. Working on proprietary legacy software has made me code with such paranoia about the compiler loving up now that I'm not sure if I can ever be as fast as I used to be.
|
# ? Apr 3, 2008 20:06 |
|
chocojosh posted:I sometimes put the return expression in parenthesis simply because I find it more readable. Is that really a coding horror?
|
# ? Apr 3, 2008 20:22 |
|
zootm posted:Like (return 1 + 2); or return (1 + 2);? I think in C-like languages I'd regard the former as something of a coding horror simply because it's so unusual that I wouldn't even know if it worked. Really strange. The latter. Note that I don't think I've ever done return (retVal); but I will do things like return (x + 10); or return (x > 0)
|
# ? Apr 3, 2008 20:25 |
|
There is at least one C-inspired language that requires that return is used like a function with parentheses and all, as far as I can tell it is mostly because the compiler guy could not be bothered to specialcase return's syntax.
|
# ? Apr 3, 2008 20:55 |
|
chocojosh posted:The latter. Note that I don't think I've ever done return (retVal); but I will do things like return (x + 10); or return (x > 0)
|
# ? Apr 3, 2008 22:02 |
|
|
# ? Mar 29, 2024 10:02 |
|
TRex EaterofCars posted:Boo! That Turkey Story posted:he said that he was using the parenthesis not because he thought it was a function but because he wasn't sure of the order of operations. quote:(though honestly who really cares, some extra parenthesis never hurt anyone).
|
# ? Apr 3, 2008 23:18 |