/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Previous thread:

Other urls found in this thread:

yegor256.com/2016/08/15/what-is-wrong-object-oriented-programming.html
yegor256.com/2014/06/09/objects-should-be-immutable.html
yegor256.com/2015/03/09/objects-end-with-er.html
a.co/1CGYeIU
robmiles.com/c-yellow-book/
math.mcgill.ca/triples/Barr-Wells-ctcs.pdf
docs.oracle.com/javase/tutorial/essential/concurrency/immutable.html
twitter.com/SFWRedditGifs

Hey ladies

What's the best book for learning C#?

so much hate against OOP...
right or wrong, can anyone logically explain the reasoning behind this?

CMake modules are dynamic libraries that use dlopen or something instead of being linked in. Regular modules are a far superior alternative to headers and translation units (they get rid of all the duplication, they're not literal text replacement, they're often order independent).

It's a bad paradigm, that encourages bad practices , little ducky.

yeah, you say it's bad, but elaborate, please.

you can literally go to google and type "OOP bad" and get a million explanations

what is the best database for a novice to learn

The rationale behind that image is that the person who created it is a shitty programmer who writes garbage brittle spaghetti code that can't be maintained or modified.

yes. that's why it's funny. but unrelated to the question.

yegor256.com/2016/08/15/what-is-wrong-object-oriented-programming.html

What question?

PostgreSQL.

No, but I can explain the reasoning behind why you are asking this.

A: you are asking this as a person who does not understand Sup Forums internet culture.
B: you write mostly in some OO lang and you wish that people wouldn't make fun of you for it

>but elaborate
Where do you want me to start?
Writing code intended to fail?
Mutation everywhere?
Everything being a subset of everything?

thanks

go is a pile of poo

Oh, you're asking for the rationale behind the OOP hate. is a good start.

None of that is part of OOP or encouraged by OOP. You're either confused or just trolling.

Pure OOP enforces you to find over-complicated patterns, bloat and boilerplate for working around using pure OOP. This is where most of the OOP hate comes for. There is nothing wrong with using some OOP, where appropriate, together with mostly procedural code.

OOP is not bad because nobody can actually say what OOP is.

why

all i'm seeing in this link is more hate. but no real substance.
all opinion and conjecture.

Procedural programming is for amateurs, OOP is professional standard and practice. The problem with procedural programming is that, well, you cannot write procedural code well, because there's just no way to write good procedural code, it will always be spaghetti code however hard you try. Even if you write in a procedural language like C, a good program will appear modular, encapsulated and actually OO-like(just without classes and objects as C does not support these).

Procedural programming is good and only good for absolute newbies learning fundamental coding concepts(such as variables, conditionals, loops, etc), since starting directly at OOP can be tough for many non-coders. However, it's a bad habit that every good programmer should get rid of, or better, never develop in the first place.

To summarize, Procedural code = Amateurish, Spathetti, non-reusable and poorly designed/architectured code. Stop writing procedural code if you value your career, especially if you write in a language that supports OO natively, such as Java and C#.

Go is a good scripting PL replacement.

The third point is quite literally the essence of OOP. POO encourages mutation which creates a house of cards which requires extensive error handling.

Now are you a naive duck or just shitposting for (you)s

If you want some substance, just look at any non-trivial OOP code.

You're taking Java for OOP.

Compared to what?

I wish people would understand that mutation doesn't have to be side effecting imperative trash.

(You)
I just said about mixing procedural with OOP, so no I'm not.

this

also, OOP is only bad if the programmer is bad.

yegor256.com/2014/06/09/objects-should-be-immutable.html

1/10 for making me believe for a split second you were being serious

procedural code with functional elements > OOP everywhere

>I just said about mixing procedural with OOP, so no I'm not
Are you serious? Java is an unholy OOP+procedural mix mess!

You're posting children's cartoons so I can only assume you're underage and just straight dumb.

Next to no one writing POO is thinking about immutability. Immutability is still scoffed at as some FP nonsense by many people.

I like that you have to argue with random articles written by other people.

>procedural code with functional elements and compositional OOP elements > OOP everywhere
FTFY

As opposed to posting no arguments but only bold but false statements like you're doing?

Go home Pajeet. You're drunk.

>it's another episode of functionaltards storm /dpt/ to thrash OOP because they're buttmad over the fact no one in the industry takes their little toy paradigm seriously and it's used by virtually nobody outside of academia

What's wrong with having normal functions in an OOP language?
If it doesn't require any state and is useful for all kinds of objects, why would I implement it as a method?

Probably true, sounds reasonable but say I have e.g. this:

class ApiWrapper() {
int _authToken;
void authenticate(str username, str password);
Resource get(str resource_name);
Status post(str resource_name, resource Resource);
}

Is there a better non-OOP to hold structures like this that consist of both data and methods exclusive to itself?

You haven't disproved my points, and are only helping them.
Show me a largely immutable code-base in C++,Java or any other POO language with no explicit exception handling that uses OOP appropriately. Good luck.

I seems Sup Forums does not have a deep understanding of POOP

Java is hardly procedural. You can't decently decouple data from behavior.

yegor256.com/2015/03/09/objects-end-with-er.html

I'm not talking about immutability, I'm talking about mutation with something like linear types that doesn't break any nice mathematical properties.

>Show me a largely immutable code-base in C++,Java
The article I posted does precisely that. But you didn't read it because all you care about is trolling.

>They are not classes, and the objects they instantiate are not objects. Instead, they are collections of procedures pretending to be classes.
Shouldn't that also include -actory then?

>Java is hardly procedural.
You're joking, right?

You've probably never used the Java class library. It's riddled with static methods.

Please don't talk about a language you know nothing about.

Fine. I've never used Java.

We can tell.

that's not a code-base it was just an article.
But i realized that's the russian who make the cactus OOP book.
So you're probably that Kotlin shill, which explains the POO obsession

I'm looking for practical (and better) replacements for the above not some anthropomorphist story that has a hard time applying to any real code

One word: NEETs. It's easy to talk when the biggest project you've done is fizzbuzz. Would love watching these guys taking care of banking software, for example.

OOP is perfect for banking software

On a different note, does anybody have a good resource on unit with go? Out of the official docs, I can only find the package descriptions, which doesn't help much. What are some good ways to mock out things like databases and web requests?

>inb4 using go
I'm using it for one relatively small project in order to see what it's all about. So far my impression is that it's a neat language with interesting features, but assumes way too much and does way too much handholding. The project is also simple enough that I haven't really sumbled badly on anything like missing generics.

which book is this from?

>unit with go
Unit *testing

a.co/1CGYeIU

>a.co/1CGYeIU
thanks!

c++ is the greatest language of all time

C++ is at least 10 times as complicated as it needs to be

>Show me a largely immutable code-base in C++
Don't be silly. Immutable designs don't suit C++ at all.

C++ as a language is designed for doing some version of OOP without sacrificing too much runtime performance. Immutable data structures come with substantial performance costs as a side effect, and therefore have no place in most C++ codebases (outside some niche exceptions).

Appending to an existing vector data structure my_vector += other_vector is more efficient than constructing an all-new one based on two inputs and then throwing away the first two, my_vector = my_vector + other_vector. As long as this is the case (forever and always), immutable vectors have no place in typical C++ applications. const variables do, though.

if you're newish to programming
robmiles.com/c-yellow-book/

Otherwise, "C# in Depth" or "C# 7.0 in a Nutshell"

Why are functional shitters so obsessed with immutable code?

OOP is vague, and will be defined in such a way that suits the purpose of whether someone hates it or uses it. Most people understand that like any other paradigm, there are some "OOP" elements that can help, and you can also go overboard with dogmatic extremism (which also applies to NEETs who screech as soon as they hear "object").

autists don't like it when things change

>no more obscure mutation bugs
>RTEs dramatically reduced
>makes your code-base more enjoyable to maintain, as well as easier to extend/refactor

To be fair, it's nice being able to guarantee things not being fucked with as you pass them around. I'm pretty excited about the "in" parameters new to C# in this regard.

>>no more obscure mutation bugs
I don't know what you're talking about.

Perhaps you should make your heart immutable.

You should use Ada instead.
It had that for ages.

Most bugs that aren't logic bugs are obscure mutation bugs.
D as well.

>Most bugs that aren't logic bugs are obscure mutation bugs.
And what, the solution is killing performance?
No thanks.

It's obviously bullshit. By that logic, a Sin() or Abs() function should be called on an object.

>people ask him
>he has no answer
>post quotes

...

OOP lack fundament mathematics,making everybody had own version OOP.

math.mcgill.ca/triples/Barr-Wells-ctcs.pdf

Radians(0).sin()
Integer(10).abs()

makes sense to me

>By that logic, a Sin() or Abs() function should be called on an object.
float a = 1;
float b = a.sin();

What's the problem?

Head First C#

OOP hate is a meme. Even hard real-time systems such as Mars rovers are written with parts in OOP and they're far more critical than any of the worthless software OOP haters work on. These threads (board) are useless for any serious programming.

utility class like water, electrical etc classes at college?

Is ObjectiveC any good if you're not a macfag?

>the std libraries are bad practice
lol

How do I stop being mediocre and start being good

if you want to dabble around in oop just like use smalltalk its fun

Can two symbols overlap in object code?

No, I just want a fancier C.

Find an ambitious project and fail until you git gud.

The first version of objective-c was superset of C but objective-c 2.0 added gc.
If you want C with classes try ec or vala, though gnome said they won't continue developing vala.

Ada and D don't have many other things that I need from C#, though. And even things that might technically exist don't have anywhere near the first-party tooling and community support.

docs.oracle.com/javase/tutorial/essential/concurrency/immutable.html

CLOS does POP best.

>What are you working on, Sup Forums?
Porting HTML rendering from Go and TypeScript to C++.

kek

>inherit a class in sepples
>supper class functions "are not accessible"
I miss java

why did you switch to the inferior c++?