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
rotor
Jun 11, 2001

classic case of pineapple derangement syndrome
When I used to work in the build department, I inherited some real doozies. The build scripts were giant shell scripts running under MKSTools. Probably half of the code we compiled was generated by a process I won't pretend I even came close to understanding. There was a lot of necessary complexity because we built for a shitload of different platforms, but one thing really stuck out.

The guy who wrote the bulk of the build scripts really wanted inheritance in his shell scripts. In order to accomplish this, the script searched through the 'parent' shell script for a particular line (not some kind of obvious comment delimiter like "#---THIS IS A DELIMITER---", just another line of a shell script), then took that line and the next 50 or however many, and piped it to a file. He then sourced that file, deleted it, then called functions that the now-deleted file had. It must have taken me a week to figure that poo poo out. And he did it in like four places.

Adbot
ADBOT LOVES YOU

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

Drx Capio posted:

:psyduck:

It blows my mind that anybody that would know how to do that would actually do it.

yep. to my way of thinkin', there are times when code duplication is just fine, considering the alternatives.

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

ashgromnies posted:

So basically he wanted subroutines? I'm not an expert bash scripter(I just use it for automating things I do all the time) but from what I understand, couldn't he just write out separate shell files containing the code block he glommed and just call those? Or does using source give the functions access to lexical variables?

That's actually really, really genius in a way.

He wanted inheritance so he wouldn't have to duplicate code. I would imagine he could have separated out the stuff he wanted to share and sourced it from both files, but he was clearly much better at shell scripting than I am, so maybe there's some subtlety I'm missing.

And yeah, it was pretty ingenious. But so much wasted time could have been saved with a few simple goddamn comments giving me some kind of idea that he was doing this very tricksy thing.

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

nebby posted:

My god. I haven't been in here in weeks, and the first thread I open you guys are still making fun of me... I'm.. speechless.

When it comes to mocking inane bullshit, we've got pretty long attention spans.

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

Z-Bo posted:

I think you are completely missing why your blog posts were so epic and are seared into our brains: You were mentored by Charles Simonyi, and yet completely misrepresent his position on intentional programming.
its seared into my brain because it was so immensely beef-brained. I think the stupidest part was where nebby proclaimed that hungarian was great becaus it was essentially a DSL for every project, as though that was a good thing .

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

nebby posted:

This isn't a revolutionary idea:

No, but it's still a bad one. We went over and over this in the last thread. If you have a good point, you're not getting it across very well. The fact that someone told you that your blog post was an eloquent expression of Simonyi's ideas tells me all I need to know about Simonyi's ideas.

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome
I think I've spent more time reading nebby posts about hungarian than I've spent, total over the 12 years I've been a programmer, being confused by variable names.

Nebby, do you have any kind of studies that show this to be any kind of significant problem at all? Honestly, the entire argument reeks of brace-style, tabs-vs-spaces nonsense, except everyone seems to be taking it seriously, which baffles me.

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

nebby posted:

No, how could I? The whole thing has been largely ignored and discarded by the programming community, who would study it?

I dunno. Given the number of grad students in the world, I find it hard to believe that there's been zero studies done.

quote:

Honestly, it's not a huge issue to me these days, I just am often amazed at the reaction I get when it comes up and the logical fallacies otherwise smart people start throwing out there
If you have a bunch of 'otherwise smart people' who routinely tell you you're crazy whenever you bring this up, you should probably take a step back and consider whether:

(a) you are not communicating your ideas well enough, because all these otherwise smart people are just not getting it or

(b) you are in fact crazy

That's just honest feedback, man. Do with it what you will.

quote:

I mean, think about it. Many people in this forum think I'm some crazy person, a troll, a kook, a crackpot, throw personal insults and so on because of a variable naming convention I promote when I write computer programs.
Well, it's a software forum. We kind of take software seriously here. I don't really care what you're like as a human being, but so far all your opinions on writing software I've seen are ... well, they're crazy. As for the personal insults, I dunno man, welcome to SA I guess.

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

tef posted:

If we're going into unicode territory how about something like ∀ x ∈ l : print x; perhaps?

We're gonna need bigger keyboards.

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

tef posted:

This do?



look at the hosed-up brace and arrow key placement, I can't use that piece of poo poo.

rotor fucked around with this message at 18:30 on Mar 31, 2008

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

the talent deficit posted:

code:
var e208e29dbee8c7f3994a32f56e0be770=document.createElement('form');

jesus christ what the hell

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

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.

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

Victor posted:

I reserve r for Regex instances.

hey whoa when did we get a 'fixed' tag? :krad:

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

Triple Tech posted:

Code that makes me cry is code without an audit history/trail.

I dunno man, I'd start buying kleenex in bulk if I were you.

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome
the worst thing about endianness for me is that an old coworker insisted on calling it byte sex every opportunity he got, which drove me up the wall.

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

_aaron posted:

No space before the comma? Clearly this person doesn't know how to properly use white space.

they should be using tabs, not spaces. :colbert:

code:
if  (    x    >    0    )    {
    x    +=   y    ;
}
see how tidy that looks? everything lines up in nice columns. Clearly, this is the superior way to write code.

edit: GAH, just turned avatars back on. When did I get that one?

rotor fucked around with this message at 23:44 on Apr 12, 2008

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

fret logic posted:

Before now I was on the fence about going and talking to the department head since previous lectures hinted that my professor actually isn't half bad. Well, not after today. I'm going to have nightmares about this I think:
[...]

I don't understand how this is supposed to be especially awful for what is, I assume, supposed to be an in-class example or something.

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

Zombywuf posted:

for loops, have you heard of them?

-funrolloops

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

Zombywuf posted:

/me shudders with horror at the thought that GUI coding should be taught before for loops.

I actually agree with narsby. If I was teaching Swing to students, I'd probably keep loops out of the picture as well in a little example like this. I'd be a little :raise: if I saw it in production code, but the new JFrame("Chris Busch's CALCULATOR!!!!!!!!"); probably would be a bigger issue.

edit: Ah, JingleBells in #cobol caught something: he should be using variables for the label names instead of magic values. Nothing happens when you press the '.' button.

doubleedit: oh

rotor fucked around with this message at 19:41 on Apr 14, 2008

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome
a for-while loop, neat. That and a do-switch and I'll be all set.

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

Flobbster posted:

I'm surprised nobody has mentioned this advantage yet. If I remember my Win32 API correctly, there's a window style called WS_EX_THICKFRAME. But it doesn't let me control the degree of thickness.

code:
DWORD exStyle = WS_EX_THICKFRAME; // thick
DWORD exStyle = WS_EX_THICKFRAME | WS_EX_THICKFRAME; // DAMMIT IT'S NOT THICKER
How restrictive! But if we redefined the styles to use prime numbers, imagine the thickability:

code:
DWORD exStyle = (DWORD) pow(WS_EX_THICKFRAME, 10);
Now THAT'S a thick-rear end window frame that will draw the attention that my awesome application deserves. I mean, come on.

this thread just took a sharp right heading straight down Hilarious St.

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

JoeNotCharles posted:

Jesus, what is it with you and your fetish for bitmaps?

seriously man. You guys should use vector graphics instead, otherwise you lose a lot of flag resolution at higher word lengths.



Fib posted:

the difference would be that we'd be allowed to have a "post hot programmer chicks and the most CoCeddest images u got" thread.

the man always keeping po programmer folk down :mad:

edit:

rotor fucked around with this message at 22:39 on Apr 25, 2008

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome
also:

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome
I am very, very sorry


(for posting this scandalous pic of tripletech, lol)

rotor fucked around with this message at 05:20 on Apr 26, 2008

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

yah i'd booze it up pretty hard if I had to write lisp all day too.

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

Scaevolus posted:

I bet he means an APL keyboard.

Additional characters:

\ _ ¨ ¯ × ÷ ← ↑ → ↓ ∆ ∇ ∘ ∣ ∧ ∨
∩ ∪ ∼ ≠ ≤ ≥ ≬ ⊂ ⊃ ⌈ ⌊ ⊤ ⊥ ⋆ ⌶ ⌷
⌸ ⌹ ⌺ ⌻ ⌼ ⌽ ⌾ ⌿ ⍀ ⍁ ⍂ ⍃ ⍄ ⍅ ⍆ ⍇
⍈ ⍉ ⍊ ⍋ ⍌ ⍍ ⍎ ⍏ ⍐ ⍑ ⍒ ⍓ ⍔ ⍕ ⍖ ⍗
⍘ ⍙ ⍚ ⍛ ⍜ ⍝ ⍞ ⍟ ⍠ ⍡ ⍢ ⍣ ⍤ ⍥ ⍦ ⍧
⍨ ⍩ ⍪ ⍫ ⍬ ⍭ ⍮ ⍯ ⍰ ⍱ ⍲ ⍳ ⍴ ⍵ ⍶ ⍷
⍸ ⍹ ⍺ ⎕ ○

Let's stick to ASCII.

No way. I want intersection/union glyphs. I've been typing .contains and .concat for 12 goddamn years like some kind of loving caveman. It's 2008, let's start acting like it people. :mad:

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome
Programming competitions should be viewed as nerd social events and really not much else, for exactly the reasons outlined here.

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

ryanmfw posted:

Minus the social part, yeah. I didn't go to them to meet people. It was a lot more fun crushing their hopes and dreams....

Demented and sad, but social.

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome
n&1 is a little weird, but I don't see what makes it a coding horror!!

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome
for the record, (n&1) is about twice as fast as (n%2) in javascript

modulus: 2237

bittwiddle: 1498

code:
<html>
<head>
<script>
function init(){
	var iterations = 10000000;
	var start = new Date();
	for(var i = 0 ; i < iterations ; ++i){
		var foo = i % 2;
	}
	var elapsed = new Date();
	document.write("modulus: "+(elapsed.getTime() - start.getTime()));
	document.write("<p>");
	start = new Date();
	for(var i = 0 ; i < iterations ; ++i){
		var foo = i & 1;
	}
	elapsed = new Date();
	document.write("bittwiddle: "+(elapsed.getTime() - start.getTime()));
}
</script>
</head>
<body onload="init()">
				butt
</body>				
</html>
I know we were talking about this in a C context, but meh

rotor fucked around with this message at 01:35 on Jan 6, 2009

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

rjmccall posted:

Good lord, it had better be a lot faster than that. n%2 is a floating-point operation in JavaScript.

iunno man, run the benchmark urself

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

rjmccall posted:

Folly of microbenchmarks, I think. Your benchmark time is probably dominated by loop and general interpretation overhead. What did you run it in?

build a better one then. Ran it in FF3 and IE6. IE has this thing where it yells at you if the script blocks too long, so those results are suspect.

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

rjmccall posted:

Right. So let's say operation A takes 1ms to do a million iterations in 1ms, and operation B takes 100ms to do a million iterations, and loop overhead costs you 100ms. So the benchmark takes 101ms for A and 200ms for B; voilà, a 100x difference turns into in a 2x difference. And trust me that that sort of loop overhead is not unreasonable in naive interpreters.

There are tons of articles out there about how silly this sort of microbenchmarking is, but you should at least subtract out the empty-loop overhead.

it's the exact same loop, but like I said feel free to make a better one. I'm sorry, but simply saying "It must be X, regardless of what the benchmarks may say" is a little too close to faith-based computing for my tastes.

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

rjmccall posted:

The reason I asked about the browser you were using was just curiosity (also you should always mention the host platform/configuration when reporting benchmark results); Firefox's JS implementation leapt forward in 3.1.

I posted the source, run it your drat self on whatever platform you like and check the results, jeez

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

rjmccall posted:

That's not what I'm saying at all. I'm saying your benchmark is crap and doesn't say anything useful, so we should ignore it.
which is why i said 'post a better one,' I'm sorry that I didn't feel it was necessary to note that the benchmark I posted was perhaps nonauthoritative, I sort of figured people would understand that. The only thing I was really trying to discover was whether one was significantly faster than the other, and by around how much.

quote:

Firefox 3.0.5: 600ms empty, 1150ms modulus, 800ms twiddle, i.e. 550ms modulus, 200ms twiddle.

2x, 3x, meh. Seems like it's in the same ballpark to me.

Good to see the other engine results tho.

rotor fucked around with this message at 07:24 on Jan 6, 2009

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

ih8ualot posted:

Why are we doing performance evaluations on an interpreted language?

yeah man it's javascript who cares about performance right? the only time programmers should care about performance is when they're programming games and real-time systems.

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

ih8ualot posted:

I just meant that in terms of determining instruction efficiency, results from a compiled and optimized language might prove to be a better metric. But I could be wrong.


did you miss the part where there's no difference between the two in C and a big difference in javascript?

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

geetee posted:

rotor: I just wanted to say that I missed you while you were gone. :h:

I missed u too. protip: never go on vacation with small children, it sucks.

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

Victor posted:

I was just visiting this insults page

I'm really upset that I don't have a section there :mad:

Adbot
ADBOT LOVES YOU

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

how!! posted:

I call it How!!'s rule of software complexity: As software complexity increases, bugs and features become indistinguishable.

i found this thread from the lepers colony. this is probably the funniest thing i've read all day. THINGS ARE HARD. YOU CANT JUST NOT BREAK THINGS. NO ONE KNOWS ANYTHING.

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