/dpt/ - Daily Programming Thrrad

What are you working on, NEETOs?

Attached: 1536355351688.jpg (1280x720, 128K)

Why haven't you learned Haskell yet, Jow Forums?
Previous thread: Thank you for using an anime image!

Attached: it's a trap.png (1275x677, 873K)

var i; // Is this necessary in JavaScript?

for (i=0;i

Because I'm a productive member of society

Keep shitposting fellas, I need more material :3

give me a C++ metaprogramming challenge!

you are the true hero txt

Attached: mayAllahForgiveMe.png (675x477, 275K)

It's not necessary, but JS will decide that the scope goes magically everywhere and you'll end up polluting some other function with an 'i'.

OOPSIES FUCK OFF I HATE WORKING WITH YOU DIMWITS

You ask basic questions every 5 minutes and seem incapable of holding more than one piece of information in your head. Oh but that's just "best practice"! Nobody ever got fired for being unproductive in Java!

Anyone has the dpt challenges list?

heres one, go an entire thread without talking about haskell

Attached: lizard hahahaha.png (629x466, 406K)

oopsie woopsie did a poopsie! all over the fucking codebase

Haskell is for trannies.

>working as an intern for a company
>old legacy system
>hate my job
>have to update the database
>database is so big, full of schemas and sensitive data
>afraid of touching a single bit of it

if (massiveTits && !hasACock) {
auto jizz = blowLoadOnTits();
} else {
gas();
}

>noob
>check for invariants instead of No list.
>!hasAcock
>hasRealVagina

no, that's Rust

they're both

Ah, but how to tell if real vagina rather than RealVagina(tm). If it has a cock AND massive tits, it's a dead give away, logically speaking.

Strictures/logic has to give way to pragmatism.

Is it okay to start an application through the constructor of a class that gets instantiated on Main? I'm not sure if that's considered awkward or not. Should I have a parser.run() method that I call on main instead, that calls the logParser.run() inside it?


public class Parser {

public static void main(String[] args) {
Parser parser = new parser();
}

public Parser() {
InputChecker inputChecker = new InputChecker();
LogParser logParser = new LogParser(inputChecker);
logParser.run();
}
}

you're all so fucking stupid

t. every autist programmer narcissist with a God complex, ever.

(function() {
console.log(this.i);
i = 0;
console.log(this.i);
}).call(this)
this logs undefined, then 0

(function() {
"use strict";
console.log(this.i);
i = 0;
console.log(this.i);
}).call(this)
this logs undefined then throws an error ReferenceError: assignment to undeclared variable i

Besides, you are supposed to by default use const to declare variables and only use let when your linter tells you so

>2018
>still using camelCase
>>>gas();

wrong

> still using C-styled snake-case
> still using C

>Assuming I use snake case instead of short and concise style names like strstr.
>Pretending like there exists a better procedural language than C.
I bet you're a rust trannie.
>>>gas(you);

What's wrong with camelCase?

Why not? If RIAA is an accepted approach, then I think it's a good idea. Remember, there are no silver bullets to delivering working software, only trade offs. Holding one self to a culture of enforced style passed off as "the right way" prevents creative solutions.

Go for it.

t. oopsie

Sup /dpt/. I am graduating in October and desu this electrical engineering shit is so boring and doesn't seem to be my thing (yeah, was a big mistake)
I want to learn Java Web (I did some POO 2 years ago), can you please link me where should I start (with some must_applications please). I am having a mental breakdown I should have chosen CS as I'm better in maths than physics. :(
Thanks bros

style issues are often personal choices, such as clarity for maintainability rather than conciseness causing obfuscation.

Was going to try write fizzbuzz in asm but the linker is already complaining about no '__start;' and I don't understand what the fuck is going on. Like how can I just declare a string in an assembly. Don't I need to push each char onto a stack, is eax a special register (is it even a register?), what the fuck does 'int 0x80' do.
section .text
global main
main:
mov edx,len
mov ecx, msg
mov ebx, 1
mov eax, 4
int 0x80
mov eax, 1
int 0x80

section .data
msg db 'Hello, world!', 0xa
len equ $ - msg
[\code]

It's a religious issue, rather than anything else. Reality is, many commercial code bases vary so much in style and chaos, it's not something one can argue about when joining existing teams and moving from code base to code base.

The ability to be flexible is what gets you paid. Being autist over matters of style ends up in analysis paralysis, and projects rarely delivering. It's usually only possible in intellectual navel gazing by open source development.

Go with the flow, user. Don't take self-appointed autist Kings with an OCD complex as gospel

what are the alternatives though? using underscores just requires more keystrokes and all lower/upper case is illegible

>llama
>gayLlama
>molestGayLlama
or even better, the insistence on making the first character lower case means that you are forced to write either one of xMLRequest or xmlRequest, the former looks crap, the latter looks okay but breaks when you do requestXml because now you look like a complete fucking retard.
If you're going to insist on having uppercase letters instead of a delimiter like - or _ then at least use PascalCase which doesn't have the problem of breaking case sensitive search and having ugliness like Xml in it. You can make acronyms all uppercase and it still works correctly.
But I prefer to keep my names short and when they need to be long I use _ (or - in languages which allow it). This is because you'll (hopefully) be reading your code far more often than you are going to be writing it.
I was once perusing some source code for a BSD kernel (can't remember which) and I happened upon a struct which holds information about a process. The fields were all about 4 characters long and encompassed a variety of different attributes for each process.
I was stunned and amazed when I knew exactly what each very concisely named field was for without any issue, it was a true masterpiece. The stupid argument of "long names are clearer and more maintainable" is a load of bullshit.
You (if you're not a java shop pajeet who shits code all day long) will likely read your code many more times than you will write it, being able to refer quickly to short meaningful names which mostly fit within maybe 10 characters is incredibly useful for quickly grasping the gist of code.
I'm not saying that you need to try to go as short as possible but length is certainly your enemy especially when you're dealing with more localised information.
In my experience, longer more verbose names just make code harder to read, especially when they contain lots of redundant information.
This is obviously not an excuse to make your entire program use 1 letter names.

do syscall fucking retard

Have you considered putting the horse in front of the cart?
Jow Forums is not here to teach you assembly and to teach you how to make that assembly acceptable for your linker.

Why would you want to have the return variable jizz? Pretty fucking gay, yo.

I use camelCase but I don't follow it as if my life depended on it. If I need to have XML capitalized, then I just capitalize it.

>xmlRequest
>XMLrequest
>XMLRequest
>requestXML

I don't give too much of a shit.

>the insistence on making the first character lower case means that you are forced to write either one of xMLRequest or xmlRequest, the former looks crap, the latter looks okay but breaks when you do requestXml because now you look like a complete fucking retard
so this is the power of autism

Touch typing doesn't involve thought, once you've adjusted to a given code base, your brain adjusts and you don't even notice you're inserting or leaving out underscores or switching cases.

The rule of thumb is sticking to a given style for a given code base once chosen. I have a personal preference for camel case, but it's just because my own personal projects use it. When I work on C code bases I just unconsciously switch. Same with having mix it when using C++ code that uses camel case that wraps C snake case. The ability to adapt is intellectual strength rather than sperging on every project that's joined over this issue. That's called being a team member.

Then your naming scheme is inconsistent. Why not just make it consistent by using PascalCase
Some people take pride in consistency, that's why writing
xmlRequest and then requestXML is not acceptable.
If you're at your /job/ then you can't change things so it doesn't matter.
But if you get to decide or it's for your own project then why not be as consistent and clean as you can?
Why is Jow Forums so full of /job/ fags who only care about their /job/ and think that writing any code for anything but their /job/ is some kind of lame excuse for a hobby.
Some people do actually enjoy programming and aren't only in it for the money.

xmlRequest and requestXml
but your OCD makes you unable to type that for some reason

Yes, it's because it looks fucking retarded.
Are you retarded?
Do you understand that XML is an acronym and not a single word?
You've also conveniently ignored the other arguments I presented.
If you're going to go all lowercase then writing xml is acceptable although still not great, but if you're going to mix case then writing Xml is unacceptable.

Again, there is no one true way. Just approaches that work for each of us. Confusing subjective opinion with ultimate truth misses the point that another programmer may think exactly opposite to you for the same reasons.

My only intent is maintainability because I never plan to stay on any proud for more than a year, add my value, get paid, and move on with no emotional investment in the code (remembering that one day, some manager in a suit will simply "rm -rf" the product making the emotional investment pointless).

Strength is the ability to move from company to company without emotional investment in any code base. Remmeber that you as a coder don't own the product that the company hires you to work on, as you are just as disposable as the code base. Never fool yourself into thinking you own anything you work upon for an employer, because you are probably more expendable than the code base itself.

turning acronyms into words is what you do to write consistent camel case
it's not like we don't do that with commonly used acronyms anyway, like radar or modem

pure autism is not having exceptions to a hard rule when it's practical to the situation. You simply make a different rule for those situations.

bool iso(char *str) {
uint8_t m[32] = { 0 }; /* map 256 bits - 1 bit per char */

while (*str) {
int x,y; /* co-ords into the map */

x = (((int)*str) / 8); /* map index */
y = 1

Like I said here:
I'm not talking about jobs.
Nobody gives a shit about jobs.
Jobs are places you go to write garbage nobody will ever read and wonder why you came to this industry in the first place.
I would expect Jow Forums of all places to be a place where people who care about tech for reasons other than money would come.
>making things inconsistent is what you do to write consistent camel case
Alright, got it.
Pure brain damage is picking a bad rule set and introducing lots of exceptions when you could have picked a better one and avoided the exceptions.

No you aren't making things inconsistent, you're consistently turning every acronym into a word, like Xml or Json or Php or Fbx

jobs are the only place you write code people will ever read though

> not realising it added to the humour of saying "auto jizz"
the autism is strong tonight

You're breaking one set of rules (the English language) to satisfy another shitty set of rules (camelCase).
Are you fucking retarded?
Nobody gets to see your code, just your co-workers, and because of this nobody gives a shit about the code.
I've had more people interested in my code when I posted it to Jow Forums than from code I've written at work.
With code I write outside of work at least I can show it to people who may be interested, it actually gives me a reason to try to make it nice to read.

>You're breaking one set of rules (the English language) to satisfy another shitty set of rules (camelCase).
correct
programming isn't english

> not realising that programming is simply a kind of game
> personal projects are great intellectual exercises
> thinking that "inconsistencies" are bad
See also current research on dark matter to add fudge factors into physical models of the universe because of inconsistencies.
Inconsistencies are part of the universe, and part of any code base used within that universe. Trade offs are part of making software a delivered product what works.

your co-workers give a shit about your code because they actually have to work with it
but you want to dress your code up so people on Jow Forums can say "oh that looks nice"
what the hell is wrong with you

Java in Action 8
Java effective
Learn some framework as spring boot or vertx IO.

> using subjective adhominems directed at code as a rationale for choices
As good as someone saying "C is gay" or "Java is for morons". I'm starting to think this is how islam happens (i.e. autism)

Oh yes, that's precisely why the recommendation is to write all comments and identifier names in English rather than say some made up language like Esperanto.
Let's take a language we use every day all day and then make it subtly different for no good reason solely to have an ugly looking naming scheme not break, instead of adopting a better naming scheme which doesn't require any changes to the English language.
When scientists find an inconsistent model of reality they don't immediately reach to "fudge" it. If that was the case we would be working with the Newtonian model of physics fudged with lookup tables in order to work with space travel.
When you're presented with a model which fits reality better with fewer inconsistencies you adopt it in favour of the previous model.
You're arguing against yourself with this train of thought, try again.
None of my co-workers have ever given the slightest shit about any code I've ever seen them write. If there's anyone who has ever given a shit about work code it has been me.
>trying to sound smart on Jow Forums

I made a bash script to download every image from rule34 paheal based on a tag or set of tags.
It's primitive but I'm actually really proud of it.

>make it subtly different for no good reason
there is a good reason though, and it's immediately understandable by anyone who looks at it, your only complaint is "it looks retarded"
programming breaks the english language regardless, we use nonsense english words to refer to many programming concepts

> feeling this threatened by other people's choice in style
> not realising we are not trying to change your own style, so has no need to feel threatened
If your approach feels good to you, then go with it. We simply follow our styles because we feel like it. We are not telling you to change, just to consider experiences we've had in different settings.

Wow so many retards here that think (real) programming is just done by a single guy. What if you had to write a quick patch and you don't have access to your gay IDE? Conventions are created for a reason

> Was it XML or xML? xml? I'll just type whatever I remember and let it blow up, then try again, I'm sure the production server can be down for like 5 min, right?

It's ok if you don't want to follow them or like to "create rules on the fly", in my eyes you are unemployable and only good for freelance toy projects.

I'm so sad I won't be working at your java contracting firm in delhi

We adapt to fit the project. If the rules are set on a project, they're the ones we follow. It changes from company to company, and we quietly nod to you as an existing team member that yes you are great and knowledgable simply so we keep a jobs, till we quit for a higher paid job, to adapt yet again for even more money.

But there's no good reason in the face of using a different style which gives more consistency.
And it does look retarded, it's a fucking inconsistency.
Breaking fundamentals of English is not the same as introducing a few words.
The discussion was about why camelCase looks dumb. I explained why camelCase looks dumb and gave options for replacing it. I also explained how there's no good reason not to use one of the alternatives given the disadvantages of camelCase. I don't know what the fuck you're on about but this has nothing to do with feeling threatened or following styles. If you're contributing to a project or working then OBVIOUSLY you follow the style. This is solely about situations where you get to pick the style (like your own projects or code you paste on Jow Forums).

Not realising that we work on many legacy projects sold by companies that were written by that one guy who was so inflexible they had to sack him because of his "muh code format" issues. We just adapt to the legacy pile of shit he's written, knowing that the only reason many programming jobs exist is because the code base is a pile of shit. If we were to actually improve the existing code base, we'd put ourselves out of a job.

english doesn't use underscores for spaces either
its not a complaint of concistency, it's a complaint of what you think doesnt look good

what is getting paid and leaving work in the evening, to leave autists fuming overnight, while we quit to get paid more as we climb the pay ladder.

There is no reward in loyalty, user. When the company you set up the coding style for eventually sacks you, and subsequent developers come in and collectively ridicule your style because of their own opinions, you'll realise this is all wasted energy.

Get paid. Then score a higher paying job to leave the others to deal with the mess. Leave. Adapt. Get paid more. Rinse and repeat.

But underscores still make it look like spaces.
It's very much a complaint of consistency.
Swapping out spaces for underscores is a minor change which keeps things as readable without major impact.
Pretending that acronyms are words is a major change to how English looks when it is written down and makes things look incredibly wrong and obnoxious.
The whole use of uppercase letters to indicate word boundaries is itself still a major problem which gives us nonsense like XMLHttpRequest.
That's the point though, I'm not talking about jobs because trying to change the style you use in your job is a waste of time.
But some people are in this industry not just for the money and do a lot of programming outside of their jobs, this discussion is directly in relation to those scenarios.

> trying to sound smart on Jow Forums by using autism and ad homs

Just use lisp-case. Oh wait, you can't, because you're using a shitlang. Sorry.

>Pretending that acronyms are words is a major change to how English looks when it is written down and makes things look incredibly wrong and obnoxious.
100% your opinion
please tell me you don't understand what Xml or Php means

Lisplets are quickly becoming the worst shitposters here. Atleast that racket guy actually posted code.

Correct. English is the most bastardised language on the planet with many inconsistencies and exceptions, but it's become one of the most dominant. Likewise, HTML/JavaScript can be utterly bastardised but that didn't prevent its massive uptake. Consistency has nothing to do with success.

That's because Jow Forums only codes in css,

Imagine getting this upset about a language which is both superior to and older than your shitlang of choice.

>requestXML()
>Okay cool, I know what this is
>requestXml()
>Wow, I have no idea what this does

snake_case_looks_like_normal_text_and_is_far_more_readable
ThanShittyCamelCaseIsOhMyGodHowCanYouNotHateReadingThis

>short and concise style names like strstr
Languages need to support giving things full-length names and abbreviations both, like:
fn (str complete al cs)concatenate_strings(str first, str last) al catstr

Then you can type cryptic af shorthand with minimum keystrokes while you're rolling, and when you sober up, you can have your editor expand it to readable descriptive names.

(request-xml)

Only pajeets make 140 char long var/func names.

>gassing flat chested women

what is wrong with you

this

>saw my friend using nano
>another one bites the dust

Attached: Screenshot_20180907-144309.jpg (1440x2880, 440K)

I think it's the "go big or go home" argument.

Nice

Obviously not. Wht the fuck would you even think this is OK? Make an actual parse() method that calls logParser.run()

... and by extension, make a parse() method that calls the other parse() method that calls the logger.parse() method.

Or you can cut work early and enjoy a quiet afternoon with people.

I'm not into dp, but whatever floats your boat.

Well, it's been an enjoupyable evening baiting autists. Time to go fap to some porn.

It's not about understanding.
It looks inconsistent.
Do you not understand this?
When you scan code and you see _php_ or PHP or _xml_ or XML you immediately know what you're looking at. When you see Xml randomly in the middle of nowhere you first try to read it as a word and realise it isn't one and then have to backtrack to work out what the fuck you just read.
It causes slow-downs when reading. The same way that having random unnecessary parentheses slows down parsing of expressions e.g.: (((x * y) / 4) + 1) / 2
You now have two sets of unnecessary parentheses and one set of necessary parentheses. If you actually know mathematics and aren't the 99% of Jow Forums who think that mathematics isn't important in programming and who are so math illiterate that they don't know operator precedence then you will struggle to process this expression quickly because you'll encounter two sets of parentheses, do the thing you do when you encounter parentheses - carefully work out where they start and end and work out how they affect the calculation - then you will quickly realise they don't do anything. This slows down the speed at which you could read the expression. The same way that having random acronyms written like words slows down the reading of code.
You know what else is readable? Really awful complex code written with goto jumping backwards to implement loops. It's readable but you don't want to be reading it all day, and it's not easy to read. Obviously camelCase is not as bad but it certainly is readable in the same sort of way.

> straw manning cherry picked scenario without considering we might simply change rules for that situation to make everyone's life easier, especially the poor idiot left to cleanup the code when I bail the project for better pay for the monkeys to cleanup.

Feels good.

t. caring this much

so you can understand xml and XML but Xml is confusing? how does that work?

>literally didn't read the bit where I said it's not about understanding

>Having a bit of consistency means being inflexible and that the code is legacy pile of shit
Nobody said anything about legacy projects, it's clear that you aren't going to rewrite an entire codebase just because you don't like caps at the start of your methods, It'd be fucking retarded. You normally pick a convention when starting a new project and try to stick to it as best as you can, so you don't cuck yourself in the long run

I have trouble believing you can parse an all-lowercase acronym like 'xml' but 'Xml' causes you to trip up
that doesnt make sense
if your brain is used to seeing it, you don't need to double-take

> literally too close to the problem in question to realise you are contradicting yourself
Rules are for slaves, user