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.
 
  • Locked thread
sick zip everywhere
Jul 21, 2010

chumpchous posted:

i'm not really a programmer but unfortunately, i do a lot of programming. most of the programming i do would have been better off getting outsourced to india.

i can't really post in serious programming threads because i'll basically jsut get made fun of, which is fine, but usually i'll get made fun of and my question won't get answered. so here is a :siren:SAFE SPACE:siren: for bad programmers to hang out and try to get better at stuff.


i'll start this off with a question about preventing code from getting executed asynchronously. when does code get executed asynchronously? i always kinda figured that most code gets executed in a line, but it seems like when i call other functions, or espescially when i call some shell command, it won't actually block the thread and i'll end up with things happening at the same time when they really shouldn't be. i think they call this a race condition??

any pro tips?

generally i put some sleep()s in there so the other threads can catch up. asynchronous programming isnt that bad when you get used to it

Adbot
ADBOT LOVES YOU

uG
Apr 23, 2003

by Ralp
terrible thread sniper safe zone/hideout

JG_Plissken
Oct 22, 2005

I went to a four year college and all I got was this stupid look on my face!
Common Knowledge in Asynchronous Systems

• Reaching consensus over φ requires common knowledge of φ
• There does not exist any protocol for two processes to reach common knowledge about a binary value in an asynchronous message-passing system with unreliable communication, or one with reliable communication without an upper bound on message transmission time.
• However, reaching consensus is possible on some weaker forms of common knowledge, e.g., concurrent common knowledge.

Mr SuperAwesome
Apr 6, 2011

im from the bad post police, and i'm afraid i have bad news
sleep sort is a cool algorithm

FamDav
Mar 29, 2008

horse mans posted:

you don't have it because there's no way to diagnose it

dont you only have impostor syndrome if youre actually good at something

X-BUM-RAIDER-X
May 7, 2008
i am really a poo poo programmer but I talk a good game, where should I send my resume? see you at work on monday.

X-BUM-RAIDER-X
May 7, 2008
for real tho some of my unit tests need sleeps because I'm programming in perl and some of the modules I have to use don't have callbacks so fuckin welp

graph
Nov 22, 2006

aaag peanuts

Pissflaps posted:

10 print "gas and ban install opera"
20 goto 10

hi pissflaps :)

X-BUM-RAIDER-X
May 7, 2008
singletons are bad and so are boolean arguments. both of these things should cause a programmer to be struck off the computer janitor register.

buttcoin smuggler
Jun 25, 2011
someone get how!! in here

a nest of hornets
Nov 17, 2012

by Ralp
[17:37] <+buttebot> picnic in my butt

X-BUM-RAIDER-X
May 7, 2008

buttcoin smuggler posted:

someone get how!! in here

I'd rather hire someone who took the time to get it right, document it, unit test, and abstract it into nicely aesthetic code. What's the point of writing code if other people can't understand it? I have a lot of experience with companies who hire like this, and I usually end up proposing that it would be less time consuming and more fun if we just started the entire codebase again from scratch than spend weeks trying to figure it out. I end up leaving those companies out of frustration.

Mr SuperAwesome
Apr 6, 2011

im from the bad post police, and i'm afraid i have bad news

OBAMA BIN LinkedIn posted:

I'd rather hire someone who took the time to get it right, document it, unit test, and abstract it into nicely aesthetic code. What's the point of writing code if other people can't understand it? I have a lot of experience with companies who hire like this, and I usually end up proposing that it would be less time consuming and more fun if we just started the entire codebase again from scratch than spend weeks trying to figure it out. I end up leaving those companies out of frustration.

hard work is hard, more up at 11

X-BUM-RAIDER-X
May 7, 2008
Algorithm questions are like a football minefield. Imagine if there was a football field that contained seven mines underneath innocent looking patches of grass. Every innocent piece of grass is left wondering why no one wants to walk over them.

Moist von Lipwig
Oct 28, 2006

by FactsAreUseless
Tortured By Flan
rewriting code is so much easier than trying to figure out what the gently caress someone else was doing the first time like 80% of the time


...drupal :smithicide:

X-BUM-RAIDER-X
May 7, 2008
how!! made me laugh with his analogies which were somehow!! more confusing than whatever it was he was trying to say.

Nomnom Cookie
Aug 30, 2009



no one else where i work knows or cares about unit testing or testing of any kind. the c-level execs double as qa.

~startup lyfe~

w/e i give up on explaining the problems with singletons and why SOLID is good. write some code check it in go home, if devel breaks ill look at it tomorrow

X-BUM-RAIDER-X
May 7, 2008
lol if u don't do TDD

double sulk
Jul 2, 2010

unit testing is annoying, tdd is dumb, "agile" is dumb, stories are dumb, ruby is dumb, over-abstraction is a nightmare, obsession with oop/functional paradigms in everything is dumb, and programming is terrible.

i lust for death

X-BUM-RAIDER-X
May 7, 2008
TDD is dumb until you end up turning in a project which had relatively little hiccups. then ur like hmm, that's p.good actually.

BooLoo
Oct 18, 2010

SLAM TIME

Oldsmobile posted:

There's actually a syndrome where people who are in technical or demanding jobs think they've gotten to where they're at by decieving thheir co-workers and employers. Most of the sufferers are minorities or women.

i totally feel this but it's tempered by the fact that i really can't program

X-BUM-RAIDER-X
May 7, 2008

gucci void main posted:

unit testing is annoying, tdd is dumb, "agile" is dumb, stories are dumb, ruby is dumb, over-abstraction is a nightmare, obsession with oop/functional paradigms in everything is dumb, and programming is terrible.

i lust for death

hi sulk how is work in ur programming job

double sulk
Jul 2, 2010

OBAMA BIN LinkedIn posted:

hi sulk how is work in ur programming job

poo poo

Mr SuperAwesome
Apr 6, 2011

im from the bad post police, and i'm afraid i have bad news

Moist von Lipwig posted:

rewriting code is so much easier than trying to figure out what the gently caress someone else was doing the first time like 80% of the time


...drupal :smithicide:
.net reflector is cool because you can disassemble real code that people sell and you realise the people writing it were fuckin nuts

Hellsworn Barn
Apr 11, 2008

hi

horse mans posted:

op here's som code i wrote for you hth

code:
var action = Act.Upon(programmer)
                .If(p => p.needs.Contains("safe space"))
                .Gas()
                .Permaban()
                .Kill();

i refactored your horrible code

Hellsworn Barn
Apr 11, 2008

hi

Mr SuperAwesome posted:

.net reflector is cool because you can disassemble real code that people sell and you realise the people writing it were fuckin nuts

try diving into the framework code...

Nomnom Cookie
Aug 30, 2009



OBAMA BIN LinkedIn posted:

TDD is dumb until you end up turning in a project which had relatively little hiccups. then ur like hmm, that's p.good actually.

and then everyone at work is like how do i use ur code??????? well idk dumbass did u look at the wiki pages or the javadoc or the functional tests. why fuckin bother

double sulk
Jul 2, 2010

Nomnom Cookie posted:

and then everyone at work is like how do i use ur code??????? well idk dumbass did u look at the wiki pages or the javadoc or the functional tests. why fuckin bother

saying to read the specs to see how the code works is the worst argument, made only worse when non-native english speakers are writing some of your code

Posting Principle
Dec 10, 2011

by Ralp
i remember my first job was writing corba stuff in c++ for atc computers, i was a bad programmer then and i'm a bad programmer now

does anyone actually use corba 3.x or does 2.3 just continue to shuffle forward bc of institutional inertia

Bloody
Mar 3, 2013

OBAMA BIN LinkedIn posted:

singletons are bad and so are boolean arguments. both of these things should cause a programmer to be struck off the computer janitor register.

whats wrong with singletons please don't blackball me

carry on then
Jul 10, 2010

by VideoGames

(and can't post for 10 years!)

welcoem to code

code:
Write a program that prints the numbers from 1 to 100. But for multiples 
of three print "Fizz" instead of the number and for the multiples of 
five print "Buzz". For numbers which are multiples of both three and 
five print "FizzBuzz".

public static virtual protected volatile void fizzbuzz() {
    /*TODO: implement this*/
    take_a_big_dump();
    how do i set my name :/
    Right side, bro does it show uP/
    im the one that wrote penus lol
    int num = 1;
    ggggggggggggggggggggg; //Syntax error for some reason?
    // what is all this bullshit in my fizzbuzz thing
}

print("PENUS")
print("PENUS")
print("PENUS")
print("PENUS")
print("PENUS")
print("PENUS")
print("PENUS")
print("PENUS")
print("PENUS")
print("PENUS") pretty sure you're writing this wrong. yeah it should be printf



while True:
    print("poops")

const bool is_dumb = true; // Never change this
// WHAT THE gently caress GUYS
// nvm


PYTHON:
[not i%15and"fizzbuzz" or not i%5and"buzz" or not i%3and"fizz" or i for i in range(1,100)] 

# Why doesn't this work????
int x = $GET("size");
let foo = malloc(x);
if (sizeof(foo) > INT_MAX)
    raise Error("you exceeded INT_MAX!!! dumbass") /*burn*/
    
/*TODO: work in a "Util" into this class title somehow*/    
JAVA:
class FizzBuzzFactoryFactoryManagerGeneratorHelper {
};

# The best script
while True:
    print random.choose(["Millions", "Hundreds", "Thousands"]) + \
          " of "+random.choose(["hard", "throbbing", "glistening"]) + \
          " " + random.choose(["cocks", "boners", "dicks", "pricks"]) + \
          " slapping you gently in the "+random.choose(["mouth", "face", "lips", "rear end"]) + "."

# The bester script

while True:
    print "{0} of {1} {2} slapping you gently in the {3}".format(
        random.choice(["Millions", "Hundreds", "Thousands"]), 
        random.choice(["hard", "throbbing", "glistening"]),
        random.choice(["cocks", "boners", "dicks", "pricks"]), 
        random.choice(["mouth", "face", "lips", "rear end"]))
    
/* needs a generic PenisFactoryFactory */

class PenisFactoryFactory:
    def __init__(self):
        self.dongfact = PenisFactory()
    def ReturnDongs(self):
        return self.dongfact
http://forums.somethingawful.com/showthread.php?threadid=2803713&userid=0&perpage=40&pagenumber=238#post396895799

Hellsworn Barn
Apr 11, 2008

hi

Bloody posted:

whats wrong with singletons please don't blackball me

static data

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Moist von Lipwig posted:

op whats your workflow like

my workflow is that i am the only person who does any programming at my company, and since no one else looks at it, it doesn't matter how poorly it's programmed as long as it doesn't wipe anyones hard drive.

i've actually managed to create a fairly complicated content management system that does a bunch of media transcoding/web streaming. my company things it is the greatest thing since sliced bread. but i know when i leave this place, some poor idiot is going to have to take over and they are going to curse my name forever.

also everything is driven by time. i would really like to take the time to l earn to be good at programming and write my programs properly, but i only get a day here and there to work on something, because most of my job is not programming. so i just get it done as fast as i can because otherwise it wont get done

DONT THREAD ON ME fucked around with this message at 01:15 on May 8, 2013

Kudaros
Jun 23, 2006
I'm a scientist who writes programs for very specific purposes and sometimes general purposes.

Always bad though.

Police Academy III
Nov 4, 2011
I've a sneaking suspicion that there's only a very low number of people who are in any way decent at programming, but they've realized that there's no way for them to transmit that knowledge to the rest of us and so are content to let us keep running around like retards and making grand, overly generalized proclamations about programming on hacker news.

A Sloth
Aug 4, 2010
EVERY TIME I POST I AM REQUIRED TO DISCLOSE THAT I AM A SHITHEAD.

ASK ME MY EXPERT OPINION ON GENDER BASED INSULTS & "ENGLISH ETHNIC GROUPS".


:banme:
I used to know a bit of HTML but then I forgot it

buttcoin smuggler
Jun 25, 2011

A Sloth posted:

I used to know a bit of HTML but then I forgot it

I checked out a book on HTML from my school library in 3rd grade


i never made a website

Silver Alicorn
Mar 30, 2008

𝓪 𝓻𝓮𝓭 𝓹𝓪𝓷𝓭𝓪 𝓲𝓼 𝓪 𝓬𝓾𝓻𝓲𝓸𝓾𝓼 𝓼𝓸𝓻𝓽 𝓸𝓯 𝓬𝓻𝓮𝓪𝓽𝓾𝓻𝓮

Police Academy III posted:

I've a sneaking suspicion that there's only a very low number of people who are in any way decent at programming, but they've realized that there's no way for them to transmit that knowledge to the rest of us and so are content to let us keep running around like retards and making grand, overly generalized proclamations about programming on hacker news.

half right

programming was easy for them to figure out so they assume it'll be easy for everyone, RTFM again or maybe you're just a moron who has no business programming

JG_Plissken
Oct 22, 2005

I went to a four year college and all I got was this stupid look on my face!

whats wrong with static data please don't blackball me

Adbot
ADBOT LOVES YOU

Silver Alicorn
Mar 30, 2008

𝓪 𝓻𝓮𝓭 𝓹𝓪𝓷𝓭𝓪 𝓲𝓼 𝓪 𝓬𝓾𝓻𝓲𝓸𝓾𝓼 𝓼𝓸𝓻𝓽 𝓸𝓯 𝓬𝓻𝓮𝓪𝓽𝓾𝓻𝓮
I think maybe the community has gotten better, I haven't really paid attention since I stopped following slashdot

the problem with programming education is there's so much stuff that's non-obvious and counter-intuitive and it doesn't make "sense' until you've been browbeaten with it enough that you pretend it does, and at that point you still have no idea how to explain it to anyone else

best example I can think of is pointers. what is a pointer? a variable that points to another variable. this is a circular definition but it's what's in the books.

pointers didn't make sense to me until I started playing with assembly. need to store a string of text, or other multi-word data somewhere? put it somewhere in memory and then write that memory address down somewhere. now you can look up what's at that address and change the data, or you can change the address too maybe. it's like a reference of a memory address that points... at your data. a pointer. C-like languages make this more confusing because it can be hard to tell when you need to "dereference" a pointer or just pass the pointer as-is. You can think of a pointer as a variable that stores an address but you need to have some fairly precise understanding of what variables even are to understand why pointers are useful in the first place and it's just generally not taught

  • Locked thread