/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Previous thread:

Attached: qt_muslimah.jpg (775x775, 239K)

Other urls found in this thread:

open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0329r4.pdf
tour.golang.org
blogs.msdn.microsoft.com/nickmalik/2005/09/06/are-helper-classes-evil/
github.com/marshallward/marshallward.org/blob/master/content/avoid_util_classes.rst
web.archive.org/web/20121127215644/https://smart421.wordpress.com/2011/08/31/why-helper-singletons-and-utility-classes-are-mostly-bad-2/
stackoverflow.com/questions/3340032/utility-classes-are-evil
web.archive.org/web/20150502183649/http://www.jroller.com/DhavalDalal/entry/kill_that_util_class
web.archive.org/web/20120901175503/http://www.robbagby.com/posts/helper-classes-are-a-code-smell/
youtube.com/watch?t=12m48s&v=s-hdZZzMCac
yegor256.com/2014/05/05/oop-alternative-to-utility-classes.html
twitter.com/NSFWRedditVideo

Let's just all agree that from now on all our source code will be in C.

>check local job market
>90% of all offers are now C#

Has the whole world gone crazy?

sexually pleasing your mom

no. most places are jsut M$ shops because most mid/small businesses were sold M$ and M$ extensions.

it's just natural that an M$ language that doesn't suck so bad is the new in thing.

reminder oop sucks

please use an anime image next time

Attached: daily programming club.jpg (1280x720, 166K)

>OOP detractors are the same ones who like anime
Why am I not surprised?

Are you saying you'd rather see listings for Java, PHP, JavaScript, or C++? Or are you thinking it's too good to be true?
C# is a pretty good language compared to almost all the popular alternatives.

Because of how these ads are posted that's not a good measure anymore.
Find a site where you upload your resume and have people contact you/suggest jobs for you. They tend to filter spam better.

He did.

>he

>language
languages are not the only thing you should consider when building things...

>reminder oop sucks
t. using a web browser made with oop, likely using a file system implemented with oop concepts to store his weeb shit hobby.

yes. most of those have fully featured development toolings that are free and open source and aren't some freemium M$ licensed garbage.

>did

What's wrong with GLib?

Attached: 1502363515898.png (605x474, 385K)

Only people with little non trivial programming experience make blanket statements like (entire programming paradigm sucks)

It's possible to generate spaghetti code using functional programming / procedual / object oriented.

There are no silver bullets

benefit of using functional programming is making you look smart.

t. microshart evangelist

reminds me of the IOHK fag

OOP has largely fucked up the industry though. And even fucking webdevs are moving towards FP/FP-style code

>making
*thinking

WTF.
Someone explain me, please.

Attached: SalarySucks.png (747x502, 20K)

rust and sepples fags like to shit on it because it's written in C.
Some dumbfucks hate it because it's gpl licensed.
Some tryhards hate it because it aborts if malloc fails.

>global

Managers are paid more than their underlings. Period.
Also: Manager managers (managers who manage managers) are paid more than the managers they manage.
Manager manager managers are paid more than the manager managers they manage and by extension much more than those the manager managers manage.
And then there's CEOs.

Not that person but if you don't understand the problems with OOP and what it actually 'solves'. You can write that post in good faith. Anyone else would have enough nuance to understand that it comes from a perspective of individual programmers.
OOP is for big teams with unqualified programmers.
Because OOP doesn't increase your expressive ability much at all. But it does have tons of restrictions and guidelines that makes very large teams manageable. At great cost to productivity for individuals but it allows for scaling through spending money. It's way easier to spend more money than get people who are able.

Now I don't think it's a net win. Look at any major software package with huge development teams and their performance is underwhelming to say the least. Usually they don't keep their applications bug free from a user perspective even.

That's a very Indian perspective. My parents both earn more than their bosses two levels up from them.

What do they do?

Attached: 1450522274716.png (748x505, 587K)

Senior developers at their respective companies. Been there for 20+ years now.
I called it Indian because that's the work culture there. You don't find senior programmers there broadly speaking because they regard it as a failure to remain a programmer for so long. Both my parents get to hear that from the outsourcing team.

This is part of the reason why the turnover rates are so high.

>Indian
Got bad news bro
I'm American
The attitude here is that a corporation is like a royal court, and managers outrank the people they manage, and people of higher rank/prestige get paid more
Ever heard of an org chart?

Is there any reason to prefer C99 over C11?

Brb, becoming a senior developer.

Attached: 1434149790319.gif (200x190, 1.09M)

Compiling for platforms that don't have a C11 compiler. That's it.

guaranteed VLAs

void foo(void)
{
int bar[4];
int (*baz)[2] = &bar;
}
bravo C

arrays are just smoke, desu.
I'm surprised there's not a c flavor that removes array sugar.

what would be the point in that?

Better to have a C variant that makes (at least constant-length) arrays fully first-class.

to make C even more masochistic.

This.

i'm currently looking for some guides on how to write good, maintainable (python) software. what books or sites should i look into?

>designated initializers will be added in c++20
neat, for once C was useful

>My parents both earn more than their bosses two levels up from them.
this

management does not imply more money.

>can only initialize members in order
It's shit

where do you see that?

open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0329r4.pdf

When were they added to the draft? Not at this meeting from what I read

test

meh, you would always initialize a vector struct like {x, y}, and for other things just use a constructor

Sometimes you want to skip a member and you can define default initializer so for instance (some hypothetical instance that's not really useful):

struct Vec3
{
unsigned x = 0;
unsigned y = 0;
unsigned z = 0;
};

Vec3 v3{.x = 15, .z = 15};

You wouldn't need to specify y and it would be set to 0 although that's even more typing than just doing {15, 0, 15}.

Using Pharo Smalltalk.

It's a really nice platform to work with. It solves most of the issues I had with Smalltalk images. Both dependencies, sharing code, and version control works really well. Making high-level GUI's could be improved on a bit, but Morphic is a really nice low-level framework that your higher level code can call.

The main thing that annoy me would be things that are common to all Smalltalks, such as using classes and methods instead of Multimethods, and the high reliance on blocks that this leads to. But the platform is really convenient.

Attached: pharo.png (1366x768, 107K)

Has anyone got a learn golang guide? I like to jump in and start programming and google when i get stuck so something fast moving would be good

Attached: 013.png (1440x1016, 535K)

Daily reminder that Golang has a much stricter CoC than Rust.

I'm aware it's probably a cuck language. I still need to learn it.

Attached: 1519441546925.png (2048x833, 776K)

>guide
literally just keep their docs open and skim over when you need to figure out a minor syntax variation.

yeah but in C++ you can have full classes, you're not limited to POD

struct Fag {
Std gonorrhea;
bool pozzed;
Fag(bool hasGonorrhea) : gonorrhea{hasGonorrhea}, pozzed{false} {}
};

/dpt/!

Attached: 1490212703797.jpg (764x650, 182K)

what the fuck are you trying to do here?

testttt

Congrats! You've evaded your ban (for now)

tour.golang.org
also . the language itself is very small and easy to learn...

there are some other books for basic stuff

Ok guys.

Over the last year I've been self teaching myself Python. I can now do pretty much everything, it might take me a while but I'll figure it out.

When I mentioned that to my friends in the industry that I finally understand how to program, they just laughed and said "that's not programming"

So... I guess tl;dr:

>What makes you "know" how to program?

You could probably emulate that shit with templates, overloaded constructors and tag parameters.

I'm testing the Sup Forums-x feature where you can bypass the captcha a few minutes after posting
still wondering how it works, though. is it a bug in the Sup Forums code? do they reuse the captcha somehow?

for

Trigger warning: carpentry analogy

You know how to use Python. That is equivalent to knowing how to use a hammer and a saw

Your programmer friends know how to build furniture, houses, et.c.

Thanks

not the guy you're replying to but what is be all end all programming language? C? I'm complete noob though mind you

Missing the point.

There is none. Python is a pretty bad tool for building a house, for example.

>teenage Muslim woman
>the art of computer programming
Fuck off.

Attached: 12158598948.jpg (225x225, 9K)

Ahh fuck. That makes sense. What eventually brings you to the point of building the furniture? I can't even think about a project that would need to be that complex

What field do you want to be a programmer in? Gamedev, webdev, finance? Study the theory behind the field and try implementing it in an appropiate programming language

When building the furniture, you need to know an appropriate set of tools for sure, but you also need to know what materials and designs are durable, comfortable, affordable, feasible to produce, easy to repair, etc.

kernel, filesystem, game engine, compiler, etc

What is really better for building Android apps? The normie standard Java or should I dive into C for nerd street cred?

If the Kotlin shill in here is right, Kotlin is better than Java, and that's a terrible reason to use C (or C++). Depending on what you want to make it's probably even better to make it as a web app.

I want to try to build a capable sound manipulating app? Is such a thing even feasible with a smartphone or a tablet?

Question:

Why isn't there a language with both proper typeclasses and proper ML parametrizable modules? I get that they overlap a bit in terms of providing interfaces, but they have different capabilities.

Typeclasses are zero-cost abstractions and are less verbose when using instances rather than declaring them due to type inference. However, the requirement to not break type inference makes it very annoying to declare an instance generically in nontrivial cases, like automatically declaring that types that satisfy one interface satisfy another interface. You can't make a heap typeclass and automatically make all heaps foldable, and trying to do that will make people on the Haskell IRC yell at you. On the other hand, it would be very easy to do with proper modules.

OOP gained widespread popularity in the age where much work was being done on desktop GUI apps, client/server apps with native fat clients. Things like Delphi, Powerbuilder, Microsoft had MFC as its VisualC++ gui framework. Java had awt and later Swing. The whole industry was about how to slap together GUIs, with clients often working with databases directly, or with a very thin backend.

In that space OOP works well, since GUI components are stateful and have a clear programming interface and the state changes and invariants are not hard to figure out. It's also easy to see how saying that Button extends Component works well, since button clearly has properties of a component and is-a relationship is pure.

Later, in 2000s, we started seeing a large shift toward fat backends with a lot of data processing. That's where OOP becomes a less fitting paradigm which becomes obvious as classes start getting retarded names such as "StrategyFactoryBean" and utility static functions begin to multiply. It's just a function wrapped as an object more often than not. Data processing instead favors functional approach, but since people (including big conference speakers) are complete idiots, it took the industry 15 years to shift paradigm to match the needs of the software they were making.

The normie choice is often the safest choice. Really, it hardly matters. Most of the really valuable knowledge you have to learn is language agnostic, anyway. And when you've learned one language learning a new one becomes much easier.

Well, you have two big concerns with such a thing. The GUI and the sound manipulation "business logic". Web apps are the easiest way to do GUIs, but may be harder to integrate with a suitable audio library.

Function pointer

Looking for an overlay network like Tor,
that's available as an embedded C library.
It must support hidden services

>utility static functions
What you're describing is the very antithesis of OOP.
blogs.msdn.microsoft.com/nickmalik/2005/09/06/are-helper-classes-evil/
github.com/marshallward/marshallward.org/blob/master/content/avoid_util_classes.rst
web.archive.org/web/20121127215644/https://smart421.wordpress.com/2011/08/31/why-helper-singletons-and-utility-classes-are-mostly-bad-2/
stackoverflow.com/questions/3340032/utility-classes-are-evil
web.archive.org/web/20150502183649/http://www.jroller.com/DhavalDalal/entry/kill_that_util_class
web.archive.org/web/20120901175503/http://www.robbagby.com/posts/helper-classes-are-a-code-smell/
>Data processing instead favors functional approach
It does not. Functional programming makes sense in a machine-level context, like for writing device drivers. But functional languages add nothing new, they're just reinventing the dynamic programming concepts that started with OOP.
David West explains that in this interview (watch between 12:48 and 15:06): youtube.com/watch?t=12m48s&v=s-hdZZzMCac

Attached: redpill.jpg (333x499, 24K)

OOP does increase your expressive ability. Smalltalk is a very expressive language. Java on the other hand is not.

The ability to have the operation you apply depend on the runtime type of an object is very powerful.

On the other hand, I think that having classes and making methods different from functions is a very bad abstraction.

Multimethods like in the Common Lisp object system or Julia are a better way to do it imho. Since Multimethods behave just like functions, you can use higher order functions on them which is not possible with regular methods in classes. It's a much more natural way to combine object oriented programming with functional programming.

Also, Julia is a very good demonstration of how a good type system allows multimethods to interact with parametric types to make composition much more powerful than inheritance. If it also had row polymorphism like OCaml, it would be the perfect language.

>However, the requirement to not break type inference makes it very annoying to declare an instance generically in nontrivial cases, like automatically declaring that types that satisfy one interface satisfy another interface. You can't make a heap typeclass and automatically make all heaps foldable, and trying to do that will make people on the Haskell IRC yell at you. On the other hand, it would be very easy to do with proper modules.
I don't think that's a fundamental limitation. Orphan instances are the problem here, but you can forbid them entirely by forcing an instance of class C for type T to be defined in either the module that defines C or the module that defines T. That way, a generic foldable instance for any heap must be defined in either the foldable module or the heap module. Trying to implement both the heap and foldable classes would necessitate bringing in both modules, including the generic instance, and thus it can be statically prevented.

that analogy sucks IMO. lemme try to improve it:
I think the difference would be: you know how to use a hammer and a saw, know how to follow instructions and can to assemble pre-built things (furniture, houses, etc.), while your coworkers know the techniques used to build said things
in the end, it doesn't really matter much, unless you expect to learn deeply, only to make sure you can sustain yourself and are not expendable

also, you've only learned how to use a few tools, while there are many more tools for different purposes. for example, some of them can help you build houses much faster than with a hammer

>>utility static functions
>What you're describing is the very antithesis of OOP.
Exactly my point it's a code smell. Why are then codebases of java projects full of them? Because, I'd argue, it's a sign that OOP is being applied to a job it's not very well suited for.

Ah yes, all those device drivers written in OCaml and Haskell. How well they perform.

>elegant objects

Attached: rock oriented hunting.png (326x228, 33K)

>I'd argue, it's a sign that OOP is being applied to a job it's not very well suited for.
I disagree, I think it's a sign that OOP is being applied by inept software "engineers" (aka Pajeets) led by inept team leaders (that is, that lack a proper development methodology). I've seen this time and again, and I've become a strong supporter of the TSP (Team Software Process) and of small teams (5-10 developers) of very competent engineers, I've seen fantastic results with this combination. However, that's not how business administrators reason. They prefer quantity over quality, so they'd instead blow the budget by hiring a couple dozen Pajeets and having them do retarded Agile "methodologies". The end result is out there for everyone to see.

There isn't much software written in functional programming languages to begin with because it's a paradigm with a harder entry barrier. The lack of popularity doesn't mean functional programming is bad though, it just means most programmers aren't smart enough to do functional programming - which corroborates my thesis from before, those people aren't qualified to do OOP either, but languages like Java have a gentler learning curve and so any brainlet can get started on it.

yegor256.com/2014/05/05/oop-alternative-to-utility-classes.html
Ho shit that max class... The author didn't realize that he has just masqueraded a static method. This is the actual state of OOP. Code monkeys will always code monkey.

>giving a single shit about the openness of the language youre using to make your boss money

Isn't .NET open source and foundation and specification and whatnot?

I have a
private:
int variable;
in a class.

Can I only adress this variable from a function inside the class when i'm writing the body of said function inside the class definition?

It seems resonable thinking I should be able to adress it even when I'm writing the function separately (since the function is always part of the class).

Yes, but that's unnecessarily verbose.

What I want to do is have a given interface for my persistent heap, and write a generic foldable implementation for every persistent heap by repeatedly popping from the front. With typeclasses in Haskell, I have to copy-paste the foldable implementation for every instance.

>but may be harder to integrate with a suitable audio library
So should I dive into learning Java or C? How much of extra umpfh could you squeeze out of those devices with C?