[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Spaghetti code
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 54
Thread images: 8
File: shitposting_grandad.jpg (18 KB, 211x251) Image search: [Google]
shitposting_grandad.jpg
18 KB, 211x251
I fucking love shitprogramming.

- I don't abastain from using jumps.
- I use badly documented behaviours of functions.
- I document my functions poorly.
- My indentation is slightly weird, but not too obviously so.
- I use global variables locally and local variables globally.
- I don't correct other people's bugs, I use them as features.
- The best thing... I do it subtly enough for others not to realize it.

My company NEEDs me to maintain my code; a codemonkey can't replace me.

Ask me anything/post your shitprogramming practices.
>>
File: 1408543490001.png (30 KB, 600x400) Image search: [Google]
1408543490001.png
30 KB, 600x400
>>
>>51844918
I code in Gupta/SQL windows

There is nothing I could do to make it shitter than it already is
>>
>>51844918
aw yiss
>>
lucky I am a competent programmer enough to not need to do that sort of stuff to stay employed.
>>
File: 1449653118098.jpg (508 KB, 4450x2425) Image search: [Google]
1449653118098.jpg
508 KB, 4450x2425
>mfw writing so much javadoc that you can't even see the program anymore
>>
File: 1449526884861s.jpg (5 KB, 217x225) Image search: [Google]
1449526884861s.jpg
5 KB, 217x225
>>51844918
i use winapi in the worst possible way and write highly vulnerable code with dozens of buffer overflows in every single program, I consider it as a fun activity for people to find the overflows.

I make SQLI-vulnerable php code and don't bother fixing it, letting someone upload a shell onto the server is just a fun little puzzle for them, I consider.
>>
>>51846668
>what is collapsing code
>>
>>51844918
>- I use global variables locally and local variables globally.
what ?
>>
>>51846682

9/10 good use of meme
>>
When my tests aren't working properly, I do this
if( test_for_error(with_a_long_list_of_inputs_so_people_don't_realize_I_am_fucking_with_them) & 0 )
>>
>>51846715
some languages doesn't destroy variables and then you can use them even if they run out of scope.
If you run things in the right order, it will work.
Not sure if that is what he means.
>>
>i program like kak so i can act like a little asshole at work and my fucking boss cant wait for me to really screw up or die

Translation
>>
File: 1413104258305.png (334 KB, 1881x915) Image search: [Google]
1413104258305.png
334 KB, 1881x915
Is that you OP ?
>>
>>51846779
shouldn't that result in a segfault ?
or do those languages allocate the memory for those on the heap ?
>>
>>51846816
Do you even program?

You define it with extern and static variable keywords.
>>
>>51846682
Who else /do this/ here?

>Tfw you've made countless sqli-vulnerable websites that no doubt have had some skid upload his shell onto it and put up pictures of dicks all over the homepage

lmao desu
>>
Is returning in a middle of a function shit coding? I've seen it done literally everywhere and in the Linux kernel code but my c/c++ teacher (woman) used to take off lots of points if we did that
>>
>>51844918
Shit programming rules.

The best codes and programming languages have goto statements in them.

IF condition THEN goto label


Makes it a nightmare for anyone who did not program in the 60s. And never use comments of course
>>
>>51846784
Kunjani mfwetu?
>>
>>51846693
I added collapsing tags to sections of my code in a C# project in college and it blew my teammates' minds.
>>
>>51846848
Why are you typing in zulu? I was clearly typing in english
>>
>>51846879
>and it blew my teammates' minds.

>Not blowing your teammates' balls instead

lmao desu
>>
File: oPYvSdr.jpg (382 KB, 2000x1243) Image search: [Google]
oPYvSdr.jpg
382 KB, 2000x1243
>>51846895
no, you do that to the professors
>>
>>51846845
No, she is a dumb bitch.
>>
>>51846830
extern isn't a local variable but a global one and neither is a static variable
>>
>>51846845
if you're done with the function, what else would you do?
>>
>>51846847
goto is still commonly used for clean up in case of an error.

>>51846845
no, often used then some precondition is not satisfied.
>>
>>51846813
fuck, that is beautiful, it's like someone tried to write java like assembly.... I have a friend kind of like that, I wonder if I can dig up any of his code
>>
>>51846813
I have an internal struggle with variable names, trying to find the perfect balance of concise, unique, and descriptive.
>t is too short
>tempVarToHoldSomeFuckingThingWow is too enterprise
>temp seems like a good idea now
>temp is no longer descriptive enough after adding all this other shit
just fucking kill me
>>
>>51844918
>I do it subtly enough for others not to realize it.
Then how would your boss know not to fire you?
>>
>>51847197
He is probably some code monkey who thinks he is more than that
>>
>>51846887
He is saying:
"How's it brother."
"kak" is typically South African slang, although in my experience more heard in the poor afrikaans/coloured communities. I'm pretty sure mfwetu is misspelled(mfwethu), but then it's not a language I'm very familiar with.
If I were to guess, he is not an actual speaker of the language but thinks it's cool to say things like that and has now, save a few insults, exhausted his repertoire.
>>
>>51847441
Yes i know i know kak only because of a certain music group but people keep assuming because i use it now and then i am fluent in all 11 sa languages for some reason
>>
>>51847138
The wider the scope, the more descriptive the variable name needs to be, for example:
In a for loop "i" is fine, most people understand that it means "iterator" and will change value each time the loop executes, it's scope is confined to the for loop, which shouldn't have many lines anyway and so ,unless it's doing something unusual, does not need a very descriptive name. Calling a variable which is accessed numerous times in convoluted code "wc" is horrible. "wordCount" is not much more to type and anyone reading the code knows what the variable is for and from the scope can guess which words have been counted without digging through the code. "wordCountForFunctionXInClassY" is dumb. Somebody reading the code should know which class they are rooting around in, and roughly what to expect the variable to be doing, the name doesn't need to say what happens to the variable when certain functions are called.
>>
>>51847138
tempHolder
Replace Holder with 1 descriptive name. is it really that hard?

examples:
tempName
tempWindow
tempResult
>>
File: 1448478229550.jpg (43 KB, 402x480) Image search: [Google]
1448478229550.jpg
43 KB, 402x480
>>51844918
I do the same, OP.
>>
Does anyone else find the proper use of goto extremely beautiful?

There are specific use cases for goto in error handling in C that are rare in simple code but become much more common in larger projects. When I find myself writing goto's in every function feel like I'm running across priceless programming gems.

>>51847866
I would use "nwords" instead.
>>
>>51846816
one word: php

I fucking love it.
Declaring some value inside a function as global and then using it outside of it.
>>
>>51847997
There is literally nothing wrong with using goto for error handling in C
>>
>>51847138
tmp
>>
File: suckmydijkstra.jpg (175 KB, 1200x1600) Image search: [Google]
suckmydijkstra.jpg
175 KB, 1200x1600
>>51848241
>this triggers me
>>
>>51844918
That's job security right there OP!
>>
>>51848274
Program more then faggit, its whiny fags like you that lead to the demonization of goto. >>51848241
The dude is right goto makes error handling in C simpler and overall better.
I'd rather not go through 20 hoola hoops for errors just to avoid using a lang command, because..reasons? Or mark said so?
Can it lead to hell? Yes but there are easier ways both in C's features and that of other langs.
Codled dicks, they read in a manual that its bad and now yell it to the world or saw atrocious legacy code and say its proof. newsflash people all(ok most) legacy code is atrocious, there weren't things like coding standards back then. +Everyone was an utter idiot trying things for shits and giggles.

Also OP while horrible for your coworkers it works swimmingly for you so keep it up!
>>
>>51847122

DO IT!!1!
>>
>>51844918
I use
eval-when
and do black magic with dynamic scoping on common lisp

I win
>>
>>51847138
Its already a bad variable name if you call it temp-anything in any form. Think of a better name.
>>
>>51847138
All the responses to this are why it's hard to come up with a good name, nobody agrees on anything.
>>
>>51847866
The vast majority of time you don't need an iterator
>>
>>51844918
How do you use other people's bugs as features w/o getting caught? Give us an example. You mean like catching exceptions from buggy method calls to detect certain types of input?
>>
I think this thread warrants a link to https://thc.org/root/phun/unmaintain.html
>>
>>51849729
>https://thc.org/root/phun/unmaintain.html
THAT WAS MUSIC TO MY EYES
>>
>>51844918
If you want to be honest, just say that you don't have the mental capacity to write a good design and are covering it up for some clever forced employment gig.
>>
>>51850179
I make ART at programming. Baroque programming.
I don't expect you to understand.
Thread replies: 54
Thread images: 8

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.