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

>pajeet won't stop making global variables

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 75
Thread images: 8

File: 20177.jpg (42KB, 404x404px) Image search: [Google]
20177.jpg
42KB, 404x404px
>pajeet won't stop making global variables
>>
File: le shepheard faec.jpg (36KB, 600x722px) Image search: [Google]
le shepheard faec.jpg
36KB, 600x722px
>pajeet keeps adding business logic to the gui classes
>>
>>60809796

if it works its not stupid.
>>
>>60809796
i love global variables i name them intelligently like names
x
y
i
>>
>>60809796

>crippling yourself on purpose
Literally why? globals and public everything are great
>>
File: awf.png (514KB, 755x560px) Image search: [Google]
awf.png
514KB, 755x560px
>>60809796
>the new guy replaces all global variables with singletons
>>
>using languages where variables actually vary
>>
>>60810032

>functional autists
>>
>>60810032
>being unemployed
>>
>have a student assigned to me
>review his code
>all variables are global
>why are you doing this?
>my professor at university told me to make variables as global as possible to avoid constant allocation of memory
It was a terrible day.
>>
>>60810051
>>60810075
>OOP POO in LOO pajeets
>>
>>60810091
Care to explain why that's bad if works?
>>
>>60810134
this, you're only being a dogmatic piece of shit if you hate working code because it doesn't follow your autistic guidelines
>>
>>60810125

just make all your objects immutable if you hate mutable state so much
>>
>>60810160
Yeah, I do try to keep as few mutable objects as reasonably possible. I still prefer to use languages where I can be sure that if a == b, then a actually equals b and it won't ever change.
>>
>>60810230

seems inefficient and wasteful to me, there's always the right tool for the right job imo
>>
Friendly reminder that map/filter/split/join was created to deal with immutable data types.
Instead of modifying arrays, you're forced to create hundreds of thousands of duplicates just to change one array member at a time because you're not allowed to modify it's contents after initialization.
>>
>>60810283
That's why I said 'as reasonably possible'. It just makes reasoning about the program easier if there is less stuff changing around. And among all the OO languages I tried only C# appeals a little to me so I try to avoid anything else.
>>
>>60810125
>tfw master of Principles of Object Oriented Programming (POOP)
>>
>tfw I'm white and got a business programming degree
Should I just start shitting in the streets now?
>>
>>60810125
Spotted the NEET

Do mommy and daddy know you haven't accomplished shit?
>>
>>60810155
This so much.

It reminds me of those whiny hipster cunts that scream "GOTO IS EVIL!" on their shit blogs and in Uni lectures.
Absolute dumb cunts, all of them.

Goto has its proper uses and abuses, like literally every single feature in any language.
I've seen Loops abused so much harder than I've seen Goto abused.
I've seen people use silent ERRORS to escape huge chains of loops instead of using Goto. FUCK. OFF.
Then weird combinations of try-catch that makes the code look a million times worse than any supposed spaghettification of code caused by Goto. Holy fuck pls stop.
>>
Isn't the whole point of keeping variables private so that you can easily share your project with other people and not fuck shit up all the time?
>>
>>60810443
>muh ENTERPRISE giant software requirements

fuck off rajeesh
>>
>>60810414
throwing exceptions is perfectly fine to get out of a loop
>>
>>60810414
>read javascript book
>there's a section on all the evil parts
>it's every C-like feature in the language
>ternaries, for loops, while loops, increment, etc.

>read C++ book
>there's a section on all the evil parts
>it's literally every C backwards compatibility construct
>there's a whole 3 page spread dedicated to goto
>NEVER USE GOTO
>NEVER USE GETS
>HERE'S A SCREENSHOT OF THAT HEARTBLEED CODE MUH SAFETY
>>
>>60810414
I have seen one guy write
for(int i = 0; i++; i < 10){
if(i == 10){
break;
}
//do stuff
}

I was so pissed.
>>
>>60810517
>muh safety
are you being ironic
>>
>>60810328
Friendly reminder that compiler is there to optimize that for you, because when your functions are actually equal to some expressions (without side effects), it's much easier to analyze it. You can also prove that your programs fulfill specification much easier.
>>
>>60810535
Agree. If the braces content is one line, you don't need braces.
for(int i = 0; i++; i < 10){
if(i == 10) break;
//do stuff
}
>>
>>60810564
That and failing to write a for loop...
for(int i = 0; i < 10; ++i){
//do stuff
}
>>
>>60810414
Exceptions are just as bad as goto.
>>
>>60810653
>have to write ~60 extra lines of code to add safety checks for an update checker
>wrap the update check function call in a try catch block
>application is stable in 3 lines of code
Wew.
>MUH PERFORMANCE
Like it fucking matters on a function that runs once every 10 seconds.
>>
>>60809922
Modularity?
>>
>>60809922
this is why templeos is the future
>>
>>60810690
I mean that they're often used in a very wrong way. The exceptions itself are supposed to represent, well, exceptional events that are independent of our program (like I/O). They should not, however, be used for unrecoverable errors (like empty list exception).

Also, functional approach with wrapper type (Maybe/Either) looks much cleaner.
>>
>>60810987

This. It's also why complaining about exceptions performing like shit is stupid.
>>
>bitching about goto, exceptions

All flow control structures are a goto. Goto is the closest you'll get in C to designing your own flow control. Not understanding that just means you're a dumb cunt

Exceptions are just a switch statement that matches the exception's type rather than it's value. There's nothing wrong with them
>>
>>60811667
b-b-but the AutoIt developer said it was evil!
How can you argue with a language maintainer?!

https://www.autoitscript.com/forum/topic/1302-goto-command/
>>
>>60809796
>implying it's bad to use global variables altogether
Say I wanted to have gravity. Would I use a private constant? Thought not.
>>
File: ,.png (168KB, 727x682px) Image search: [Google]
,.png
168KB, 727x682px
>>60809890
less characters need less space, so that's a plus
>>
>>60811667
>All flow control structures are a goto.
No, flow control structures are conditional gotos. C doesn't have conditional gotos.
>>
File: 02f.jpg (49KB, 655x527px) Image search: [Google]
02f.jpg
49KB, 655x527px
>>60811667
But in most cases you just should not use goto, because it can cause lots of trouble and the compiler will optimize any loops anyways.
There might be some reall rare cases where goto is perfectly fine, but those are the exception.

Also
goto fail;
goto fail;
>>
>>60812267

That's not the fault of goto, that's the fault of retards not using curly braces
>>
>>60812266
>what is IF
>being THIS stupid

>>60812267
Yeah and not recognizing the cases where it is a good choice is the mark of the parroting pajeet
>>
>>60809796
Pajeet is used to write C, they don't know what namespaces mean
>>
>>60813968
Aren't pajeets used to Java?
>>
File: 1496375114500.png (106KB, 1907x1420px) Image search: [Google]
1496375114500.png
106KB, 1907x1420px
>>60815179
>>
>>60810134
greatly increases the chance of variable data accidentally getting overwritten for one thing
>>
>>60809844
>if it's unmaintainable it isn't stupid

hello pajeet
>>
>>60809922
t. CS degree holder
>>
>>60816681
kek now I see, pajeets have this sense of self awareness
>>
>>60810134
optimization as well as legibility
>>
help local
>>
>>60816718
>giving a shit about maintainability
sounds like you don't actually write code for a living
>>
File: 71QPRkK.jpg (64KB, 640x512px) Image search: [Google]
71QPRkK.jpg
64KB, 640x512px
Why is there so much stupid in this thread?
>>
>>60816962
you must work for some bumfuck literally who company if you don't care about maintainability
>>
>>60817010
shit gets refactored all the time anyways
unless you're doing some FORTRAN shit
>>
B-but static global variables are comfy as hell, and more memory efficient than adding a parameter to all of your stupid parser functions.
>>
>>60817796
>always-allocated variable
>more memory-efficient than stack-allocated variable

Are you dum?
>>
>sandeep won't stop shitting in the smoking area
*sigh*
>>
>>60810535
Idgi. Is the problem that he forgot the else?
>>
>>60810403
They poo in /dpt/ that OOP is bad, it's a fad there to criticise common things, it makes them feel special.
>>
>ITT: People who have never worked with a codebase larger than 10,000 lines.

Holy shit I didn't know /g/ was this stupid
>>
>>60809796

>Pajeet doesn't like the way certain functions and classes are named
>Recreates those classes but with different names, then modifies the original class to read from his original class

And my favorite

>Pajeet takes his name off of the group comment credits
>Adds his own credit before it
>>
>>60810493

This is the stupidest comment in the history of 4chan, perhaps ever
>>
>>60810535
>implying poo in loo pajeets are patrician enough to put the opening brace on the same line
>>
Tabs > Spaces
>>
File: 1496746758911.png (12KB, 487x480px) Image search: [Google]
1496746758911.png
12KB, 487x480px
>be a 3rd year CS student
>have a B- GPA
>thought I was stupid af
>become a tutor for some 200-level CS class
>there's this girl in my class that struggling
>she is in the lab everyday
>turns out she pass all her previous CS course by memorization
holy Moses
>>
>>60819861

>Not dicking her before she inevitably changes majors
>Not offering to tutor her for free if she lends you her stockings
>>
>>60810535
>not
int i;
for (i = 0; i >= 0; i++) {
if (i == 10) goto endLoop;
//do stuff XD
}
endLoop:
//no more loop :P
>>
>>60810579
This is wrong

>>60810535
I fixed it
#include <stdio.h>

int main() {
int i;
for (i=0; ++i; i<10) {
if (i == 10) break;
printf("%d\n", i);
}
return 0;
}

./a.out
1
2
3
4
5
6
7
8
9
>>
>>60819884
>all second year female CS students are either dykes or BBW
meh, I'll pass. Unless if you really want to bruh
>>
>>60819915
>>60819919
Typical examples of non OOP C code from /dpt/ Arch users.
>>
>>60812266
>if (anon == faggot) goto Pence;
Thread posts: 75
Thread images: 8


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

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
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.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.