/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Previous thread:

Attached: 0012405a.jpg (600x795, 61K)

Other urls found in this thread:

pastebin.com/y76rmQTU
twitter.com/NSFWRedditImage

Which duel major is best, CS/math or CS/physics?? Is it more personal preference? By best I mean for jobs and becoming an overall better programmer

Researching my next project
Shit op by the way

>Which duel major is best
Fencing/Banjos

>Which duel major is best
Fighter/Mage

Someone?

>Which duel major is best
Trebuchet Technician/ Butcher

First thing you need to do is drop TDD.

cleanliness is subjective

Type Dependent Dicks?

Or more precisely, the obsession with TDD. Unit tests can be useful. A slavish, unquestioning adherence to TDD is not.

>Which duel major is best
Goku+Superman

>Which duel major is best
Naruto/Sasuke (2010) with background Linkin Park Music

I have never ever programmed something serious. Just have been doing simple cmd programs for uni.

so there are some kinds of cleanliness?

>Which duel major is best
GNU/Linux

Learn a few programming languages. Read Clean Code. Learn some frameworks. Learn some math/algorithms along the way.

>senior dev thinks he writes "clean code"
>massive amounts of repeated code and boilerplate because he doesn't understand abstraction
>writes hundreds of useless unit tests
>refuses to approve pull requests if they use newer features of the language
>pulls in extra libraries and frameworks all the time to use one or two functions from each of them

there's clarity, efficiency, terseness, consistency, there's so many ideas people have about what makes code clean or beautiful that it's a bit pretentious really. You either form your own concept or use your companies concept of what constitutes clean code

>Read Clean Code
And then do the opposite of what it says.

>so there are some kinds of cleanliness?
Yes. There's real cleanliness, and then there's false cleanliness which inhibits understanding.

thank you for taking your time to enlightening me

I do not understand the current software development landscape. If you need performance then use C, C++, or Rust. If you do not need performance then use a functional language.

what if you dont need performance but you need to write programs with state?

Then you use something like Control.Monad.State or ST or IORef.

Why can't you faggots give me an answer to my fucking question without making dumb jokes? Ones that aren't even funny at that. This shit is not a fucking game this is real life.

>school
>real life

have functional programmers ever actually written real world programs or do they just sit aorund doing whatever their equivalent of fizzbuzz is

Since no one answered in the last thread I'll ask again here

Since I know C++ and have experience with structures, should I jump straight into using them in C or work my way up to them? I'm going through C programming 2nd edition and I do know most of the material already

>Why can't you faggots give me an answer to my fucking question without making dumb jokes
dude that's asking too much, your entire life is a joke

I'm a functional programmer and I've written plenty of real world programs.

why do you need to ask other people if you should skip ahead in a book? try it yourself

Such as?

Boring CRUD stuff at work. All of it functional, though.

I ask because I'm wondering if the backbone of the book is important enough to not skip or not

C++ is just a superset of C
if you know C++ you know 90% of C

Which duel major ought I to take? Fencing and pistol shooting, perhaps?

>C++ is just a superset of C
WRONG

In java, how do you escape % character? \% is invalid apparently.

Attached: 1519124268362.png (521x263, 118K)

C should have been a subset of C++.

that doesnt make any sense

You can't. The usual approach is to read it in from a resource text file.

%%?

Well it isn't so don't go around saying that it is.

>that doesnt make any sense
why

Attached: Screenshot_20180821_145606.png (3840x2160, 467K)

top kek

Thank you based javabro

oh you want to do \\%

>50-line functions that jump between 5 different layers of abstraction
>short variable names that only the original author understands the logic behind
>comments that become outdated by next week
This is the code that juniors that haven't read Uncle Bob produce.
I don't care what you think about the author, I don't care what you think about Java (it's just used as an example language, the principles apply to any language). The book actually contains sensible guidelines that, if followed, lead to readable and maintainable code. These are practices that you won't learn by yourself if you're working on short-lived personal/university projects on your own. Just read the book once, the principles will stick with you because you'll realize they all make sense once you read them.

I just looked through Clean Code and it's telling me all functions should be 5 lines or something
that's retarded

How long should it take for me to get through the rust book? I'm on day 2 and I'm just working through chapter 5. How much longer until I'm a /real/ rust programmer?

Check out xmonad. It's real, it's got state, it's got IO, it's 100% haskell.

I was on his side until he started pulling in libraries.

Attached: jblibraries.png (589x368, 41K)

Please be joking. Poojeets on suicide watch.

Attached: libcucks.png (590x877, 99K)

What are you an ex-jerbrains salesman?

use %c to include a character in the string, and pass in the % as the value for that character.

why aren't there game engines that use double instead of float?

most of them are still 32 bit, or have roots in it

It all seems like a cargo cult to me.

maybe his advice is useful for java codlets but you cant get any real work done in 5 lines
I agree with some of his points about naming, but all of it is so subjective

>Just read the book
>it'll make sense I promise
>you'll become one of us
No. I don't have enough free time to be a member of any more cults.

Your code looks like crap.
All of the parameters are hard coded, but not set up to be.
You don’t store the data for the employee after making it.
Entering a bad number just exits the program immediately? Wtf?
It’s all in the main method. That’ll be really hard to expand with.
But thanks for using Java

That's exactly it. It's not even lowest common denominator stuff because it's actually harmful at higher levels.

It terrifies me that you agree with most of the stuff he does. It's a constant battle trying to keep him from destroying everything.

So what is a good tutorial to learn to use visual studio and c#? i already know how to program in java and net-beans

also is there a framework that uses javascript?

"Clean Code" cultists please leave. You are well below the minimum level of ability required to post constructively in /dpt/.

>All of the parameters are hard coded, but not set up to be.
It wasn't really a finished answer
>You don’t store the data for the employee after making it.
What data? All I need to do is print the salary.
>Entering a bad number just exits the program immediately? Wtf?
Asked by the lecturer
>It’s all in the main method. That’ll be really hard to expand with.
I don't see how I re-use any of these code.
pastebin.com/y76rmQTU

jobs and better programmer are orthogonal

to get a job you need to be a braindead OOPsie, so i'd recommend no degree

to be a better programmer, math/cs

But you can learn OOP while in school

you don't need to go to school to learn how to be retarded

I agree, but with the additional condition that it has to be real CS, not a bunch of Java/C#/Python/similar masquerading as CS.

It's almost as if there are certain, dare I say, "design patterns" that are designed to foster communication between developers who may not have even met each other, by merely describing their code using a well-known protocol that clearly demonstrates intent while still maintaining the flexibility required to perform the task at hand

Design patterns are a crutch for deficient programming languages.

thats still not a reason to limit functions to 5 lines

fucking niggers update to 64 bit vectors

OOP has zero academic merit and should not be taught in universities.

design patterns exist
what you're saying is something to the effect of "atmospheres are crutches, I am a strong man who don't need no air"

I have no idea what Uncle Bob is and am merely emphatically stating facts

not really worth the extra memory usage, 32 bit is enough for most cases

indeed, when i did my CS undergrad it was mostly c++ and java in the first two years and a lot of "whatever lang you want" in later years

i hear they start with some lisp variant in first year now actually! which is cool, it seems things have gotten better. there's still a lot of java "how to OOP" bullshit courses but idk if any of them are mandatory

>finish python course
>done all the projects relatively well
>time to make my own program!

>completely lost and no idea where to start

Attached: images.jpg (225x225, 13K)

Should I preload all frames of a gif and then play them back or save them as the gif plays the first time and then switch to the saved frames?

I'm doing operations on each frame of the gif so preloading is nice but on large gifs you get a blank screen for a few seconds.

me

But user, if you break every function into five points or fewer then every function will be individually easy to understand. (Of course, the program as a whole will be incomprehensible because logic which should be grouped together will instead be scattered apart, and consequently you won't be able to see the wood for the trees.)

>>writes hundreds of useless unit tests
Oh I hate those people. Waste of breath.

>not finished
That’s ok. But you should make it it’s own method
>print the salary
Yeah, that’s the data
>asked by lecturer
kek
>don’t know how the code would be reused
If you were actually developing something like this for a real company it would probably go in a suite of other small programs.
As a side note, my teacher my taught me that if you ever copy and paste code, then you’re doing it wrong.
Also, what level of education and what was the lecture on?

Yeah, let the kids join your NEET circlejerker cult.

Attached: 1534821778527.png (1200x1400, 502K)

What do you want to do?

Also if I save them as the first loop rolls then the next playback loops can potentially be much faster as the processing can slow down the first loop.

Design patterns are not necessary in functional languages. The features inherent to such languages obviate them. Your attempt at an analogy is spurious. You're simply spouting more cargo cult nonsense.

functional programming is a design pattern

A program that gathers links and loads them into my download manager and only starts the next download when the first one is finished

No.

why are there always troll posts like this
are they all you? is it just a meme that everyone takes part in?

why would anyone post this if it were genuine?

there's ALWAYS a post like this, usually 2 or 3 per thread

>learned a thing / read a book/ whatever
>but im completely retarded so i can't do this basic thing

just why?

>As a side note, my teacher my taught me that if you ever copy and paste code, then you’re doing it wrong.
But, user, this piece of code is never going to be reused, it's just a part of an assignment, that's it.
>what level
Apparently, it's for masters. lmao.
It's not my uni, I'm just selling this for $100

Attached: 1386066922430.png (208x195, 18K)

Yes.

>Design patterns are not necessary in functional languages
Do you even know what a design pattern is
If you have a method of solving programming problems which you frequently use, it's a design pattern

>life without polymorphism
Must suck being a C/Gotard

Functional programming is simply programming with functions. To claim that functions are a "design pattern" is absurd.

>recursion is a design pattern
>variables are a design pattern
>addition is a design pattern

Okay break it down into a pipeline and work on it one part at a time.

>gathers links
What you (probably) want is a web scrapping library. Look up the popular ones for your lang.

>loads them into a download manager
Create a download manager class (singleton).

>only starts the next download when the first one is finished
Create a buffer. If you don't know what that is, look it up.

Half of being a good programmer is being able to relax, break down your project into small tasks that link to each other, and learning which concepts and libraries work best for your use case.

they're not design patterns, they're language features, design patterns are how you use those features
I thought you functional programmers were supposed to be smart

>never going to be reused
Alright, but you might end up like lol
>$100
You’re just fucking around, right?

>function application is a design pattern
Why are you so desperate for "design patterns" to be relevant? Are you incapable of programming without them?