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
Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice
i've been writing code professionally for about 12 years with about 10 years of coding for fun/school before that

finally a thread for me

Adbot
ADBOT LOVES YOU

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice
i'm a terrible coder but everyone i work with is worse (i don't work at google or apple btw)

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice
i have two guys on my team that aren't programmers but who program things

had to teach one of them about source control today, like really basic stuff like "no you don't have to check one file in at a time"

getting to old for this poo poo sick of being a team lead

next job i'm just gonna pretend i'm autistic so they stop putting me in charge of people

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice
the best part of being a coder is going back and looking at old code and being like "what the hell is this poo poo this is terrible" then checking the repo history and seeing it was u

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice
i started out writing reports, it was actually useful to my career because the one thing programmers are consistently terrible at is database design and writing sql queries for a year really teaches you about it if you apply yourself correctly

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice

uG posted:

by using an ORM and/or SQL abstraction to skip the whole learning sql poo poo :getin:

i, unlike the esteemed mr. shaggar, do not immediately discount orms but they're only really good for crud stuff and won't help you with performance bottlenecks, indexing strategies, proper 3nf table design, etc

i've used orms but i don't believe code-first works very well at all

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice

Tori CMOS posted:

shaggar is right

the one I'm most familkiar with (Cognos) just converts everything to really lovely bad sql anyway

my favorite one so far started "SELECT ((((((("

tbf (i hear) cognos is the worst of the worst but yeah i've seen some pretty hilarious queries from nhibernate

and then you get the bright idea to start loving around with hql and it ends with an ankle bracelet, house arrest, and 300 hours of community service

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice

Martytoof posted:

how do i make a webpage with it

with a form and ecommerce and a sweet flash intro

petition to revoke "safe zone" status from the thread

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice

Martytoof posted:

ok so how do i ecommerce with it

oh no if it's ecormmerce i think u gotta use lisp here is a link to a webzone to help you out:

http://paulgraham.com/

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice
this thread is seriously inspiring me to be a less poo poo coder, i went from awful terrible retarded shitfuck coder to awful terrible retarded coder and i really want to get up to awful terrible coder before i retire :unsmith:

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice
qbasic

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice
why is there nothing like notepad++ for osx?

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice

OBAMA BIN LinkedIn posted:

i'm currently editing code which has the worst loving brace style i've ever seen. the person puts his code 2 spaces before the opening brace, so it looks like:
code:
  if()
  {
what();
  }
except for every if and loop.............................

kick his rear end, sea bass!

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice
barf and poop keytar

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice
queef and menstruate moog synthesizer

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice

prefect posted:

resharper says to do "var whatever" instead of "SomeConvolutedClassNameHere whatever". (http://resharper.blogspot.com/2008/03/varification-using-implicitly-typed.html) but when you do that, the autocomplete says "gently caress you, i'm not going to try to figure that poo poo out" :saddowns:

i kinda like var when the type name is ridiculously long but i turned that rule off in resharper so it would stop suggesting it

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice

prefect posted:

although i fixed the indenting so it does proper k&r style

*slaps u with rolled up newspaper*

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice
yo here's a thing if you want to learn vim and graduate to a better level of coding

http://vim-adventures.com/

don't forget to buy a license

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice
b-b-but gamification!!!!!!

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice
does vimtutor have achievements yet?

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice

prefect posted:

yeah, i'm doing a section that's name-value pairs, but it now looks like i'll need a second section where it's a list of patterns that i have to match the computer name against :barf:

i still think in terms of perl, so i want everything to be a hash with nice key lookups :argh:

is this some sort of deployment thing where you do different settings for different servers? if so look into slowcheetah. if this is client side stuff, lol sorry have fun :tipshat:

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice

Shaggar posted:

vs2012 has slowcheetah built in for the default config files (app.config, web.config,etc...)

oh yeah? cool. maybe i'll upgrade this year, after i get a new machine. 2010 is bad enough on this pos laptop.

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice

Shaggar posted:

I need to get an ssd cause this spinny drive sucks, but vs2012 is still decently fast.

i have a core2duo 2.4 GHz w/ 4 gigs of ram running win7 (32 bit lol)

the disk is 7200 rpm too i don't get why it's so bad/slow

everything just chugs but outlook and vs2010 are the worst

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice

prefect posted:

how do i map a network drive with c#? :saddowns:

(i'm having a tough time finding what i need in the dot-net class library reference)

shaggar, i apologize for arguing with you all the time

there's no straight up native .net way to do it iirc

easiest way to do it and avoid the windows api is do a process.start to invoke "net.exe use \\server\path\goes\here\"

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice
lol if you try to get fulfillment at work

it's a job, just do it, go home, and then do whatever really makes you happy or makes you feel accomplished

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice

Tiny Bug Child posted:

sounds like your job sucks, the only thing here that applies to me is "watching porn at work"

you got it worse than me. i got bored with coding for fun because of coding for work, at least watching porn is still fun for me

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice

Tiny Bug Child posted:

sorry about your misogyny

i only watch organic vegan bespoke artisinal porn :colbert:

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice

prefect posted:

but my program actually works! :woop:

(people tell me i shouldn't be so surprised when things work)

gently caress those people, this is when programming is still super fun :unsmith:

plenty of time to be jaded about coding in the future

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice
um no wtf don't use exceptions for normal control flow, test for potential conditions that will cause exceptions and handle them in advance whenever possible

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice
exceptions are a form of non-local goto and should only be used when you have a condition where halting your program and handling it is the only alternative to crashing

they are expensive as gently caress to throw in a lot of languages too

caveat: i'm a .net programmer primarily, i understand python does weird poo poo like using exceptions for control-flow

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice
less terrible coders than me talk about it here:

http://c2.com/cgi/wiki?DontUseExceptionsForFlowControl

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice

PleasingFungus posted:

it's entirely possible for one section of code to be unable to handle an error condition (e.g. "missing file"), which a higher-level section of code can handle & recover from

this is in fact a canonical use of exceptions

and my point was that you probably don't want to fire a breakpoint every time that happens

the higher order code should check for the file in advance and handle it then if its something that will happen often (ie normal code flow)

exceptions are reserved for unexpected error conditions

If it doesn't happen often then it won't hurt to have break on exception turned on and it will help you realize you have a problem if it starts happening suddenly even if your code is robust and recovers

ur wrong on this sorry

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice
if exceptions are indeed used for normal control flow in python the name for them sucks sorry to have to go all shaggar on y'all :shobon:

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice

PleasingFungus posted:

tbqh I don't really understand how you can reconcile


with the idea of "catching exceptions".

where exactly do you use exceptions? when do you catch them, if you're only supposed to use exceptions for situations you don't expect? I'm honestly really curious here.

you use them for catching and handling exceptions that are a possibility but do your best to ensure they are never caught in the first place by guarding for them wherever possible

if it is a common scenario in your application that files may not be present or may not validate in some manner, you should be testing for that in the normal flow of your program and dealing with it within the normal flow of your program because it is expected. if that means more thorough testing in each function and passing poo poo back up the stack, so be it.

if it is an uncommon scenario in your application that files may not be present, then by all means use an exception, but treat it like the catastrophic event that it is. catch it and deal with it (eg stop program flow, log the error, have it send an expletive filled sms to your webserver cj's wife)

in c# a good example is using int.TryParse vs int.Parse - you use TryParse when you expect conversion to fail and you use Parse when you never expect it to fail and if it does you want an exception generated.

now, to be fair, i am arguing from authority (essentially, everyone knows non-local goto is bad and should be avoided :smug:). i'm not going to get into all the reasons why non-locally scoped gotos are a bad idea, but if you want to argue that you like being able to shortcut your way up the stack in a non-obvious way when something you expect to happen 5% of the time happens and you don't mind incurring the performance hit for doing so, not to mention making your code less obvious in it's expected operation, have at it but i pity anyone that works on your code base 5 years from now.

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice
heyyyyy look at me i'm arguing on the internet about programming on friday night :smithicide:

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice

PleasingFungus posted:

hm. I guess the question is something like this:

you have a function. when called, it's unable to return a meaningful result. (a function that's supposed to read from a file doesn't find a file; a function that's supposed to parse formatted data is passed garbage.) what should the function do?

in my philosophy, the function should throw an exception, and that exception should pass upwards until it reaches a function that's capable of dealing with it. ("C" in my earlier example.) I don't think this is particularly controversial, tbqh.

your argument seems to be that exceptions should be used as more verbose quit() calls with nicer error-logging functionality, and only as that. in your scenario, our functions would return error codes instead of actual data in these cases, and every upstream caller would have to pass that on until they reached a function that could deal with the error. that's literally what exceptions were invented to get away from, because it turns control flow into a hideous nightmare, and you don't have any actual argument for returning to it (besides "authority"), so... I guess I'm not convinced!

you're avoiding my main point and a few of my side points.

main point:

if it's something that frequently or commonly happens that your program is expected to deal with and continue, you are dealing with control flow and should not rely on exceptions because they are an expensive non-obvious shortcut up the call stack. for example, if you're dealing with a resource in A that will frequently be unavailable and you need to notify C, it should be documented in the interface for A and B as a return/out value. yes this is more work.

if it's something that rarely happens, it's an exception and you should pass it up the stack, log it, probably halt the process or program depending on the exception type, etc.

side points:
- generating exceptions is an expensive operation. it's wasteful because you're rolling up the call stack and consuming excessive memory and processing power when a simple bool might be more than enough.
- you're hiding functionality. in your example, C knows that A might fail but since B doesn't know, if someone else consumes B they might not be prepared for the fact you're using a non-obvious method of controlling program flow, at least as far as the language is concerned (contrast this with an out parameter in a method signature). i guess checked exceptions might help with this, i'm not a java guy so i don't know much about them. and yeah, maybe python does it differently but like i said, they should at least call it something else then. semantics matter and words have meaning.
- you might accidentally swallow other exceptions (i didn't mention this before but it is a possibility, unless you start generating custom exceptions purely to handle control flow which is more work anyway so you probably wouldn't do that)

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice

cliffy posted:

code:

try {
	for (int i = 0; /*wot no test?*/ ; i++)
		array[i]++;
} catch (ArrayIndexOutOfBoundsException e) {}

if anyone ever does this fire them immediately full stop

apparently this is basically how python iteration works if what i read is true

shaggar was right!?

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice

PleasingFungus posted:

I think this argument has turned into "exceptions are fine to use for a lot of thing in Python!" "no they're terrible to use except for really rare cases in C#!" "no they're fine in Python!" "no they're terrible in C#!"

*high pitched voice* python coders code like thiiisssssss and *low pitched voice* c# coders code like thiiisssssss

Cold on a Cob fucked around with this message at 12:56 on May 18, 2013

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice
i had to edit that because all the black developers i know use c# and all the python coders i know are skinny white dudes with high pitched nasally voices

Adbot
ADBOT LOVES YOU

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice
i comment non obvious stuff (why not what)

  • Locked thread