[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 318
Thread images: 37

File: dpt_flat.png (102KB, 1000x1071px) Image search: [Google]
dpt_flat.png
102KB, 1000x1071px
Old thread: >>58870848

What are you working on /g/?
>>
>>58876553

does georgia tech have a good computer engineering program

I hear it is stupid man's MIT
>>
>>58876740
MIT is overrated.
>Memesnek as babby's first language
>>
File: hehe.png (291KB, 915x645px) Image search: [Google]
hehe.png
291KB, 915x645px
>>58876780
>mit is overrated

- some anonymous poster on a chinese cartoon website 2017
>>
File: Visible Confusion.png (28KB, 499x322px) Image search: [Google]
Visible Confusion.png
28KB, 499x322px
>>58876740
I never understand why people care so much about the university they go to, unless you're looking to get into serious academia any accredited university would do fine.

Most companies are more interested in your portfolio than where you got your degree.
>>
File: 1423121490835.png (258KB, 549x560px) Image search: [Google]
1423121490835.png
258KB, 549x560px
How do I write a program which will prove the genre of a given anime?
>>
>>58876874
Start with anime axioms, use one of those theorem provers.
>>
File: niggsect.png (406KB, 853x1224px) Image search: [Google]
niggsect.png
406KB, 853x1224px
Why did you guys tell me I shouldn't touch OOP?
Seriously, having objects with interfaces makes it better because then I can reason about my code with less effort.
>>
>>58876874

Genres only exist because of vox populi, for example a comedy is only a comedy because the majority of people agree it is a comedy. The Room would be labeled as such despite being intended as a serious drama. Authorial intent has no bearing on what genre something falls under.

You'd have to make some kind of web crawler algorithm that created tags based on the most common phrases people used in association with the title.
>>
>>58876990
https://www.youtube.com/watch?v=QM1iUe6IofM
It's a much better argument that what I can be fucked putting in a 4chan post.
>>
>>58876857

might as well go to a good one if you're gonna go to one
>>
>>58876874

train a convnet
>>
remember last thread when i was complaining about qt being hard to deploy

i was wrong, i didn't realize that i could just zip this entire folder and pass it along. it's just a little weird because my one window program is 13 megs zipped but whatever
>>
>>58876970
>theorem provers
Are they easy enough to learn if all I know is C and Haskell?
What set of initial axioms would you suggest?
>>58876999
I need a system which can actually be proven.
>The Room would be labeled as such despite being intended as a serious drama
I don't see why something can't have two labels, one for authorial intent and the other for how it's seen by most people.
>You'd have to make some kind of web crawler algorithm that created tags based on the most common phrases people used in association with the title.
This would certainly be part of it, but I need it to determine the genre based on some information and prove it as well.
>>
>>58877046
cute = moe
moe = shit
>>
File: Untitled.png (12KB, 892x368px) Image search: [Google]
Untitled.png
12KB, 892x368px
I'm trying to make a range/linspace function that does this. Basically as you increase or decrease some parameter, the points will be more clustered around the ends.

ex.
> range([0, 1], 4, my_parameter)
[0, 0.333, 0.666, 1]

> range([0, 1], 4, my_parameter - something)
[0, 0.25, 0.75, 1]


It should work for any endpoints and preferably the parameter should go from 0 to 1 where 1 has it as your standard range function and 0 gives you [a, ..., a, (b-a)/2 {if the number of points requested is even}, b, ..., b].

How do?
>>
>>58877046
>What set of initial axioms would you suggest?
Karen ∈ {x: IsCute(x)}
>>
File: 1450281446608.png (239KB, 708x537px) Image search: [Google]
1450281446608.png
239KB, 708x537px
I wanna program something, but I don't know what, any ideas?
>>
File: king pajeet.png (156KB, 1580x864px) Image search: [Google]
king pajeet.png
156KB, 1580x864px
public final class Integer // the class Integer is public and final
extends Number // this extends the class Number
implements Comparable<Integer>// implements Comparable<Integer>
>>
>>58877120
>I wanna program something, but I don't know what, any ideas?
Program to give you ideas to program.
>>
>>58877149
This. Don't forget to write a formal proof though
>>
>>58877046
You can't really mathematically "prove" a genre unless it has specific rules it follows like some sub-genres of music which is easier to do because music can generally be broken down mathematically.


I imagine you could theoretically make something that could reasonably guess what broad genre something was like if something was action focused or not but it'd be a pretty big accomplishment to get something that could tell the difference between say slice of life and psychological horror.

>>58877138
Some people really do enjoy using excel to make data sheets or w/e
>>
>>58877149
I could write a program that strings together 3-4 random compsci buzzwords together from a huge list, but I doubt that would end up doing anything other than give me a few chuckles
>>
>>58877162
>You can't really mathematically "prove" a genre
Why not? What determines whether or not I can do this? I don't see why I can't prove something using my own set of anime axioms.
>music can generally be broken down mathematically
Anime is just "music" plus video. So one part of it can already be "proven" so to speak.
>but it'd be a pretty big accomplishment to get something that could tell the difference between say slice of life and psychological horror
I think those are distinct enough. Proving different subsets of slice of life would probably be a lot harder.
>>
>>58877082
>cute = moe
this is mathematically wrong
>>>/r/abbit
>>
>>58877224
You never know

You know tarot readings actually work somewhat because it's just a form of meditation to help you tap into your intuition.
>>
>>58877138
i hope he's learning matlab or c++/c# in his spare time

[spoiler]R is a meme[/spoiler]
>>
>>58877224
> He doesn't already have one to generate his resume
>>
>>58877236
>Anime is just "music" plus video. So one part of it can already be "proven" so to speak.

So do it then

I'd be interested to see you try and break down a piece of anime mathematically
>>
Should I learn Clojure or Go?
>>
File: why go.jpg (25KB, 655x349px) Image search: [Google]
why go.jpg
25KB, 655x349px
>>58877285
>>
>>58877252
>transient multithreaded while unicode runtime system
>>
>>58877273
>So do it then
I think I eventually will when I learn more math. I'll start learning Coq for now.
>break down a piece of anime mathematically
Is this even necessary though? I don't see why you think that's the case. Or perhaps I'm misunderstanding the exact meaning you are trying to convey here.
>>
>>58877303
I've seen a lot of people shilling Go
>>
>>58877322
>Is this even necessary though?

If you're so fucking incessant on "proving" anything yes you need to do it mathematically.
>>
>>58877346
Well, I want to prove the genre of a given anime using my system. I don't understand what you mean by mathematically "breaking down" something.
>>
>>58877162
It'd be better to say you could break music down using music theory rather than mathematics. Granted, pure maths can get you far (FFT on a sound file, then train a net using the resulting frequencies is one idea).
>>
>>58877379
How the fuck else would you do it?
>>
>>58877379
computers work with numbers anon
>>
I can do anything with OOP, prove me wong
>>
>>58877483
Solve the halting problem with OOP.
>>
>>58877433
Good idea
>>58877469
Why would you need a computer to prove something using math? I plan on using one but it's not in any way necessary.
>>
>>58877497
halting problem is not programming
>>
>>58877507
Then be more specific next time :^)
>>
>>58877502
>Why would you need a computer to prove something using math? I plan on using one but it's not in any way necessary.

Because you need a computer to run a program

I mean you could technically write out all your code on paper but that wouldn't actually do anything.
>>
>>58877497
i actually did last night but with lambda calculus and in the process accidentally discovered a major flaw in lambda calculus itself. will post results this week.
>>58877507
are you stupid?
>>
>>58877523
>Because you need a computer to run a program
That's only an implementation detail. I really hope you aren't implying that I need a computer to prove the commutativity of addition for example
>I mean you could technically write out all your code on paper but that wouldn't actually do anything.
Did the mathematicians who lived before computers were a thing also somehow needed a computer? How does this make any sense?
>>
>>58877571
No you need a computer to run the program for the project you're attempting you purposefully dense piece of shit.
>>
THREADLY REMINDER THAT THE GPL SHOULD ONLY BE USED IN SECURITY AND PIRVACY-ORIENTED PROGRAMS AS IT'S TRASH FOR ANYTHING ELSE
>>
>>58877528
>i actually did last night
I hope you enjoyed all that wasted time.
>>
>>58877597
Reminder that the GPL causes massive butthurt and should be used for maximum lulz
>>
File: i've been waiting.png (5KB, 487x346px) Image search: [Google]
i've been waiting.png
5KB, 487x346px
Virtual machines are hard, time to wipe the dust off of WAMPVOIP.
>>
>>58877084
Solved with Bezier curves (the answer is always Bezier curves).
>>
>>58877601
why do you think it's wasted time?
>>
File: 1473603729478.jpg (98KB, 787x652px) Image search: [Google]
1473603729478.jpg
98KB, 787x652px
>>58876553
What is a proper cflags for ARM64?
>>
>>58877636
VM's are so easy on Linux and right now I'm taking an ethical hacking class (and cuz /school/ I have to use Windows.)

For the labs I'm supposed to setup a bsd router with a couple centos 5 boxes (an http server on one and a sql db on the other) serving up an outdated ecommerce app written in PHP, as well as a windows 7 "workstation" and then a Kali VM to run against the "router" which has the http server port forwarded.

Got off track but my point is i've tried both Hyper-V and VMWare Workstation and both of them are giving me weird errors, Hyper-V won't allow me to create virtual disks (gives me some kind of permission error even as admin) and VMWare tells me I need to do some hacky shit with EFI variables and what not.

KVM was so much easier sempai.
>>
>>58877860
this is embarrassing. please delete your reddit post.
>>
>>58877860
hyper-v requires a bunch of fucko ACLs, it's a bitch to do anything
>>
>>58877906
not sure why you are embarrassed but okay

>>58877913
Fuck Hyper-V

Turns out that by removing Hyper-V completely, at least VMWare now works.
>>
fucking Javascript man...
I've had to do some web stuff the last few weeks and you guys were right all along - Javascript is pure cancer
For example, why the fuck is null an object?
>>
I hate bash because I barely use it and every time I want to do something nontrivial I have to look up every little thing because it's so crufty and there's like 10 different ways to do everything.

Also, rate my nano wrapper~
it opens a file at the line number of the first occurrance of a search string

goto() { echo "+$(grep -n -i $1 $2 | head -n1 | cut -d: -f1) $2 "; }
num_args=$(($# / 2))
args=($@)
expand=()
idx=0

for n in $(seq 1 $num_args)
do
expand+=$(goto ${args[$idx]} ${args[$idx + 1]})
((idx += 2))
done

nano ${expand[@]}
>>
>>58877906
you are not deceiving anyone
>>
>>58878064
i-it is? thank god I only program in C
>>
>>58878083
quote: deceiving
about what exactly?
>>
Will Rust and Go really replace C/C++ one day?
>>
>>58878195
what's so great about Go?

If it wasn't google backed would anyone care?
>>
>>58878215
It's basically C but they fixed everything wrong with it, also it has a garbage collector.
>>
>>58878195
Rust could very well do it. Go, never.
>>
>>58878221
it also has no pointer arithmetic and refuses to compile if you have unused variables or functions.

It's literally made for retards.
>>
File: 1486684107443.png (511KB, 836x964px) Image search: [Google]
1486684107443.png
511KB, 836x964px
>>58878225
>Go, never

But why
>>
>>58878253
No manual memory management.
>>
>>58878195
No, HolyC will replace all these programming languages appealing to the nigger cattle soon.
>>
File: 1469991616584.jpg (254KB, 1920x1080px) Image search: [Google]
1469991616584.jpg
254KB, 1920x1080px
>>58878253
>bratposting in my /dpt/
>>
File: 15826138.jpg (25KB, 480x634px) Image search: [Google]
15826138.jpg
25KB, 480x634px
>>58878195
Rust will replace C++, not C itself.
Golang replaces Java and C#. They are not competitors


Also
>>58878265
https://deferpanic.com/blog/manual-memory-management-in-go/
>>
>>58878195
C/C++ will never be replaced in earnest unless a new OS from the ground up debuts.
>>
>>58878195
>>58878225
>>58878510

Eww

http://benchmarksgame.alioth.debian.org/u64q/rust.html
>>
can someone give me a basic gestalt on why I would want to use an abstract class with all abstract methods vs an interface?
>>
>>58878582
In most OO languages you only have single inheritance so you should use interfaces whenever possible.
>>
>>58878554
>>
>>58878607
A lot of whining
>>
File: 15822597.jpg (5KB, 370x334px) Image search: [Google]
15822597.jpg
5KB, 370x334px
>>58878554
C is the most unproductive language aside from assembly. Plus it's broken by design. The only reason why C took off is because there were no better alternatives in the 80's.

The creators of UNIX got sick and tired at C and then created golang.
>>
>>58878554
All of these benchmarks are number crunching.

>>58878607
Rust does a ton of checks statically that Ada needs to do at run time.
>>
>>58878607
>Even something as simple as integer math produces unexpected results. 20,000 + 20,000 is a negative number.
Don't use signed shorts then?
>>
>>58878607
ENTER KEY?
>>
>>58878554
Really?

Assembly is faster than C
EWW
>>
There is nothing in C that prevents a program from scribbling on random bits of memory. This is a task left to the OS, which must sandbox processes to maintain memory integrity. This works, however it makes interprocess communication much more difficult than necessary, leading to byzantine systems such as CORBA. Plus typing is barely enforced in C, encouraging poor design.
>>
>>58878644
>most unproductive language

You can be productive in any language if you've used it enough and understand how to work with it. Contrary to what hacker movies and tv shows tell you, most time spent programming is time thinking, not time typing.

The creators of UNIX got paid by Google to create a language pajeets and new grads could understand and then created golang.
>>
.software TLD for new company?

seems unpretentious, unlike .io
>>
>>58878607
>exception handlers are totally optional in C
wtf is this goof on about, exceptions aren't even part of C the language, unless you add them in yourself (which is a popular learning exercise) - so saying the handlers for exceptions which don't exist in the language are optional seems like a bizarre mismatch between his mental model of what C is and the reality of C
>>
>>58878723
>most time spent programming is time thinking,
Yes, thinking how to implement an algorithm in a featureless deprecated language.
Then spend the equal time in making it safe because C has no concept of memory safety.
>>
>>58878749
C is fine given you admit it shouldn't be used for 90% of what it's being used for now
>>
>>58878651
>All of these benchmarks are number crunching.
True, I was having a think about this the other day. We need more benchmarks that exercise memory usage, or in the very least the use of more complicated data structures with depth and breadth to them. Would be very interesting desu ne
>>
>>58878723
Educate yourself before you project your insecurities onto pajeets.
>>
>>58878785
what is C even used for now?
Drivers, Kernels, Compilers.

Very "basic" to the point stuff.
>>
>>58878785
C is an ancient relic whose incredibly solid design at the time has kept it alive for decades. The first thing you do with any new architecture is make a C compiler for it. Maybe the LLVM backend for Rust will start to inch in on that space.
>>
>>58878857
what do you mean? Rust already has compilers and those include GCC too
>>
>>58878759
>featureless language
I guess you could make the tradeoff to working in an equally featureless language that has a garbage collector and dares call itself a systems language, or you could go full SJW in Mozillalang. Or you could go back to javascript, if that's what you want.

>spend time doing things in C that you do all the time in C and that an experienced developer would be used to doing in C
God. Fucking. Forbid.
>>
>>58878828
>Believing tech marketing hype

I bet you still use Mongo too. It's web scale!
>>
>>58878924
>full SJW in Mozillalang
Do you have any objective criticisms of Rust or just memes?
>>
>>58878924
look how butthurt this 14 y/o got
>>
>>58878942
Somehow it ingrained into these low IQ preteens' heads that Rust or Mozilla is against FOSS.

Ironic how Mozilla publishes the best FOSS web browser.
>>
>>58878951
>14 y/o programming in C

Look at how out of touch this neet neckbeard got
>>
>>58878909
Yeah but will that be used, hard to say. C is ingrained in the mentality of a lot of the low level gurus. LLVM has a lot of targets already, and growing, and Rust can use those targets, very nice.
>>
>>58878967
This is sad
1. Microsoft shills start spreading FUD and memes about Mozilla and Firefox 24/7
2. Kids of /g/ get exposed to it
3. Gets used to irrational Mozilla hatred, when asked for real reasons get insecure
4. >Pajeet XD
5. >SJW XD
Current state of /g/
>>
>>58878983
I guess you are stuck being a 14 y/o in the head
>>
>>58878998
There are at least 3 Mozilla/Firefox hate threads made every hour in /g/. These start off as a FUD. When debunked, shills quickly resort to muh SJWboogeyman insecurity.
>>
>>58878998
>Microsoft having any vested interest in a language that competes with Rust

Go on. This is an interesting theory. Is it C#? VB? Which Microsoft language is the competitor?
>>
>>58878967
>Mozilla publishes the best FOSS web browser.
By what metric
>>
>>58878998
sorry but getting major features like multi-process and proper sandboxing TEN YEARS after goddamn internet explorer isn't acceptable, i don't hate firefox but mozilla deserves all the criticism they get
>>
>>58879059
Remember that influx of C++ haters?
Remember how they suggest C# instead?
>they
I mean "you".

Get over it. C# was just a rebranded Java. Rust eliminates the problem that exists in C++
>>
>>58879015
Cool argument bro. I'll pray for a quick cure for autism for you. Much love.
>>
File: unknown2.png (180KB, 255x309px) Image search: [Google]
unknown2.png
180KB, 255x309px
>>58876553
Playing with Pygame for fun, cooked up this little arrow key drawing program. Arrow keys move the square, equals key and minus key turn the paint streaks on or off, enter key fills the entire screen with the colour you currently have selected, and the r, g, b, w, y, and n keys change your selected colour. I'm still pretty new to programming.

http://pastebin.com/dfr2DvSN
>>
File: 1486245487926.png (145KB, 500x500px) Image search: [Google]
1486245487926.png
145KB, 500x500px
>>58879094
Hit your nerve, didn't I? Here is a friendly anime screenshot
>>
>>58879098
>I'm still pretty new to programming
we can tell
>>
File: tinfoil hat.jpg (14KB, 210x240px) Image search: [Google]
tinfoil hat.jpg
14KB, 210x240px
>>58879085
So your answer is... Microsoft is trying to discredit Rust to make C look more appealing, so that people will program in C++, and then get shilled into C#?
>>
File: 1477071822201.gif (1MB, 500x522px) Image search: [Google]
1477071822201.gif
1MB, 500x522px
>>58879104
this is an akarin thread. please refrain from posting shittier yurus
>>
>>58879125
>exposed
Jesus christ are you pretending to be dumb or are you that WPF shill that Microsoft hired this month?
>>
>>58879129
>>58879104
that show is really boring
>>
File: god_bless.gif (1MB, 360x270px) Image search: [Google]
god_bless.gif
1MB, 360x270px
found something to do between lines of code


as for the file name, I was trying to be as non-cheesy but still respectful as possible. The style isn't really saying "reverence" but I supposed homage can be paid in other respects. Imma shut up.
>>
File: inception.jpg (11KB, 637x265px) Image search: [Google]
inception.jpg
11KB, 637x265px
>>58879139
I'm legit trying to figure out why you think Microsoft would want to discredit Rust and encourage people to use C. Your whole answer was about shilling hatred for C++ and encouraging C#, and then you say that Rust is better than C++, but nothing about C.

The only conclusion I can find here is that you believe that C is a gateway drug to C++, which Microsoft wants to shill people away from using to get them to use C#, and so Microsoft wants to discourage people from using Rust, and push them into using C, so that they can make a transition from C to C++ to C#. Is that what you're saying?
>>
File: 1486359357186.png (395KB, 960x955px) Image search: [Google]
1486359357186.png
395KB, 960x955px
>>58879172
you're really boring
>>
i want to build my portfolio, but i have no idea what to program. how do i get inspiration? i don't want to explicitly ask what to code (i guess suggestions are welcome tho) but how do i get ideas myself?? wat do
>>
>>58879286
program your way from your most annoying keyboard command and setting to the easiest and most comfortable.
>>
>>58878195
Why not D?
>>
>>58879286
program things you'd actually use
>>
>>58879314
with the intention of being lazy, having nothing better or with the intention of moving myself up an order of magnitude as far as things i would or could do on the ready?
>>
>>58879311
once it loses its GC, it'll be top-tier
>>
>>58879286
http://www.wikihow.com/Be-Creative
>>
D is the semi autist that tries to fit in but is always the odd one out.
>>
>>58879319
find shit you do often that can be automated
>>
>>58878845
But all very necessary stuff, no?
>>
>>58879206
Are you implying that C is NOT a gateway drug to C++?
>>
>>58879320
You can not use the GC though
It's safe if you're an idiot, and versatile if you're not. It's actually perfect.
>>
>>58879314
what if there's nothing i need automated? am i just using computers wrong
>>
>>58879426
>am i just using computers wrong
probably
>>
File: mary_maybe0001.png (1MB, 720x480px) Image search: [Google]
mary_maybe0001.png
1MB, 720x480px
I have no clue what to make right now so I'm drawing streamers.
>>
>>58879059

>Which Microsoft language is the competitor?
Rust's primary competitor is C++. Microsoft doesn't own C++, but it is a major C++ compiler vendor, and has a vested interest in it being the primary systems language of choice.
>>
>>58879775
make a program that simulates enjoying life
>>
cmath

or

math.h?
>>
>>58879858
cmath
math.h is the C header, cmath is the C++ version
>>
>>58876828
as someone who went to mit let me tell you the first year cs course has been fucked. Removal of sicp yet having partial reliance on it, no set text book and pleb tier profs wasnt as great learning experience as i expected for 90k / year (int + boarding)
>>
>>58877004
>java
just use c++, its an actually good oop language.
>>
>>58879884
It's not.
>>
>>58879874
>paying 90K/yr for college
holy fuck
>>
>>58879917
that was mit for me. in the end it was worth it i feel, but you could learn most of this stuff at other local universities.
>>
>>58879874
> He spent half a million dollars for an undergraduate
>>
>>58879907
Why? It's not as OOP out of the box as Java, but the onus is on the dev to utilize the features to make good OOP design.
>>
>>58880020
>OOP
>good design
top zozz
>>
File: OOP? more like POOP.png (12KB, 767x360px) Image search: [Google]
OOP? more like POOP.png
12KB, 767x360px
OOP? More like POOP!
>>
>>58879954
the actual degree was like 219000 im just including other costs
>>
>>58880052
The majority of all software is written in OOP or partial OOP outside of embedded stuff (and even that is slowly changing).

OOP is a tool, any tool used badly is going to be a piece of shit.
>>
Today I am going to try to learn how to use C++ to edit tags on a file. Have to read about Windows' property system.
>>
File: d-color_4.jpg (35KB, 600x600px) Image search: [Google]
d-color_4.jpg
35KB, 600x600px
What's the comfiest way to store 4 ints together (RGBA)?
If I was using OpenGL, I'd use glm::ivec4, but I'm not, so it doesn't make much sense to use GLM at all.

(picrelated is one of the things i found by googling "rgba"...)
>>
why is
''.join
not the default yet?
>>
File: trump_wall.jpg (516KB, 3360x1396px) Image search: [Google]
trump_wall.jpg
516KB, 3360x1396px
I'm working on an artificial intelligence deep neural network hi tech wall on the Mexico border for the USA.
>>
>>58879385
the other way around
>>
>>58880089
TWO HUNDRED THOUSAND DOLLARS

FOR AN UNDERGRADUATE DEGREE
>>
How do I parse a web page in C
>>
>>58880211
yes, foreigners have to pay more than americans to attend american universities
>>
If i have basically all the knowledge you could get from an undergrad degree is there a way to just do the tests and get the degree?
>>
What's a good method for HTTP GET/POST in C++? No libraries, please. On a metered connection and I'd like to avoid downloading necessary files if necessary.
>Can't build libcurl
>Can't get boost to work with codeblocks

Could I use Python to acquire and post data? I've considered using VBscript to get/post for me and parsing it through a file..

It's for my personal webserver/computer. Security isn't an issue, however being somewhat efficient is.
>>
>>58880293
That's not how educational system works. You don't study to solve tests or even gain knowledge (a large portion of which you're never going to use anyway). You study to prove that you're a functional member of society who can survive monotonous work and overcome challenges along the way, most of them not related to your subject.
>>
>>58880327
>No libraries, please.
Well, you've limited yourself to "roll your own".
>>
>>58880327
well pal, your only choice now is to rev up those berkeley sockets/winsock and get to work creating a redundant library because you were too stupid to build curl and too stupid to not use codeblocks
>>
>>58880260
nigga, you don't pay that much money for education regardless where you're getting it

>>58880293
do you know how to compose papers, analyze literature, analyze history, give speeches, speak any foreign languages, do any hard science, and other shit?
because that's what's involved in a college degree. I wish this wasn't the case, but you'r better off getting certified
>>
>>58880432
>do you
yes (and a big dick too)
>>
>>58880327

>no libraries please
C++14 does not have any built in libraries for networking, let alone using HTTP methods. Though there is a plan for networking in C++17, currently, you would need to use non-portable system libraries to do anything networked, and that will just give you TCP sockets, not the HTTP stack.

>Can't build libcurl
What errors are you getting? How are you attempting to built it?
>>
>>58880512
>and a big dick too
post boi dick pls
>>
File: fragezeichen yui.png (94KB, 396x395px) Image search: [Google]
fragezeichen yui.png
94KB, 396x395px
I'm writing a scheme function that will take a string with two arguments, and wrap the string in those two arguments. Which do you think makes more sense?

(wrap front str back)


of

(wrap str front back)


The former is more visually obvious, but the latter is easier to compose with, say if one wanted to
(apply wrap (list arg1 arg2))
>>
>>58880683
It's going to be a part of a program where text in the terminal is formatted according to user-specified string-manipulation closures, which is why I'm asking. If it were just squirreled away in my own code, I wouldn't care.

I'm leaning towards the latter because if I figure anybody is taking the time to use a program with a lispy config file, they'll be onboard with lispy conventions.
>>
>>58878195
C/C++ is undefined behavior
>>
>>58880166
Depends on how you're gonna use them.
>>
In C++ if I want to have a hashmap store multiple values for the same key, would it be better to use a multimap, or a regular map that stores a vector of values?
>>
i'm coming over from java and trying c++ but my stupid simple hello world program isn't even compiling! I checked for the semicolons and stuff but it still isn't working. any help?

#include <iostream>;

using namespace std;

public class HelloWorld {
public static int main(string args[]) {
cout >> "Hello world! :3";
return 0;
}
}
>>
How do I know if my hash function isn't shit?
>>
>>58880873
please, anybody?
>>
What's the best market to make shekels? Apple App Store or Google Play Store?
>>
>>58880887
Based on how many collisions it produces.
>>
>>58880873
>reading from cout into string literal
>main is all fucked up
>putting it into a class
DELET
THIS
NOOOOOOOOOOOOOOOOW
>>
Can php be defined as a programming language my teacher says yes, but I'm a bit sceptical. What do you think guys?
>>
>>58880873
1. You end program instructions with a semi colon, not the shell commands.
2. Don't run it the way you would a java program. The class isn't necessarily public until you've declared it within another class. Until then it is just a static class being called from the global scope.
3. Keep main out of the classes, I'd say. Execute the whole program as a practice run. I think it fits test driven development practices better.
>>
>>58880089
Jesus I thought my 50th Australian education was a rip off.
>>
>>58880933
>>58880972

i was told c++ was oop? a method has to be part of a class dudes. also there's no "shell" commands in my code? i'm so confused, can you guys pls just give fixed for me to use so I can compare and contrast. it's what my java tutor did.
>>
>>58881021
>i was told c++ was oop?
C++ is a multiparadigm language.
>a method has to be part of a class dudes
"main" does not have to be a method.
>>
>>58881030
>"main" does not have to be a method
but it does nigga
>>
I'm finishing up an in-place implementation of Timsort (in C).
>>
>>58881067
post saus
>>
>>58881061
Methods != functions
>>
>>58881030
how can c++ be oop and other paradigms? is it like multiple inheritance for languages? so if main doesn't go into a class where does it go? and what do I call it? sorry for the questions
>>
>>58881116
>how can c++ be oop and other paradigms?
It combines object-orientation with functional programming techniques and many metaprogramming concepts, as well as some elements from declarative programming and dynamic programming.
>>
>>58881021
I'm sorry but I'm going to have a hard time explaining this stuff to you if you can't understand that the differences in all the programming languages and compilers and all dat shiiiiieett is...logical! You have to understand that you will be going along a different set of thoughts than those most intuitive to you. People and yourself will be referred to differently. You will have to learn to think as a thing without a body. Or at least speak as if.

Having said that, oop does not mean you cannot do things any other way. A C program is compiler as a header file and the code source file. That means that the in the header you can have the classes and functions and that come time to use the classes and functions themselves you will still have the option to make a whole new .c file where you have your regular int main(){} and have it call the classes and functions you've made in the the other files.

A method is called a method or a member rather than a function when it is part of a class. "A Class of object functions over object related kinds of data using this method."

Anything in a c file that # before it a pre-processor directive, or otherwise known as a shell command to be made before it is passed through the compiler entirely as a compiled.


If you're confused just go back and talk to your professor. This whole thinking things over differently doesn't stop there. You will have to obey all those rules you learned to hate because they weren't cool or because grammar nazi.

>>58881116
c++ isn't anything. C++ is C++. C++ can be used in a ___________ manner as understood or taught through the paradigms for programming.

It's more like people read this code rather than things that just execute instructions. There are people reading this code at some point. Whether it's just you reading your own code or someone else reading your code, the differentiation helps figure out larger schema like data structures and enumeration over large scale algorithms.
>>
>>58881116
main doesn't have to go in a class, but main is always a function as far as I know.

what happens at compilation is that all the instructions are taken care of, created or what have you, and then the iterator goes down the stack and looks for the function main and executes from there. The name main makes it easier on the compiler to do what it does despite all the different opinions and facts we may have about making proper computer programs.

The different paradigms help us plan for a full environment, a single pass environment, a file system, a rom, etc. Instead of always approaching it as, "I'm going to feed this thing a dollar and it's going to drop a soda out of the chute" paradigms let us program in a way that describes that same process as "this thing is going to access my bank account using just my favorite foods and stores while I run away from the cctv system that actively seeks ME out based on parameters that were used to suss my bank account without using my name."

Paradigms help us pretend things are actually a whole other way so that we don't have spend time explaining these things to people like...well...you. *<L:D


Still, we all do what we can. So why don't you do us the favor and make sure you put to use what we share with you.
>>
>>58881081
I will once I'm done, should be this weekend.
>>
>>58881254
*also it's part of my MSc thesis with some novelty since no proper (galloping mode and all) in-place timsort implementation exists
>>
>>58881125
>>58881182
>>58881223
i only understand maybe 10% of what you all said. and i'm implying a lot of meaness from you words like my friend said you would. also i don't have a professor anymore because i wanted to make games and heard c++ was good for that so I dropped out two weeks in. I wish i didn't though now because java makes more sense than c++ and it easily works. anyway i think i'm going to ask somewhere else like reddit or google. thanks for helping though I guess
>>
Learn Haskell
You can then use PureScript to write frontend Haskell
>>
>>58881125
>dynamic programming
>Dynamic programming is a language paradigm.
Yeah, you don't know what the fuck you're talking about.
Dynamic programming is a way of trying to solve "hard" problems in polynomial time through memorisation.
A programming language does not "support" this.
>>
A sopcast player with channels list and a chat
>>
Wanted to practice C and make one of those programs that draws a sprite over a window. How should I go about the drawing part?
>>
>>58881302
>A programming language does not "support" this.
It does. Try doing dynamic programming in contract based programming language such as Eiffel.
>>
>>58881327
Use SDL2 or something similar.
>>
>>58881283
If you can't handle hostility, why are you even on the internet at all faggot?
>>
>>58881342
>I am a sexually frustrated angry virgin and I take the anger I have at others so internet must be like that
lol
>>
why type classes matter

http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.99.8567&rep=rep1&type=pdf
>>
>>58881302
>A programming language does not "support" this.
You can say the same thing about object oriented programming, anon. C can be used in an object oriented fashion. It's a shitty object oriented programming language, because you have to declare inheritance dependencies explicit using either composition or super pointer, and you have to implement virtual functions manually, but you can do it.
>>
>>58881355
At least that explains why I am on 4chan. Why are you, if you're supposedly so well-adjusted?
>>
>>58881371
I am not well adjusted at all, though I had my fair share in high school and this year. I'm just saying nobody has to tolerate your emotional issues buddy, seek therapy
>>
>>58881390
You're acting like a moron on the internet and I'm simply calling you out on it. I do not need to "seek therapy", YOU need to learn how to look simple stuff up on Wikipedia instead of going to a bunch of online forums dedicated to programming and asking people to cater your needs, and then get upset at them because you are unable to understand what they just explained to you.
>>
>>58881283
Africa, my friend, bruh?

I have no clue what you expected and why it is so loud regardless. None of what I said was mean at all. I just don't call them small ones or big ones. Yes, that will be a problem. No, you shouldn't give up. Just stop thinking that I'm here to make it yours. I'm here because I like to be here. You're here because you want free stuff. I can't code for you if you're trying to learn. It defeats the purpose. I'm not sorry you couldn't take the time to ask more questions. Thank you, bye bye.
>>
>>58881403
Please no juju bully
>>
>>58881400
>thinking I am that dude
lol
dude obviously had trouble grasping whatever on wikipedia and asked for a simpler explanation, it happens in programming which is not the easiest subject to absorb, it's kind of sad I had to explain this to you, it's a good thing your parents are willing to take car of you and that there's welfare
>>
>>58881342
i only came here because my friend mentioned it. i don't even know why he browses this hole of negativity after experiencing your guy's rudeness and inabiltiy to fix my code so i can see where i went wrong. and from browsing around here it seems you guys just find ways to be angry about things and people. i went to the video game forum and I saw a lot meaness too... and porn.
>>
>>58880887
It is, just use one that a smart mathematician has developed instead
>>
>>58881423
None of the responses you got were hostile or mean or unfriendly/

>>58881420
>dude obviously had trouble grasping whatever on wikipedia and asked for a simpler explanation
Simple wikipedia exists. Stack overflow exists.

> it happens in programming which is not the easiest subject to absorb, it's kind of sad I had to explain this to you, it's a good thing your parents are willing to take car of you and that there's welfare
I have a job as a programmer, I'm not here to cater fucking high school dropouts who can't handle the response I gave them.
>>
>>58881420
>>58881423
>>58881390
>BUT MUUUUH FEEEEELINGS

Go cry elsewhere, discuss programming or leave.
>>
>>58881364
>super pointer
m8...
>>
>>58881438
looks like he succesfully trolled you>>58881423
ok you exposed yourself now little faggot, good bait tho
>>
File: pretending.png (2KB, 244x226px) Image search: [Google]
pretending.png
2KB, 244x226px
>>58881452
Yes, le ebin trole. Totally got me.

Fuck off or discuss programming.
>>
>>58881461
Lol I hope thathelps you get over falling for obvious bait anon
>>
Holy shit you guys got baited hard.
>>
>>58881423
You should let girls tell you about websites they've heard about and stay on there. The wild wild west of the internet has proven to have been too much for you, my boy.
>>
>>58881481
lol not going to lie he was really good
>>
Why would you be a do-gooder and release your code under a GNU licence?

Why not try make money with proprietary software?

Yes, you could technically make money with GNU software, but realistically speaking, you can't.
>>
>programming in your free time

for what purpose?
>>
>>58881667
Programming is fun, anon.
>>
This blue website keeps trying to get me to use Rust
>>
File: 1475216992907.png (62KB, 774x618px) Image search: [Google]
1475216992907.png
62KB, 774x618px
I'm making a simple toy VM that has no assembler for it yet, so I hijacked nasm.
>>
>>58876874
That's believed to be NP-complete.
>>
>>58881661
Because I don't have the marketing or business skills to be able to sell a product and at least if I put it up online I get good boy points that go towards interviews.
>>
File: 1464765802193.png (79KB, 846x783px) Image search: [Google]
1464765802193.png
79KB, 846x783px
>>58881786
Free label support
>>
>>58881661
The effort + payout of trying to sell it < joy of seeing someone else use my code
>>
>>58881661
Why do you space your code like that, redditor wincuck?
>but realistically speaking, you can't
Plenty of people make money off of GPL code.
Lots of projects have GPL "community version" and a paid "cuck" version.
And even then, there are things like Synergy which is just GPL, and they still sell their product.
I even bought the damn thing.
>>
>>58876553
can anyone recommend me a good coding language to study so I can get a good paying job? I just want to get a certificate.
>>
>>58882027
>I just want to get a certificate.
Java and C#.
>>
>>58882039
thanks based anon
>>
>>58881976
>paid for synergy
>calls other people cucks
>>
>>58882104
I am well-aware that I could acquire it for free, legally.
I chose to buy it. It's a useful piece of software, I am able to afford it (it's not like it's particularly expensive), and I like their business model.
I now have a program that I am able to inspect, and am legally allowed to modify and distribute to others.
>>
File: hOYUcMr.jpg (512KB, 2448x3264px) Image search: [Google]
hOYUcMr.jpg
512KB, 2448x3264px
Sup /dpt/, I need some basic C++ OOP help.

I have a Shape class, it has some attributes that its children also have. Class Rectangle is derived from the Shape class, and it has some attributes that Shape doesn't have. Similarly, there are also classes like Circle, Line, etc.
I have a
std::vector<Shape*> shapes;
. In this vector I have several different instances, all of them are created from classes that are derived from Shape.
When I run
for (Shape *s : shapes) { . . . }
and try to access attributes of Circles or Lines, the compiler tells me that
class Shape has no member named . . . 
. Of course, Shape doesn't have those members, but a child of Shape does.

I'm clearly misunderstanding something about OOP. What am I doing wrong?
>>
>>58882131
>class Shape has no member named . . .
Are you incapable of reading or something?
>>
>>58882131
You need virtual methods that child classes implement/override to do something more specific with their added information.

Alternatively you don't put all the objects into the same vector.
>>
>>58881661
>you could technically make money with GNU software
you can't
only way to make money is to offer support for your software, aka pajeet tier.
>>
>>58879954
Half a million = 500K
> He spent half a million dollars for an undergraduate
90K = 500K seems legit
>>
>>58882211
Are you?
>Of course, Shape doesn't have those members, but a child of Shape does.

I'll give a concrete example with a Circle (types of shapes are stored in an enum ShapeType).
for (Shape *shape : shapes) {
if (shape->type == ShapeTypes::Circle) {
printf("Radius of a circle is %i", shape->radius);
}
. . .
}

Whenever I do something similar in my code, it tells me that Shape doesn't have a radius. Of course, why would all shapes need a radius? Only Circle needs one. So the class Circle has it, but I can't access it through the iterator. Even if I use auto instead of
Shape *s
.

>>58882246
>Alternatively you don't put all the objects into the same vector.
Yep, I guess I'll have to go with that. I was hoping for a better solution, though.
>>
>>58882301
>Shape doesn't have those members
Then Shape doesn't have those memebers.
It's a fucking parent class or whatever. You can't just use shit specific to one of its children classes.
OOP really was a mistake.
>>
>>58882301
If you want a way to calculate radius for any shape then you put it in a virtual method. Conceptually that's the same as what you have there except it actually works. What you have would work if you implemented it as a tagged union of different kinds of shape, but there's an organizational difference (closed vs. open system).
>>
>>58882301

lrn2visitor, kid

http://laufer.cs.luc.edu/teaching/313/handouts/practice-midterm (it's in Java, but you get the idea)
>>
>>58882351
>"""""Design patterns"""""
Kill yourself, my man.
>>
>>58882362
Haha I'm sorry, I forgot I was on 4chan! Sorry for being unironical for a second, anon. Will only post memes like "feminine penis" from now on. ;^)
>>
>>58882301
Can't you like typecast or something?

>>58882351
Such a convoluted way to do something so common and simple. baka OOP was a mistake.
>>
>>58882368
I'm not being ironic.
""""""""Design Patterns"""""""" really are fucking garbage. Cargo-cult programming at its finest.
>>
structs && functions > OOP
>>
>>58882393
To make your statement more specific:
Procedural Programming > OOP
Extra points for favouring pure functions.
>>
>>58882301
struct Circle;
struct Square;

enum class ShapeType: unsigned char
{
Circle, Square,
};

struct Shape
{
virtual Circle *asCircle() { return nullptr; }
virtual Square *asSquare() { return nullptr; }
};

struct Circle: public Shape
{
unsigned radius = 0;
virtual Circle *asCircle() final { return this; }
};

struct Square: public Shape
{
unsigned width = 0, height = 0;
virtual Square *asSquare() final { return this; }
};

///
for (const auto &shape: shapes) {
if (shape->type == ShapeType::Circle) {
std::printf("Radius: %u\n", shape->asCircle()->radius);
}
}
>>
>>58882405
>enum class ShapeType: unsigned char
Doesn't that kill the entire point of inheritance?
If you're going to use a tagged union, just use a fucking tagged union.
>>
>>58882382
Some of the GoF design patterns are actually anti-patterns. But not all of them. Decorator and visitor are pretty based.

>>58882381
>baka
Fuck off dumb weeb.

>>58882393
>no polymorphism
Yeah nah.

>>58882401
The problem with most "OOP" these days is that it isn't really OOP, but procedural programming. You memers are blaming OOP without even knowing what OOP is.
>>
>>58882417
Yeah you could get rid of it completely and use the methods I was just retaining what the original poster had in order to check the type.
>>
>>58882362
>>58882382
Visitor is just pattern matching.
>>
>>58882424
>using weeb as an insult
>arguing on a site made for anime

baka
>>
File: 14800004461170.jpg (76KB, 718x426px) Image search: [Google]
14800004461170.jpg
76KB, 718x426px
>>58882381
>Can't you like typecast or something?
I was able to static cast it (after checking that it is a Circle). I don't know how bad it is, but it worked.

Thanks everybody!
>>
>>58882301
>>58882317
Oh, well, yeah, not all shapes have a radius. Which begs the question - why do you need to get the radius of just circles from a collection of all shapes?
>>
File: dumb_weebs.png (5KB, 496x94px) Image search: [Google]
dumb_weebs.png
5KB, 496x94px
>>58882457
Hating on OOP is a /g/ meme. Just ignore.

>>58882463
See pic.
>>
>>58882477
Yeah, that's what you get when you do OOP. You get so bogged down with the gory details, the "best practices", etc that you can't focus on your main task at hand.
>>
>>58882424
>You memers are blaming OOP without even knowing what OOP is.
I know exactly what OOP fucking is.
OOP is a proposed solution to the problem of shared state. It works by segregating and encapsulating state into units known as objects.
These objects then communicate with each other via messages to their public API, and programs are supposed to be able to thought of as a network/graph of objects.
Contrast this to functional programming, where the solution is to eliminate shared state entirely, by eliminating state.
Too bad OOP is fundamentally flawed, and doesn't solve the problem of shared state at all, and just hides it behind a fancy layer of shit.

>>58882457
i.e. making up for shortcomings in Java.
Use a better language then, idiot.
>>
>>58882417
>>58882436

And here's what I meant exactly:
#include <cstdio>
#include <memory>
#include <vector>

struct Circle;
struct Square;

struct Shape
{
virtual Circle *asCircle() { return nullptr; }
virtual Square *asSquare() { return nullptr; }
};

struct Circle: public Shape
{
unsigned radius = 0;
virtual Circle *asCircle() final { return this; }

Circle(unsigned radius)
: radius{radius}
{
}
};

struct Square: public Shape
{
unsigned width = 0, height = 0;
virtual Square *asSquare() final { return this; }

Square(unsigned width, unsigned height)
: width{width}, height{height}
{
}
};

int main(int, const char **)
{
std::vector<std::unique_ptr<Shape>> shapes{};
shapes.push_back(std::make_unique<Circle>(5));
shapes.push_back(std::make_unique<Square>(10, 10));

for (const auto &shape: shapes) {
if (Circle *circle = shape->asCircle()) {
std::printf("Radius: %u\n", circle->radius);
} else if (Square *square = shape->asSquare()) {
std::printf("Width: %u, Height: %u\n", square->width, square->height);
}
}

return 0;
}


https://ideone.com/se28Ss

Feel free to elaborate if you meant something different.
>>
>>58882501
>Contrast this to functional programming, where the solution is to eliminate shared state entirely, by eliminating state.
In general functional programming eliminates shared mutable state by either eliminating the shared part or the mutable part depending on your needs. Haskell is kind of the odd one out by making everything immutable (which they need for laziness, but still).
>>
>>58882500
>be an idiot
>don't know how to do it
>blame the tool
You're just embarrassing yourself.

>>58882477
>>58882381
If you're having to typecast shit on OOP, then you're doing it wrong. PROTIP: use interfaces.

>>58882501
>functionalfag
Completely ignored from now on, functional shit is cancer and you fags don't know what you're talking about. NOBODY uses functional in the real world.
>>
>>58882501
>durr le OOP forces mutability meme
Smelly dumb "functional"fag scum.

http://www.yegor256.com/2014/06/09/objects-should-be-immutable.html
>>
>>58882518
>OOP
THAT is where you're doing it wrong, kiddo.
>>
>>58881661
>do-gooder
>GPL

Nope.

GPL is anti-freedom, and anyone who uses it is not a good person.
>>
>>58882498
Hating on badly designed OOP is the norm.
>>
>>58882535
>badly designed OOP
By definition, all OOP is badly designed.
>>
>>58882424
>>no polymorphism
>Yeah nah.
There are elegant ways of providing polymorphism in C.
>>
>>58882523
Well, actually, it does. OOP is objects sending messages to each other and having some behaviour arise from this. That obviously requires mutation. If you're not doing that, you're not doing OOP, you're doing procedural/functional programming with privacy and composition/inheritance which is hardly OO specific.
>>
>>58882535
You don't understand, they don't blame it on the design, they blame it on the tool. See >>58882545. It's a way to escape their responsibility about it. They're low IQ and couldn't do it properly, so they blamed the tool.
>>
>>58882486
I need to pass it to the function that draws a Circle. Function to draw a rectangle doesn't need a radius.

>>58882510
I appreciate the help, but isn't it simpler to just
Circle *circle = static_cast<Circle*>(shape);
since I'm checking for the type anyway? It works just as well, from what I can tell.


Also, I'm sorry I started another OOP fight.
>>
>>58882550
>I'll just call what is good functional and what is bad object-oriented
>I win by definition!
>>
>>58882559
>I need to pass it to the function that draws a Circle. Function to draw a rectangle doesn't need a radius.
You do this by making this a virtual function of the shape class which your specific shapes override.
>>
>>58882535
That's not true, though.

/dpt/ will even make posts saying that it's impossible to even have a working program if you use even a modicum of polymorphism.

It's an anti-OOP cult, and folks here don't even realize that the most powerful and elegant nontrivial programs are multi-paradigm, leveraging OOP design patterns with functional programming concepts.

While typing this, I noticed >>58882545 appear, hilariously enough.
>>
>>58882566
That is the definition of OOP.
>>
>>58882578
>leveraging OOP design patterns with functional programming concepts.
How is this possible when "design patterns" are entirely reimplementations of functional constructs in shitty OOP languages (other than the obvious ones like Decorator or Builder or the outright bad ones like Singleton)? Using a "design pattern" is always a flaw because in a better language it would just be an abstraction.
>>
>>58882552
You are seriously retarded.
You have a complete non-argument that you throw around to try and shield your flawed ideals from criticism.
People need to be able to evaluate their tools, and compare them against the alternatives.
I'm not just some random shitposter spouting a bunch of memes. I've actually though about what I'm talking about.
I actually believe a mix of imperative programming and functional programming is the way to go (pure FP has its own flaws).
>>
>>58882607
>imperative programming
I meant to say "procedural programming".
>>
>>58882605
This post is completely incoherent, and makes some hilariously bad assertions.
>>
>>58882634
There are some design patterns that are good but aren't really notable, like Decorator or Builder.
There are some design patterns that are bad, like Singleton.
The rest are trivial in any functional language.
And a design pattern in general is just something that could be an abstraction in a better language.
>>
>>58882642
>an abstraction
That's a pretty fucking stupid use of that term, despite technically being correct.
I think you mean to say "language feature".
>>
>>58882131
dynamic_cast
>>
>>58882656
I don't mean language feature.
>>
>the eternal "functional"
When will this stupid "functional" meme finally die off from /g/?

It started a while ago and since then fringe faggots have been pushing this shit.

But the worst part is that they behave like vegans: they don't just defend their stuff, they have to attack yours too.

Then they look surprised when nobody likes them.
>>
>>58882672
Why the hell do you space your post like that?
It figures that the stupid OOPfag is a redditor.
>>
>>58882681
>can't attack argument
>attack form
As expected from a double-digit "functional" memer.
>>
>>58881714
use it then
>>58879206
Rust is everything C++ should have been
>>
>>58882688
>>can't attack argument
What argument? It's just you whining.
>>
>>58882672
>But the worst part is that they behave like vegans: they don't just defend their stuff, they have to attack yours too.
That's the issue; the push for functional programming has added fantastic features to popular languages. The odd part is the memers on here who are not for FP, but rather hate on OOP, while not realizing that they're tools and should be utilized where appropriate.

To this end, languages that combine various paradigms are the way to go.
>>
>>58882696
>should be utilized where appropriate
I cannot think of any situation where OOP is the appropriate solution.
>>
>>58882688
Please do not respond to witchhunts of reddit based on spacing, or those who feign ignorance of greentext stories.
>>
>>58882701
You'll get there eventually, mate. I have faith in you.
>>
>>58882701
That only shows that the only tool you know is a hammer and everything looks like a nail.
>>
>>58882696
OOP is not useful by virtue of existing and being a tool. It's not useful by virtue of being cargo culted to death and ending up being shoehorned everywhere in industry.

I have honestly never seen a solid argument for OOP. It always devolves into "well in theory it's good" or "muh industry" or "you just don't know how to use it".
>>
>>58882701
http://www.daimi.au.dk/~madst/tool/papers/expression.txt
>>
>>58882713
>That only shows that the only tool you know is a hammer and everything looks like a nail.
That's exactly the phrase you would apply to OOPfags.
They always try to twist their problems into the mold of OOP, and just create a fucking massive mess.
>>
>>58882717
"okay"
>>
>>58882717
FP is not useful by virtue of existing and being a tool. It's not useful by virtue of being cargo culted to death and ending up being shoehorned everywhere in academia.

I have honestly never seen a solid argument for FP. It always devolves into "well in theory it's good" or "muh academia" or "you're just not intelligent enough to understand it".
>>
>>58882733
You OOPfags always try to twist it into an FP vs POO argument. You're attacking a strawman.
FP has a lot of useful and interesting ideas, but pure FP suffers from massive efficiency problems (e.g. Haskell 1GB/s).
I've always argued for procedural programming, with an emphasis on pure functions and reducing as much shared state as you can.
>>
>>58882722
Nigga, you don't understand.

You're creating this dichotomy where OO and FP cannot exist together in harmony, and trying to characterize anyone who uses OO as dogmatic.

Most OO users are using FP concepts, combined with procedural design, with the addition of objects to help organize and handle the myriad of interactions a particular form of data can perform on itself and the way it handles interactions and state.

On the other hand, you have "FP ONLY OR U ARE PAJEET" fags who literally have never worked on a nontrivial project, claiming that FP is god and the only true path to enlightenment is to use FP and nothing else.
>>
>>58882642
>>58882362
>>58882382
>>58882605
>>58882642
http://www.yegor256.com/2016/02/03/design-patterns-and-anti-patterns.html
>>
>>58882316
>>58882351
>>58882381
>>58882405
Morons

>>58882301
Virtual methods are the best and cleanest solution. However if for some reason virtual methods don't fit and you really need to do something for a specific subclass, then use RTTI:
#include <stdio.h>
#include <vector>

struct Shape
{
// Type must be polymorphic for dynamic_cast to work
virtual ~Shape() {}
};

struct Circle : Shape
{
int radius;

Circle(int r) : radius(r) {}
};

int main()
{
std::vector<Shape*> shapes;

shapes.push_back(new Shape());
shapes.push_back(new Circle(7));

for (auto *shape : shapes)
{
if (auto *circle = dynamic_cast<Circle*>(shape))
{
printf("Radius: %i\n", circle->radius);
}
}
}
>>
>>58882758
Haskell 1 GB/s is true but it's actually not an efficiency issue. The time it takes for Haskell's (strictly speaking, GHC's) GC to work is proportional to the amount of live data, so you can make as much garbage as you want and there's no problems. Do you think they wouldn't optimize it for how it's used in practice?

That said, of course pure functional programming doesn't actually require you to create and destroy lots of immutable data, as pure functions can do mutation with some kind of effect system (including linear types).
>>
File: drake.png (328KB, 451x451px) Image search: [Google]
drake.png
328KB, 451x451px
>>58882806
>reflection
>>
>>58882781
>with the addition of objects to help organize and handle the myriad of interactions a particular form of data can perform on itself and the way it handles interactions and state.
It's too bad, then, that objects are subpar at this compared to strict, especially dependent, type and effect systems. And the privacy features of classes are available with modules in most functional languages.
>>
>>58882819
>class driven programming is object oriented programming
>muh functional propaganda
Stop.
>>
>>58882827
What is object oriented programming to you?
>>
>>58882817
It's just a much cleaner way of having a type member, it's just hidden away and abstracted behind the dynamic_cast.
It's not reflection you fucking nigger.
>>
>>58882717
>I have honestly never seen a solid argument for any of the paradigms.
Fixed for you.

No one here has EVER posted why one is actually better than the other, but everyone can post why one is WORSE than the other. For OOP, it's always that "muh oop is bad" video, and for FP it's always the same shit with Hasklel's 1gb. I'm certain any one of you cunts could piss yourselves about how imperative is the coming of the messiah and rattle off shortcomings of other paradigms almost immediately after.
>>
New thread:
>>58882828
>>58882828
>>58882828
>>
>>58882545
https://en.wikipedia.org/wiki/Common_Lisp_Object_System

Please educate yourself.
>>
>>58882672
Functional programming is probably older than you, so it'll never die.
>>
>>58881661
see >>58882528
>>
>>58882424
>>baka
>Fuck off dumb weeb.
hownew.ru
Thread posts: 318
Thread images: 37


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.