[–]▶ No.866127>>866133 >>866143 >>866154 >>866162 >>866403 >>866674 >>867092 [Watch Thread][Show All Posts]
>code uses "m_" for member variables
>code uses tabs instead of spaces
▶ No.866133>>866139 >>866152
>>866127 (OP)
>repository is a huge code base with 1000s of commits made by one guy
>rest of the contributions are tiny by only a few people
▶ No.866139
>>866133
that‘s just the 80/20 rule in effect
▶ No.866143>>866147 >>866300 >>866525 >>866536 >>866703 >>866773 >>867787
>>866127 (OP)
Space users should be shot and killed. Tabs for indents, space for alignment. Anything else is absolute cancer and fucks the shit out of formatting and isn't well-handled by most editors.
▶ No.866147>>866148 >>866703
>>866143
>lets mix spaces and tabs
▶ No.866148>>866253
>>866147
You are a danger to programmers everywhere and need to be terminated for the greater good.
▶ No.866149>>866151
> Very few but giant file in a language with a module system instead of many smaller files
It's like there are programmers with autism super powers who know exactly what it connected to what.
> Barely any comments
More programmer austism
> No HACKING file
For fuck's sake, I'm not asking for a complete thesis, but give me some pointers.
> Put everything in the README
Installation, changelog, bugs, contributors, license... let's just throw it all in there. And let's not write a table of contents.
▶ No.866151
>>866149
You have severe autism. Get yourself checked. Caution: your brain may also be hard to find.
▶ No.866152>>866155
>>866133
What's wrong with that?
▶ No.866154>>866704
>>866127 (OP)
>Uses Java, Golang, or another language for subhmans
▶ No.866155>>866156
>>866152
It's a good indicator that the only one who knows what the fuck is going on with the code is the guy who single handedly programmed the thing. Thus making it hard for newcomers to contribute anything non trivial.
▶ No.866156>>866159 >>866311
>>866155
Literally 99% of all projects on github are like this.
>1 guy wrote basically all the code
>2000 people contributed logo changes
▶ No.866159>>866166
>>866156
Sure, because most repos are hobby projects. I was mainly talking about big projects that are actually being used.
▶ No.866162>>866165 >>866170 >>866181 >>866544 >>867954
>>866127 (OP)
Underscores bother me no matter where they're used. It's not not a convenient key to press.
▶ No.866165
>>866162
They're quite comfy on Azerty keyboards.
▶ No.866166
>>866159
>I was mainly talking about big projects that are actually being used.
Like what?
▶ No.866170>>866175 >>866177
>>866162
>underscores
The fuck babby language are you using that underscores are a noticeable inconvenience over every other single symbol.
▶ No.866175>>866201
>>866170
It's a matter of keyboard, not language, /g/.
▶ No.866177
>>866170
It's not a language feature, it's part of that retarded pseudo "hungarian" notation where faggots name all of their variables with the variable type attached to the front and put underscores in there because the original way was retarded and nobody could read that shit. The language doesn't need jack shit, people CHOOSE to use underscores.
▶ No.866181>>866182 >>866185 >>866186 >>866198 >>866201
>>866162
foo_bar_foobar_baz
fooBarFoobarBaz
Which is more readable?
▶ No.866182>>866186
>>866181
First one no questions asked.
▶ No.866185
▶ No.866186
>>866181
>>866182
You should pick the second because it's more difficult for non-English speakers to read.
▶ No.866189>>866195 >>866200 >>866250 >>867907 >>867945
Seeing my own horrible code :'(
▶ No.866192
▶ No.866198
>>866181
I find them equally readable. In fact second one slightly more readable at a distance. Moreover the underscores version is longer onscreen.
▶ No.866200
>>866189
You should have done something like mood = moods[imax(*moodP)] instead tbh fam, where moods is an array of moods.Whatever in the same order as moodP which is an array of mooP's.
▶ No.866201>>866203
>>866175
You can choose a different keyboard layout any time you want.
>>866181
FOo-BaR-FoOBaR-BaZ
▶ No.866203>>866204 >>866306
>>866201
What language accepts dashes in variable names?
▶ No.866204
▶ No.866250
>>866189
Shit nigger my only coding knowledge comes from a one-week crash course in Python and I could still do better than that.
▶ No.866253>>866259 >>866536
>>866148
No, *YOU* are the fucking retard here. I hope you die of cancer. I can't tell how many projects I tried to open in my editor to hack on, only for the code to look like an absolute mess because the original programmer used a different tabwidth than I did. Use fucking spaces, you mongoloid.
▶ No.866259>>866263
>>866253
You are still the retard using two or four times as many key presses as necessary and just throwing automatic alignment out of the window just so you can use your shitty rice easier.
▶ No.866263>>866277
>>866259
>what is expandtab tabstop=X shiftwidth=X
Stop acting retarded on purpose. You know that tab expanding exists.
▶ No.866277>>866298 >>866334
>>866263
Doesn't work when working with other people's code. Can't even automatically change the display to suit your preferences without affecting the source, meaning you have to manually reconvert before committing or create ad-hoc hooks to do it for you. But you don't care about these since you're a professional solo fizzbuzz programmer, and will never work with anyone else in your life.
▶ No.866298>>866536
>>866277
solo neet devs = tabs
professional team devs = spaces
▶ No.866306
>>866203
Chosen Language. Why so anti-american?!
▶ No.866311>>866316 >>866342
>>866156
It's more like:
>1 guy wrote basically all the code
>2000 people contributed logo changes by making comments gender neutral
▶ No.866316
>>866311
neutral? I thought we always should refer to users as "she" or "her"? It seems to be the fad.
▶ No.866334>>866340
>>866277
here's a suggestion
why don't you write your own program that reads source you want to hack, if it finds a tab, replace them with the amount of spaces that you demand everyone else use.
▶ No.866340>>866350
>>866334
Don't be silly, all spacefags know how to do is add comments.
▶ No.866342
>>866311
It's an allegory for post-scarcity society.
▶ No.866360>>866404 >>866411
>no unit tests
>singletons
▶ No.866403>>866543
>>866127 (OP)
>uses mongodb with 9 shards, XMPP, CloudFlare, AWS, Apache^WNGINGX, and websockets because they supposedely provide "synergistic effects" to the enterprise product, which has nothing to even do with a website
>failover latency architecture percentile scaling etc
>hurr dur memecache is broken again how do fix
>never has written an algorithm in his whole life
▶ No.866404>>866411 >>866431 >>866700 >>866888
>>866360
singletons piss me off soooo much. You have some stupid language with global variables, then some stupid newgrads follow a bunch of official design patterns to copy/paste a bunch of bullshit into every single class they make (which are really just namespaces for a bunch of functions that manipulate global state), so they can pretend their classes which only have a single instance (which are instantiated god knows when) are some kind of modular concept.
▶ No.866411>>866416 >>866421 >>866426
>>866404
>>866360
I'm not a CS fag so I don't get it, what's the point of singletons? If you have a class and you want to instantiate it only once, just don't instantiate it more than once.
▶ No.866416>>866434
>>866411
they are a meme, forget about them
▶ No.866421
>>866411
The point is that there is a maximum of one instantiation of a class without the need to explicitly pass the object through the code.
▶ No.866425>>866435
The "m" or "m_" prefixes should only be for private or protected member variables.
▶ No.866426>>866741
>>866411
One usecase I remember from back when I learned C++ game programming is to have a Singleton to hold the pointer of the current/active game state (level/scene) or whatever. The idea is to just have one instance per process and enforce that too (although I forgot the syntax to do that in C++). It's probably wrong and retarded and also irrelevant now since I'm a webcuck.
▶ No.866431>>866433 >>866888
>>866404
Making a utility class which isn't a singleton is just retarded. It's pointless to have to initialize an object just so you can use Util.manhattanDistance(loc1, loc2)
▶ No.866433>>866445
>>866431
But that shit is getting instantiated anyways? It's no different.
>it's pointless to instantiate a class so you can use Util.manhattanDistance(loc1, loc2)
>it's totally different and not pointless to instantiate a class once and only once so you can use Util.manhattanDistance(loc1, loc2)
▶ No.866434
>>866416
>trusting people to enforce invariants
>not having code in place to stop people from doing things that will break stuff
durr
▶ No.866435
>>866425
a better way to differentiate member variables is to append "_" to them.
e.g. foo_
▶ No.866445>>866446
>>866433
Yes, but the language handles creating and passing it around implicitly.
▶ No.866446>>866776
>>866445
Too much implicit behavior leads to confusion and a lack of understanding when something needs to be debugged.
>the language
The "language" does no such thing. Singletons are a pattern of code, not a feature of the language.
▶ No.866452
>>866444
I was talking about a specific use case for a class that includes only static methods with no members.
>Too much implicit behavior leads to confusion and a lack of understanding when something needs to be debugged.
It is obvious when a static method is being used, because it is using a function that belongs to a class instead of a function that belongs to a variable.
>Singletons are a pattern of code, not a feature of the language.
Singletons themselves are a pattern of code, but I was talking about how most languages handle a class with static methods.
▶ No.866489>>866672
My biggest pet peeve is when I'm working with someone else's shit and it's obvious they never read the book Clean Code: A Handbook of Agile Software Craftsmanship.
▶ No.866525
▶ No.866536>>867679 >>867787
>>866253
>>866298
The whole point of mixing tabs and spaces like >>866143 said is so that the code looks right regardless of your chosen tab width.
▶ No.866543
>>866403
>uses mongoloiddb
that's enough for me
▶ No.866544
>>866162
>not using godly dvorak layout
▶ No.866672
>>866489
what's that like?
explain in detail
▶ No.866674>>866709
>>866127 (OP)
Systems Hungarian is fucking cancer and anyone using it unironically should be drowned in napalm
▶ No.866700
>>866404
Container-managed singletons are just fine.
▶ No.866703>>866705 >>866717
>>866143
>>866147
Wait you use spaces for indenting? The fuck? I thought you just meant tabs instead of spaces as in when someone writes "int x" they use a tab between int and x.
▶ No.866704
>>866154
is fortran for women and poc? for some reason i notice a lot of the diversity hires are using fortran on lots of projects.
▶ No.866705
>>866703
yes, you small-brained unwashed barbarian cave-man reject who sacrifices human babies to copper statues of bulls when you aren't ass-fucking real bulls, spaces are used for indentation. tabs do not belong in source code.
▶ No.866709
>>866674
Isn't napalm ediple if hes not on fire? i ate napalm and its basically inflammable orange juice.
▶ No.866732>>866735
Anything involving OOP in the loo crap. Anything involving "patterns" or some dumb fucks idea about engineering lmao code.
▶ No.866735>>866757
>>866732
oop is a shitty overused meme but if you're stuck doing oop, being able to recognize, write, copy/paste, and adapt patterns to fit the problem is essential tbh
▶ No.866741>>866747
>>866426
Couldn't you just have a global variable? I know global state is evil, but it's not as evil as a singleton.
▶ No.866747
>>866741
A global variable is a singleton though
▶ No.866757>>866758
>>866735
nah the languages are going to be dead in 10 years and it's a total loss of effort. Like someone in 2008 deciding to learn Perl. Waste of time.
▶ No.866758>>866760 >>866768 >>867453
>>866757
What's the language of the future?
>inb4 rust
▶ No.866760>>866762
▶ No.866762
>>866760
>its a memelord answer
▶ No.866768>>866777
>>866758
Some version of javascript.
▶ No.866773>>866774 >>867670
>>866143
>mixing spaces and tabs
Either use spaces or tabs exclusively, or hang yourself.
▶ No.866774
>>866773
i didnt know turkesy has teeths
▶ No.866776
>>866446
>Too much implicit behavior leads to confusion and a lack of understanding when something needs to be debugged.
Jesus christ, if you can't wrap your head around something as simple as a singleton you shouldn't even be working with code.
▶ No.866777>>866778
>>866768
Please let it not be so.
▶ No.866778
>>866777
Not even trips will protect you from a future of shitscript
▶ No.866880>>867329 >>867675
Maintainers that don't fix fucking problems in their projects.
>be ruby programmer
>use project to get something done
>have problems with some edge case the program doesn't handle
>open issue in project
>make detailed and thoroughly researched post
>include examples and inputs for reproducing the issue
>maintainer responds
>lmao that's cool OP
>you're right, it's a problem
>but it's very a low priority fix right now
>if you want to submit a patch I'll be happy to take it :3
>closes my issue as wontfix
I'm supposed to spend days figuring out how your project works just to do something you can do in 15 minutes? Fuck you. Your little project can die in a fire for all I care. I'd rather write my own tools than contribute to your shitty project.
>5 years later
>get email from github
>its a guy asking if the problem I described still applies
>maintainer gives literally the same "I don't care, patch it yourself if you do" response
My sides. That's why Ruby is dead.
▶ No.866888
>>866404
>>866431
The point of singletons is implementing interfaces. Class methods can't serve as interface implementations, nor can you pass a class as parameters where interfaces are expected. That's why people make a "singleton" object and go to autistic lengths to ensure there is only one copy.
Factories are similar. They exist to hide the new keyword. New introduces hard coupling at the ABI level. Factories hide new behind methods that return interfaces, allowing you to swap out the actual concrete classes at will.
Design patters exist because Java is complete and utter crap and they are needed to get around the limitations of the language. Of course, copy-pasting code monkeys simply don't understand what they are doing and why they're doing it. Eventually, everybody started using design patterns by default and it became a meme.
▶ No.867030>>867110
Hash tables. Anything that can be done with one can be done more effectively with a DAG
▶ No.867092>>867096 >>867097 >>867098 >>867146
>>866127 (OP)
What kind of absolute moron presses space some arbitrary number of times to indent?
▶ No.867096>>867679
>>867092
>what kind of moron wants their alignment to break everytime someone else opens their code
inb4 space AND tabs
▶ No.867097
>>867092
>what is multiple space insertion on tab key
▶ No.867110
▶ No.867146>>867176
>>867092
Watching them program reminds me of rats pressing the button to stimulate their pleasure center.
▶ No.867176
>>867146
>code is totally broken anytime anyone else opens the source file
>tabs
not even once
▶ No.867329>>867361
>>866880
>tfw no one will ever ask you to fix something in your code because no one uses your code
feels sad man
▶ No.867361>>867369
>>867329
Yeah I know that feel. Many of my projects weren't popular but I had a few libraries that got 500k+ downloads. They saw some use, if the rubygems site is any measure of popularity. I got many issues on github. I was always happy as fuck when people came to me to talk about my project and how to improve it. It was a gift. I tried to be as accomodating as possible. It pisses me off when other developers don't even try to do the same. They don't even have a HACKING file that explains how the project works, how it's organized, how subsystems are related and interconnected. People end up having to breadth-first search the code base starting from the main function in order to figure out the repository and contribute to it. It's a massive disrespect for the contributor's time.
If people don't want to maintain things anymore they can just say so. It's fine. Just don't make me come into the bug tracker full of expecations and leave empty handed after researching the issues and presenting them to the developer. At some point I went to college and had to dedicate more time for study. I couldn't maintain my software anymore. Someone forked it and took over. I talked to the guy and he agreed to maintain it as the main branch. I started directing people towards the maintained fork. I even transferred the package manager credentials to him. Even now, despite all this, I still get email about it and still respond to those people. Software is like a child, honestly. Our creations never really leave us.
Anyway...
Contributing to Node.js is another example of a fucked up process where you get ignored if you're not working on the things the company financing the development care about. I saw some great features get suggested, worked on and sent in for merging while some faggot directors sat around and didn't make any decisions. I got excited for nothing. Eventually, the branch drifted so far away from master it was easier to start over. I asked about the status of the feature and they gave me non-answer after non-answer until eventually owning up and saying it wasn't happening...When suddenly the web standards changed in order to include my feature and the V8 team did their hard work for them. Even then it still hasn't landed; the V8 improvements only served to optimize other areas of Node. The JS environment Chrome provides is superior to Node in every way, the only drawback is there's a browser attached to it.
Open source is fucked up. Contributing to many of these projects is a complete waste of your time and hard work. People are better off reinventing the wheel, honestly. It's actually easier to roll your own tools than deal with the fucking people in charge of the other tools that already exist. Also, you never know -- your wheel might turn out to be better than the rest. Another pet peeve of mine is exactly this: retards who parrot the "don't reinvent the wheel" saying. Current wheels suck, we don't control their development and have to beg on issue trackers for the wheel gods to please please fix the bug or add the desired feature, and then watch their uncaring shrug for 5 years, even when faced with literal patches that they can simply merge in. People who invented the wheels are mortals just like us; we can do it ourselves just as well. Fuck those people.
▶ No.867371>>867375
▶ No.867375>>867437
>>867371
This. snake_case_superior.
▶ No.867437>>867442
>>867375
whatsss going on in thissss thread?
▶ No.867442
>>867437
happening(what='snek')
maximum_overload(Snek())
▶ No.867453>>867465
>>866758
Best possible future would be Erlang (~97% of code) + C (~3% of code, optimized for speed of execution).
▶ No.867465>>867537
>>867453
If your meme language got that popular you'd hate it with a passion, because you can't stand popular things.
▶ No.867537>>867591
>>867465
Your reasoning is wrong. C is one of most used languages ever and I still like it.
▶ No.867591
▶ No.867670
▶ No.867675>>867990
>>866880
>something you can do in 15 minutes
How the fuck do you know that if you haven't spent days figuring out how his project works?
>Your little project can die in a fire for all I care. I'd rather write my own tools than contribute to your shitty project.
NIH syndrome wins yet again.
▶ No.867679
>>867096
yes, inb4 indeed
>>866536
▶ No.867737>>867990
>Getters and setters leaving the internal data basically wide open, violating encapsulation and being no better than a plain old struct but with extra work to use
▶ No.867787>>868168
>>866143
>>866536
But that doesn't fucking work. I use a three space tabstop: there is no code that is formatted for eight space tabstops that looks right with such a small tabstop.
▶ No.867791>>867834
TABS FOR INDENTATION
SPACES FOR ALIGNMENT
▶ No.867834
>>867791
This is what invariably happens: (let's see if this shit works, I don't think I can post tabs)
while (IAmNotACIANigger && (youAreAFaggot ||
youSuckCocks))
When tabs are used, they are invariably treated as the set tab width size number of spaces.
while (IAmNotACIANigger && (youAreAFaggot ||
youSuckCocks))
▶ No.867945>>867959 >>867992 >>868162
>>866189
After reading your code I thought of how to improve it. I assumed code this shitty was Java, but here's what I did in maybe 5 minutes. There's a better way to do this, but it involves re-writing your mood system and I have no idea how your mood system works or how much worse the rest of your code is.
▶ No.867954
>>866162
Underscores are there to keep lazy niggers like you out of my codebases.
▶ No.867959
>>867945
>Java
At least your code looks much cleaner. When did /tech/ stop designing logos and start programming again?
▶ No.867990>>868169
>>867675
>How the fuck do you know that if you haven't spent days figuring out how his project works?
Are you really saying the developer of a 200kLOC project doesn't know exactly how to implement a simple feature request? That he doesn't even know where to start?
>NIH syndrome wins yet again.
As it should. It's a free software world. If you see a wheel with neat features you like, go read its code, understand it and add it to your own wheel.
>>867737
At least with methods you have the freedom to add logic later in the nebulous future without modifying the API, right?
▶ No.867992
>>867945
>not just taking the max() of the array
▶ No.868162
>>867945
Like you said, it depends on how the rest of the program works, but this is likely the proper, Don't Repeat Yourself way to do it (in Python):
moods = {
'happy': 3.2,
'glitchy': 1.2,
'angry': 3.4,
'lovey': 2.2,
'depressed': 0.4,
'scared': 0.9,
'zealous': 2.9
}
mood, value = max(moods.items(), key=lambda item: item[1])
print("Mood: {} ({})".format(mood.capitalize(), value))
A rule of thumb here is that if adding a mood requires changing code in multiple places you're doing something wrong.
▶ No.868168
>>867787
>code that is formatted for eight space tabstops
there's your problem
It's not supposed to be "formatted for x-space tabs". Tabs are supposed to be a logical indentation level, nothing more. Vertical alignment is supposed to be done with spaces
I use three-space tabs too, muh nigga
▶ No.868169>>868175 >>868268
>>867990
>Are you really saying the developer of a 200kLOC project doesn't know exactly how to implement a simple feature request? That he doesn't even know where to start?
Maybe he knows and it isn't exactly as simple to do as it looks with the architecture in place. Maybe it would require significant refactoring to do right, and the author isn't fond of brittle kludges.
▶ No.868175>>868268
>>868169
Maybe the author should say so if that's the case?
▶ No.868268>>868472
>>868175
Agreed. He just told me it was a low priority fix, and even that was a lie since it implied it was gonna get fixed someday.
>>868169
I'd understand if that was the case. However, the general infrastructure was already in place. I actually tried to make a patch and in the process I discovered he had created metaprogramming systems to generate everything. He had already written lots of code using it to handle two other specific cases that apparently were useful to him. My issue essentially involved handling a third and fourth cases.
I tried making it work myself but there was just too much stuff I didn't know about the project and there was no documentation. I even joined the fucking project's IRC and the motherfucker doesn't even respond to messages there.
Eventually I just gave up because I had better things to do.
▶ No.868472
>>868268
I have similiar cases. I just ended up forking it and making the changes myself because i dont think the original is maintained anymore.