[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: 327
Thread images: 26

File: 1468274225076.png (150KB, 1024x713px) Image search: [Google]
1468274225076.png
150KB, 1024x713px
What are you working on, /g/?


Previous Thread: >>56864205
>>
OOP is the most practical way to write software.
>>
Your feelings on OOP are not an argument.
>>
Respect my feelings.
>>
>>56870031
My feelings are that your feelings are not entitled to respect, and you must respect them.
>>
If you want fast software, use C or a subset of C++. Use globals. Use arrays.
>>
>>56870026
>>56870028
Why has every major language been moving towards non-OOP features?
What was the last significant OOP feature a major language adopted?
>>
There are only three bad things about C:

a) Lack of namespaces.
b) Lack of generic programming. This can be worked around with macros and _Generic but it's iky.
c) You cannot hide the intrinsics of a structure from the user unless you use heap allocation.
>>
>>56870055
They haven't.

Lambdas/closures are simply objects in disguise.
>>
>>56870074
>FP is simply OOP in disguise
t. /dpt/ 2016

Well, let me tell you. OOP is just procedural programming with syntax sugar.
>>
>>56870074
>i-it's just pretending to not be an object!
>>
>>56870096
class Lambda<T, R> {
R apply(T t);
}

// ...

Lambda<Int, String> = new Lambda<Int, String> {
String apply(Int t) {
return t.toString();
}
};
>>
>>56870063
m8 you havent even scratched the surface
>>
>>56870130
Name another bad thing then. And please nothing like
>hurr durr
>no bounds checking
>>
>>56870127
Oh shit, I guess ALL functions are actually objects, so C is OOP
>>
>>56870152
>I guess ALL functions are actually objects

In many languages, that is true.
>>
>>56870160
Are you suggesting whether or not it's an OOP feature depends on which language it was implemented in?
>>
>>56870063
...no RAII, no move semantics, no function overloading, terrible standard library, ...
>>
>>56870160
Are bytes objects? Is assembly object oriented?
>>
>>56870182
>no RAII
Can be worked around with compiler extensions. But I'll give you that.
>no move semantics
Useless without RAII
>no function overloading
I already listed this.
>terrible standard library
It doesn't even matter because I write against POSIX if not directly linux.
>>
Can you shit stains argue over something more educational
>>
I've read that more than 20% of CPU stalls nowadays are caused by TLB misses. Is this the end of virtual memory?
>>
>>56870226
>he doesn't use templeOS
10x faster context switch
terry is the king
>>
>>56870226
>Is this the end of virtual memory?
So what's the alternative
>>
What is the best book to learn program structure in C.
>>
>>56870254
real memory?
>>
>>56869716
the format of the header still needs to be defined
>>
>>56870244
>the OS
>having anything to do with TLB misses
hmmmm, I don't even know if you're wrong
>>56870254
I don't even know. If memory doesn't get faster this could be the end.
>>
>>56870151
>null terminated "strings"
>array decay
>various syntax bullshit (eg = vs ==, & vs &&)
>pointer arithmetic
>hell, just massive overreliance on pointers and the heap
I'm pretty sure there's a lack of type checking going on with independent compilation of program units too. Wouldn't be hard to look up even more issues honestly.
>>
>>56870259
terry calm down
>>
>>56870256
for what purpose
>>
>>56870259
how?

you need virtual memory so that programs don't have mess with each other's memory

maybe get better TLB caches?
>>
>>56870272
Those are not problems of the same class. What you listed can be avoided by an experienced C programmer or can be implemented in code. For example write

struct str {
char *start;
size_t len;
};


and now you have pascal strings.

But no amount of training will give C namespaces or generic programming.

>>hell, just massive overreliance on pointers and the heap
in particular is caused by a lack of generic programming.
>>
>>56870315
so I can learn proper program structure in C
>>
>>56870316
Maybe don't write programs that could mess with each other's memory.
>>
>>56870316
>you need virtual memory so that programs don't have mess with each other's memory
No you don't, fix your damn programs
>>
>>56870330
http://www.aosabook.org/en/index.html
>>
>>56870185

Any allocated memory constitutes some "object".
>>
>>56870209
Move semantics are not useless without RAII. And POSIX won't give you better random numbers and data structures.
>>
>>56870336
>>56870334
oh man, yeah let's make it so the programmer MUST know what's going on with every address in memory

programs wouldn't be portable, because computers have different memory and more importantly different programs using memory

you'd end up having to write a kernel to deal with virtual memory
>>
>>56870354
computers without memory when?
>>
I want to learn a lisp, which one is best? Are they even that different from each other?
>>
>>56870354
>mixing and matching terms to try to protect your dying paradigm
>>
>>56870379
No. Just write position-independent code.
>>
>>56870340
thanks
>>
>>56870359
>Move semantics are not useless without RAII.
Go on.
>And POSIX won't give you better random numbers and data structures.
It gives me many libraries that probably blow everything in the C++ standard library out of the water.
>>
File: safety shorts.jpg (110KB, 550x825px) Image search: [Google]
safety shorts.jpg
110KB, 550x825px
anime ruined my life tbqh
>>
File: a5r2mLr_700b_v2.jpg (32KB, 615x620px) Image search: [Google]
a5r2mLr_700b_v2.jpg
32KB, 615x620px
you shouldn't be programming if you can't solve this desu
>>
>>56870379
see >>56870389
You can literally just have it work like this:
a%x + b
The program can't modify a or b
>>
>>56870385
Try the San Francisco lisp first, it's well-known and easy to reproduce.
>>
>>56870399
42
>>
>>56870399
THE MEANING OF LIFE
>>
>>56870408
Assuming it's contiguous that is
>>
>>56870399
That's basic algebra, not programming. Or is that your point?
>>
>>56870387

I didn't make it up. Even the C standard says that.
>>
>>56870399
10
4
2
do the math, fucking faggot
>>
>>56870421
cringe
>>
>>56870399
I was able to solve this in my head. AMA.
>>
>>56870421
No, it's the answer to life, the universe, and everything. Learn to read.
>>
>>56870443
>>56870439
>>56870428
>>56870421
>>56870417

its ~21 you mongoloids stick to haskell
>>
>>56870334
>>56870336
Isn't it more of a security issue? If my program has access to all of the memory, i have the opportunity to be more or less malicious with that information. This used to be a problem in the past, and would be even more so now with computers being more interconnected.
>>
>>56870437
Is the C standard object oriented?
>>
>>56870411
Thank you family
>>
>>56870443
So, how is elementary school going?
>>
>>56870456
Everything is OO
including the universe
>>
>>56870437
>mixing and matching terms to try to protect your dying paradigm
>>
>>56870466
I unironically have a masters in math.
>>
>>56870453
Not if you have hardware support for limiting the address range that a program can access.
>>
>>56870443
congratz, Thomas, you mom is so proud
>>
>>56870456
No. No encapsulation or inheritance.
You _can_ jump through some hoops to achieve that, but it would be easier to just use an OO language.
>>
>>56870473
Glad to see all those years of tuition really paid off.
>>
>>56870485
More proof that OOP is just syntax sugar.
>>
>>56870443
What does it feel like to have an IQ of 90?
>>
>>56870494
No shit
>>
>>56870492
University is free here and all of our PCs were running Debian.
>>
>>56870507
Is it free because nobody would pay for it?
>>
>>56870456

The standard, itself, is an object, sure.
>>
>>56870476
Sounds like you're on the path to redeveloping virtual memory.
>>
>>56870515
Can an object contain other objects?

Does the object of all objects contain itself?
>>
File: last.png (4KB, 513x322px) Image search: [Google]
last.png
4KB, 513x322px
I'm making my own terminal emulator, because every single one is shit.

Set up rendering with cairo/pango and XCB as renderer, picture is current progress.
>>
>>56870476
so program x can acces Y chunk of memory

if it needs more memory, does it ask the hardware?

Or does the hardware delegate maximum amount of memory a program could need?
>>
>>56870514
Free is a codeword for taxpayer money.
>>
>>56870529
Duck you.
>>
>>56870528
Not even close.
>>
>>56870531
will it support custom background images
>>
>>56870515
>>56870030
>>
>>56870554
Yes.
>>
>>56870529
>Can an object contain other objects?

Yes.

>Does the object of all objects contain itself?

https://en.wikipedia.org/wiki/Russell%27s_paradox
>>
>>56870531
>I'm making my own terminal emulator, because every single one is shit.
That's great. I always wanted to make one too.
>Set up rendering with cairo/pango and XCB as renderer
This is where you fucked up. Not only are cairo and pango garbage, but the X11 terminal emulator market has already been cornered. The wayland terminal emulator market is where you should invest.
>>
>>56870551
You're allowed to swear on 4chan.
>>
>>56870529
am I an object?
who am I objected to?
am I a piece of memory?!?
>>
what language is best to program the semen fluid pump in my bad dragon dildo?

i can only truly get off whilst having 5 gallons of synthetic dragon cum pumped into me
>>
>>56870565
I don't like Wayland and I'm never going to use it.

How are cairo and pango garbage exactly? From what I researched they seem to be fast when used properly.
>>
>>56870556

The arguments are entirely contrived. You always give a poorly structured program and say "oh well, looks like OOP is bad!" despite the problem being user error.

Keep in mind, I never said that OOP was the greatest, or that OOP is infallible, but its detractors have consistently shown they have no fucking idea what they're talking about.

In closing, multiparadigm is the way to go.
>>
>repostan because i'm slow as fuck

quick rundown of a bunch of random features present in oop langs:

>classes/methods
essentially a special syntax for structs + functions. not bad if you want to express that something is a function that manipulates the state of a certain type, shouldn't be used if the function is actually stateless, as this gets rid of the visible uniqueness compared to stateless functions.
more languages should allow you to convert freely between T.foo(A, B) and foo(T, A, B).

>encapsulation
pretty useful thing, probably the most useful thing in most oop languages. many languages that don't call themselves oop have similar mechanism (header files for instance).
encapsulation that cannot be broken (neither by reflection nor by switching a header file or something similar) provides a more stable api but less flexibility than weak encapsulation.
for most things, strong encapsulation is more useful than weak encapsulation, but not for things like modding or scripting.
encapsulation modifiers in most languages are too complex. package-private/public are the two most useful ones, all the others aren't particularly practical.

>inheritance
good if you never override anything (also known as type embedding, as introduced by go). quickly breaks shit with overriding, and should rarely be used in languages that allow you to override (c# doesn't allow overriding by default, which is a good alternative, in java you'd have to make everything final to provide a good api).
if you let a method be overriden, the method essentially needs to be frozen and its implementation should never change.

>abstract classes
suffer from any issue inheritance with overrding suffers from.

>interfaces
essentially a collection of function types with stronger typing thanks to method names. there's absolutely nothing wrong with interfaces, they're a great and intuitive way to abstract things.
>>
>>56870594
>>56870055


>multiparadigm
Multiparadigm is the special snowflake word for "C + Classes + Lambdas + whatever we can find"
Multiparadigm is in many cases worse than the paradigms it tries to emulate
>>
>>56870594
>In closing, multiparadigm is the way to go.
Wow, this OOP drone actually knows some things.
>>
>>56870614
>Multiparadigm is the special snowflake word for "C + Classes + Lambdas + whatever we can find"

Yes, that's correct.
>>
>>56870588
Whatever language the dragon dildo provides an API for.

Or assembly.
>>
>>56870588
Sounds like you need to write a drive.

Use C/C++
>>
>>56870608
What is the difference between interfaces and traits?
>>
>>56870608
interfaces / traits aren't even OOP

>>56870628
Show me how multiparadigm languages make pure functional programming easier. Or how they aid reasoning about memory and indirection in a procedural style.
>>
>>56870395
simple solution, just
>>>kys
>>
It seems to me noone on /dpt/ has any idea what they're talking about when discussing OOP, or any design paradigm.
>>
File: yooa arin.jpg (349KB, 500x707px) Image search: [Google]
yooa arin.jpg
349KB, 500x707px
>>56870662
if i never discovered anime my life would have been so different
>>
It's kind of funny that you can dismiss C++ completely by mentioning:
- STL allocators
- iostreams
- That unordered_map implementation
>>
>>56870670
I take it this is your first post on the matter.
You definitely haven't been part of the conversation before.
>>
>>56870662
That's not such a simple solution as you'd think.

t. Someone who's tried and failed to go through with it.
>>
>>56870399
horse = 10
4xhorseshoe = 8 <=> horseshoe = 2
2xhorseshoe - 2x boot = 2 <=> boot = 1

1+10+2 = 13
>>
>>56870678
How to dismiss C++ in two point:

1. It doesn't have designated initializers.
2. >rule of five
>>
>>56870688
did you become a tranny after
>>
>>56870652
don't think there's a significant one

>>56870655
i just named a bunch of features that people associate with oop.
encapsulation is present in non-oop languages as well.
>>
>>56870655

I didn't say they make anything easier, it's just nice to have a lot of features. If you're an expert in functional programming and are as smart as John Backus then you probably don't need anything else. For the rest of us mere mortals, it's helpful.
>>
tfw no tranny c programmer *f
>>
>>56870417
this

Horse = 10
Horse Shoe = 4
Boots = 2
>>
>>56870716
oh fuck, wait
>>
>>56870710
You've failed to mention that in both of the examples I gave, multiparadigm is LITERALLY worse.

1) You cannot do pure FP in a multiparadigm language (or at least any known language calling itself multiparadigm).
2) You cannot perfectly reason about memory or indirection in a multiparadigm language (or at least any known language calling itself multiparadigm).

Not to mention the other issues that come with multi-paradigm languages.
>>
File: yebs.jpg (439KB, 2048x2048px) Image search: [Google]
yebs.jpg
439KB, 2048x2048px
>>56870007
still mucking around with algorithms in go
will probably work on my blog engine later in the same. the standard library gives you a good portion of what you need for this
if i have time i want to start reading the dragon book

>>56870395
nah

>>56870676
a r i n
>>
>>56870681
Correct.
I don't claim to be very knowledgable onf the subject, but you guys sound like i used to sound like 2-3 years ago.

You guys are confusing the paradigms with the language features to simplify application of the paradigm.
And that guy who keeps spouting "multiparadigm" isn't actually saying anything.
>>
>>56870702
No, i started on antidepressants.
They help maybe a little.
>>
>>56870743
>isn't actually saying anything
you've found yet another way of saying "doesn't agree with me"

>confusing paradigms with language features
Gee, I wonder why.
>>
>>56870738

This is a non-argument, though. I never claimed that multiparadigm languages would assist with pure functional programming. By its nature, pure functional programming is not multiparadigm, it's purely functional.

If you prefer purely functional languages, then please continue using purely functional languages.
>>
>>56870710
too many features can be bad for working in a team, though
imo the base of the language (standard tooling, lang spec, standard library) should be relatively restrictive in terms of what it provides (not in terms of what's possible with them) to avoid too much fragmentation like in the c++ community (or even the haskell community).
e.g. the standard library shouldn't provide 8 ways to do error handling.
with lots of choice, the lines between things that each programmer defines himself to judge when to use what become rather blurry, resulting in a mess when trying to cooperate (very strict style guides can fix that, but again, if there are a billion different style guides, the same problem arises at a larger scale).
>>
>>56870399
exactly 21

>>56870689
the final equation has you multiplying the horse with the shoe
>>
>>56870743
>2-3 years
>still has any interest in the OOP argument and paradigm bullshit discussions

incredible
>>
>>56870762
I just gave two examples of paradigms which CANNOT be part of a "multi-paradigm" language.

Pure functional doesn't mean only functional it means pure as in no side effects.
>>
why aren't you developing in 9front?
>>
Oops, posted this in the wrong thread:
>>>56870774
>>
>>56870743
>I don't claim to be very knowledgable onf the subject, but you guys sound like i used to sound like 2-3 years ago.
anon you're projecting pretty hard

>You guys are confusing the paradigms with the language features to simplify application of the paradigm.
a paradigm is defined by a set of language features, including features that make the usage of other features easier.
>>
>>56870784
*the second paradigm isn't just procedural, it's a kind of "flat" procedural / very low level
>>
>>56870759
>you've found yet another way of saying "doesn't agree with me"
No, i'm saying i CAN'T dissagree with you because you're not saying anything. You're just spouting meaningless words.
>>
>>56870784

This is still not an argument. I never said anything about pure FP.

>Pure functional doesn't mean only functional it means pure as in no side effects.

I know.
>>
File: yooa at bat.jpg (343KB, 500x720px) Image search: [Google]
yooa at bat.jpg
343KB, 500x720px
>>56870740
yooa tho
>>
>>56870803

That's not an argument.
>>
>>56870813
she's never rounded all the bases, has she?
>>
>>56870451
2 + 10 * 4 = 42
>>
>>56870781
What? Software is a highly relevant subject, so design strategies is a relevant subject, so design paradigms are relevant as codifiers of design strategies. And hanging around /dpt/ it's hard to avoid the OOP bullshit.
>>
>>56870798
>>56870766 is relevant for this
if you've got a feature that sucks in most cases and is slightly more useful than the alternative in rare cases you should probably drop it for the sake of simplicity.
again, being able to override something imposes very strict limitations on the methods in regards to providing a stable api.
barely any api can fulfill these limitations (which api *never* changes its implementation?), and as such, the feature is almost useless
>>
>>56870812
>I never said anything about pure FP
Aside from you constantly forgetting that pure FP isn't the only thing to suffer from "multiparadigm" languages, here are more examples:

>the more ideal syntax features for procedural and fp languages are at odds
>low level / data-oriented programming is antithetical to OOP
>introducing lots of varying features intended for completely different, independent uses leads to lots of non-trivial unintended interactions
>language features introduced "just for x" will also affect yz.


There is literally no good reason given for multi-paradigm other than "b-but it's all of the paradigms". No, it's none of the paradigms.
>>
https://librebook.xyz

liberate knowledge

https://librebook.xyz
>>
>>56870851
also, overriding breaks one of the two core aspects of encapsulation: hiding implementation.
(the second aspect is reducing invariances caused by state)
>>
how do you anti-oopers feel about go
>>
>>56870872

What's wrong with it being a clusterfuck, exactly?
>>
>>56870851
I could argue it either way myself honestly. The devil is in the details though. "Too many ways to do one thing is bad" could be taken to the extreme and you'd end up with brainfuck. It's hard to pick an exact cut-off point for when a language or a part of a language goes from being feature rich to bloated.
>>
>>56870891
What do you mean, my third point?
It ties in with 4, but examples are type system stuff.
Adding OOP style members and methods changes the nature of what types are
>>
>>56870827
That's what i'm saying.
>>
>>56870909

Type systems are overrated anyway.
>>
File: what.jpg (9KB, 667x69px) Image search: [Google]
what.jpg
9KB, 667x69px
>>56870933
this
>>
>>56870399
42
>>
>>56870801
>a paradigm is defined by a set of language features
The hell it is.
>>
I'm having trouble using libpng in a C program on ubuntu


I already downloaded it and I have .o files but they don't show up in "build options > linker settings > link files"

to be clear my goal is to get "#include <libpng.h>" to work but I really don't know how
>>
>>56870399
thinking of meme'ing a version of this into lisp
>>
>>56870595
>but what's wrong with wav?
Except that it contains some redundancies, and with the header extensions it can be a little messy: i don't know. That's what i asked what linux nerds like to use. They can usually find fault in anything designed by MS.
Apparently applefags don't like to use wav.
>>
>>56870882
imo go gets oop itself mostly right, since:
>methods are nothing but syntactic sugar, any "class" can be used like a regular composite type and any method can be used like a regular function)
>type embedding instead of inheritance
>public/package-private only
>structurally typed interfaces (although this is a matter of opinion, nominally typed interfaces are good in other regards, although i prefer structurally typed ones)

that being said, there are some things that suck:
>go allows people to write data oriented code by providing pointers while still having a GC. this doesn't work as nicely as one might like together with oop (*T and T have different method sets)
>public/package-private being defined by the first letter of the name is neat for readability in the long run (because you can always distinguish things in the caller), but rather annoying when writing things at first (normally when you start writing something you aren't sure about which parts of the API to expose, this results in way more code changes when finishing the API)
could probably think of some other annoying things as well.
>>
>>56870950
hey der hardford her
>>
>>56870933
bad static < dynamic < good static
>>
>>56870944
===

>>56870971
1 person said wav is the prefered format of linux users... that 1 anonymous person doesn't necessarily represent the linux community
>>
>>56870896
of course, but i consider inheritance with overriding to be such a feature.
when in doubt, leave it out.
you can always add things later when you realize that it's actually needed, removing something because it's mostly harmful is impossible, though.
>>
>>56870982
There is nothing good about go (the lang). It is a clusterfuck of bad design, limited thinking, and poor choices.
>>
>>56870996
>===
My favourite part is the way you say this as if it in any way justifies that fucking image
>>
>>56870996
true enough, but it's the only reply i got
>>
>>56871013
Universal equality is a bad idea.

Haskell gets equality more right than JS, or Java.
>>
>>56871017
I use Fedora and I prefer wma
>>
>>56871043
>1
windows media autism?
>>
>>56871009
it's okay if you think that, anon
>>
>>56871052
I know it's okay to think that, because it's the truth.
>>
printf has all these %d and %s keywords, how many are there and what do they mean exactly?
>>
>>56871067
it's okay if you think your opinion is the truth, anon
>>
>>56871083
Nobody knows and 151
>>
>>56871086
go is objectively bad.
>>
>>56871091
it's okay, anon
>>
>>56871089
Hey, don't mess with beginner programmers, that's not nice
>>
>>56871111
They'll learn not to come here with beginner questions. I think that's a useful lesson.
>>
Where does the static linking meme come from?
>>
>>56871121
I'm gonna come in your mom with beginner questions.
>>
>>56871160
How is it a meme?

It makes your code run faster and means you don't have to distribute shared libraries or ask users to install them in order to use your program.
>>
>>56871160
What meme is that?
>>
>>56871161
No you're not.
>>
>>56871160
sensibleness
>>
>>56871083
Those are called specifiers, google them since its a long list


>>56871121
t. salty anon who no one helped in the past
>>
>>56871179
>>56871174
The meme is that dynamic linking is bad and that humanity should return to a paleo diet I mean static linking.
>>
>>56870982
>*T and T have different method sets
do they? i might be misunderstanding this but i thought calling a method on a pointer passed along the call to the referenced thing

>>56871083
https://en.wikipedia.org/wiki/Printf_format_string#Type_field
>>
We should stop the bullying.
>>
>>56870961
what IDE are you using? codeblocks?

>>56871013
nah, I don't justify that image, JS sucks IMO... but still, you have to know how to use it
>>
>>56871221
fuck you, queer like cuck
>>
File: lisp-math.png (205KB, 1000x800px) Image search: [Google]
lisp-math.png
205KB, 1000x800px
>>56870399
>>
>>56871260
920482.8132252117
>>
>>56871009
try this: https://tour.golang.org
report back when you finish it, tell us what you think

>>56870399
I thought it was 42, but I hadn't noticed the pairs vs single boots/horseshoes, so, yeah, 21
>>
>>56871208
The meme comes from having to set up 400 external dependencies
>could not find fuckyourmom140.dll
>>
>>56871303
You don't know the extend of the meme: sta.li.
>>
File: Dogeometry.gif (2MB, 370x319px) Image search: [Google]
Dogeometry.gif
2MB, 370x319px
>>56870399
48

Was that supposed to be hard?
>>
>>56871214
this is true until interfaces get involved.
https://play.golang.org/p/pEfsLrsmIv
>>
>>56871356
anon...
>>
File: 1475338116989.jpg (58KB, 615x620px) Image search: [Google]
1475338116989.jpg
58KB, 615x620px
>>56871391
Fine, find my flaw then.
>>
>>56871454
lrn2pedmas
>>
>>56871260
Well you're missing a parens so.
>>
File: error.png (36KB, 299x194px) Image search: [Google]
error.png
36KB, 299x194px
>>56871454
>>
File: End it.jpg (19KB, 600x315px) Image search: [Google]
End it.jpg
19KB, 600x315px
>>56871471
...fuck me
>>
>>56871454
>2 + 10 x 4 = 48
also, did you notice that you are being shown only one boot / horseshoe in the last formula?
>>
File: untitled.png (242KB, 615x620px) Image search: [Google]
untitled.png
242KB, 615x620px
>>56871454
>>
>>56870399
this is facebook-tier
why would you spend your precious moments on earth like this
>>
anyway, to go back on topic
OOP sucks
>>
File: Jesus-facepalm.jpg (61KB, 900x599px) Image search: [Google]
Jesus-facepalm.jpg
61KB, 900x599px
>>56871574
>>
Currently working on a program that takes users input and converts it to BrainFuck.
Being a first year uni student I think that I've bitten off more than I can chew.
>>
>>56870399
22
is this supposed to be difficult?
>>
does anyone here know verilog?
how do i force a wire to be a '1'?
>>
Is thinking of RAII as a kind of static GC alright?
>>
>>56871606
write a function that returns the average of two ints in C and you'll know how much OOP sucks
>>
>>56871675
No, it is not.
>>
>>56871675
Yes.
>>
>>56871687
>>56871695
>/g/ - Technology
>>
>>56871684
Wat?
>>
>>56871707
ints are objects. Summation and divisions two of its methods.
>>
>>56871716
Lets say i accept the notion of primitive datatypes as objects, what's your point?
>>
>>56871749
Your post is an object. This post holds a reference to it. It will be garbage collected once the thread gets pruned or deleted.
>>
>>56871369
thanks. i'm playing around with this. i've only been at it a week but i guess i understand the model even less than i thought

i think i understand why the first call works although i didn't realize interfaces were so permissive
in the second i would expect foobar to receive a copy of Bar{1} which would then be modified. the caller would never see it
>>
>>56871768
Still, what's your point?
>>
What's the best book for learning Java?
>>
>>56871824
The Baristas Handbook.
>>
>>56871824
Thinking In Java is pretty good.
>>
>>56871824
Something hard you can really smash your head against
Gotta lose as many brain cells as possible
>>
>>56871856
Thanks
>>
https://www.youtube.com/watch?v=guXgBe2wvEA

Reminder to unroll your for loops
>>
How come Java is so popular yet I very rarely see/use any programs written in Java? What do Java devs actually do?
>>
>>56870007
just found this toy I did years ago. Tear it apart

http://pastebin.com/63rYiScz
>>
>they'll never realise this is \dpt\, not /dpt/
>mfw all these linuxfags are toasting windows bread
>>
File: answer.jpg (132KB, 1120x836px) Image search: [Google]
answer.jpg
132KB, 1120x836px
>>56870399
itt retards
>>
>>56870399
you shouldn't be programming if your programming language can't solve this desu
:- use_module(library(clpfd)).

puzzle(Vars) :-
Vars = [Horse, Horseshoe, Boot],
Vars ins 0..sup,
Horse + Horse + Horse #= 30,
Horse + 2 * Horseshoe + 2 * Horseshoe #= 18,
2 * Horseshoe - 2 * Boot #= 2.

?- puzzle([Horse, Horseshoe, Boot]), Sum is Boot + Horse * Horseshoe.
Boot = 1,
Horse = 10,
Horseshoe = 2,
Sum = 21
>>
>>56871942
The real /dpt/ is here >>56869706
>>
>>56871932
they write java ide's and tools to help with writing java
>>
>>56871954
>prolog
He asked if you could solve it, not your language

>>56871952
>maki
perfect
>>
>>56871968
>He asked if you could solve it, not your language
I'm not doing xir homework. I said if you're programming language a shit, you shouldn't be programming.
>>
>>56871964
>frogpost made WAY before bump limit
No it fucking isn't
>>
>>56871983
>i was just pretending to solve it
>>
>>56871779
that would be possible, yes, but the faq explains it:
"Even in cases where the compiler could take the address of a value to pass to the method, if the method modifies the value the changes will be lost in the caller. As an example, if the Write method of bytes.Buffer used a value receiver rather than a pointer, this code:

var buf bytes.Buffer
io.Copy(buf, os.Stdin)

would copy standard input into a copy of buf, not into buf itself. This is almost never the desired behavior."
>>
>>56871964
>frogthread not linked in /dpt/
>all the replies are "java, css or html?"
Too good to be true
>>
>>56871707
>he can't average two ints in C
noob

>>56871779
>>56871369
why would you not use pointers and references anyway
>>
>>56872026
for data locality, to allow programmers to write their program in a data-oriented manner.
>>
>>56871932
Minecraft.
>>
>>56870074
If you'd read your SICP you'd know that objects are just lambdas and closures in disguise.
>>
>>56872003
brainlet
>>
>>56870026
It depends. What kind of OOP? Java or for example Smalltalk?
>>
>>56871234

Figured it out, just had to add a flag
>>
How big is gosper's hack?

I have a 10000x10000 png I made from the exact algorithm written in the Art of Computer Programming by Don Knuth and it is pretty much solid
>>
I wish more languages had something like gofmt by default.
>>
File: 1472261095128.jpg (53KB, 822x547px) Image search: [Google]
1472261095128.jpg
53KB, 822x547px
>>56870007
>What are you working on, /g/?
A HappyPanda esque thing with gallery dumping capabilities.
>>
>>56870063
no constexpr
>>
>>56872225
C++ has clang-format
>>
File: 1434029242574.jpg (12KB, 200x189px) Image search: [Google]
1434029242574.jpg
12KB, 200x189px
>>56872231
>reverse image search yields nothing
>>
File: 1453350447118.png (66KB, 1201x333px) Image search: [Google]
1453350447118.png
66KB, 1201x333px
>2016
>Not programming kernels in C++
>>
>>56872182
-lpng or something? I thought about that when I saw your post, but... short attention span for forums and stuff
always remember to add those, plus remember that those go at the end of the command line
>>
>>56872258
stupid frogposter nobody's giving you the sauce
>>
>>56872231
Is it bad if I want to stick my finger in that top girls butt?
>>
>>56872302
Id' say it would be bad if you didn't want to.
>>
>>56872284
I thought you were allowed to post pepe after it was declared a neo-nazi symbol
>>
>>56872314

Jap women are gross.
>>
>>56872302
that's where shit comes out
>>
>>56872246
Sadly it isn't used by as many people as in Go, which defeats the main purpose.
>>
>>56872326
Fuck off niggerlover.
>>
>>56872238
No guarantee that an expression is constant and should be evaluated at compile time can be killer. When we will have compile time data structures?
>>
File: 1475183112501.jpg (468KB, 1080x809px) Image search: [Google]
1475183112501.jpg
468KB, 1080x809px
>>56872320
posting pepe has always been allowed, doesn't matter if the hill shills don't like it
>>
>>56872342
And?
>>
>>56872344

"no". Black women are the most beautiful.
>>
File: (x*x*y << 11)&1.png (6KB, 256x256px) Image search: [Google]
(x*x*y << 11)&1.png
6KB, 256x256px
this
>>
File: 1470267245103.jpg (36KB, 1280x720px) Image search: [Google]
1470267245103.jpg
36KB, 1280x720px
I'm sick of OOP programming and of OOP programmers tirelessly preaching about how good it is.

It has this amazing ability to spew crap all over a code base and the only thing you can do is watch it get filled to the fucking brim with dependencies and unnecessary abstractions and complications that makes you want to drive your fist through the fucking screen.

I am sick of listening the same people that think that pointers are scary and that assembly is voodoo talk to me about what is good practice and that procedural programming sucks compared to OOP.

They literally have no intrinsic knowledge of how the computer works but will still act all smug about it and look down on anyone who doesn't agree with their narrow point of view.

Fuck.
>>
>>56872367
This is the worst possible taste anyone could possibly have.
Congratulations.
>>
>>56872359
but he says it's stupid and he won't give me any sauce
>>
>>56872225
the editor plugin for go that i use automatically runs gofmt upon every save. i was pissed at first but now i kinda like it
>>
>>56872320
>>56872359
>>56872377

Fuck off you stupid fucking frogposters
This isn't r9k, it's not pol and it's certainly not reddit

inb4 >this isn't x, it's not x and it's certainly not x
>>
>>56872385

I don't think so. Black women are near the top in terms of beauty, and that's almost universally agreed upon.
>>
did these people at the beginning of the thread not understand what's virtually mapped memory
>>
Really having a hard time understanding Go. It's like if C and Python had a miscarriage.
>>
>>56872419
the ones arguing against it or the ones arguing for it
>>
>>56872425
>Really having a hard time understanding Go
go is easy
>>
>>56872425
go is fucking trash
>>
>>56872367
>>56872385
>>56872400

Are we going to have one of these threads again
>>
File: 1469161960215.jpg (88KB, 720x725px) Image search: [Google]
1469161960215.jpg
88KB, 720x725px
>>56870182
>RAII
>STL
>Implying that these are good things
>>
>>56872442

I'm just having fun.
>>
>>56872400

Yup, just behind

-white women
-latin women
-asian women
-men
>>
>>56872377
What's procedural programming?
>>
File: vim2.png (642KB, 1675x402px) Image search: [Google]
vim2.png
642KB, 1675x402px
Which style do you guys prefer?
>>
>>56872370
nice, reminds me of ancient greek architecture and pottery
>>
>>56872478
Right.
It doesn't make me throw up.
>>
>>56872478

The left. Anti-aliasing is disgusting.
>>
>>56872471
progrm is executed in order
>>
>>56872478
I want to like left but right is easier to read
>>
>>56872478
btw right one is DejaVu Sans Mono bolded, left one is ProFont Regular
>>
>>56872478
The style that doesn't force me to wrap everything i do in try catch blocks.
>>
Okay /dpt/ please don't castrate me for this I'm still learning and this is just a little side project for my own enjoyment.
So here's a bit of code from my project
List<int> ascii = new List<int>();

Console.Write("text to ascii >>: ");

string input = Console.ReadLine();
input.ToLower();

foreach(char c in input)
{
Convert.ToInt32(c);
ascii.Add(c);
}

for (int i = 0; i <= ascii.Count; i++)
{
Console.WriteLine(acii[i]);
}



Okay so it's just a small sample but I'm pretty sure here's where all the problems are coming from.
When I pass it any value for instance "dog" I'll get the correct ascii characters printed out to the screen but after that I get an exception
System.ArgumentOutOfRangeException: Index was out of range
It then goes on to say that it must be a non-negative and less than the size of the collection, it then points to the
 Console.WriteLine(ascii[i]); 
line.

I thought I would post here first and afterwards I'll begrudgingly take it to something like Stack Overflow any help would be appreciated, and if I'm doing something wrong like shitty structure or poor optimization if you point that out it would pretty cool.
>>
>>56872478
Where's the option that doesn't involve python?
>>
>>56872501
And OOP is what? Program is executed randomly?
>>
>>56872516
the problem is it's 0 indexed and you do <= count
you want to do < count

so for instance if you had a list
[1,2,3,4]
that has 4 elements / a count of 4
but it's 0 indexed
0 1 2 3

do < count
>>
>>56872528

Yes, that's what OOP stands for -- (O)ut of (O)rder Programming.
>>
>>56872536
Holy shit thank you, I'll try that out now.
>>
>>56872516
< Count -1
>>
>>56872554
>>56872536

Just compiled and executed sucessfully, many many many many many thanks anon
>>
Is there any point to learning rust or ocaml after learning c and lisp?
>>
>>56872478
right
>>
>>56870175
>>56870160
function does not necessarily equal method
I learned this the hard way in Typescript
>>
>>56872478
Here are all the options.
I really can't decide which one to use.
Only ProFont Bold looks like shit.
Help me decide /dpt/
>>
>>56872528
almost. poorly written OOP is horrible unreadable spaghetti code
>>
File: vim3.png (2MB, 1680x1050px) Image search: [Google]
vim3.png
2MB, 1680x1050px
>>56872617
meant with pic related
>>
>>56872604
just look at a rust to understand how they guarantee safety as a learning exercise no need to actually invest much time in it unless you really want to program in rust

youll be able to constrast with C
>>
>>56872626
>poorly written OOP
That's why you write proper OOP and it'll be perfectly understandable.
>>
>>56872626
Poorly written anything is horrible unreadable spaghetti code. Ever seen a state machine implemented in Haskell?
>>
>>56872633
Top Right is objectively easier on the eyes and clearer.
>>
>>56870007
>What are you working on, /g/?
A social network over p2p. A bit like twitter meets 4chan (OP of each "tweet" is anonymous, but you get them through the people you are following).

The DHT is basically kademlia with a few changes.
>>
>>56872633
top right

>muh profont
faggot
>>
>only really enjoy writing in C but can't find any work
>>
>>56872693
>what is "C with classes"-style C++
>>
>>56872225
Rust has (for now unofficially) rustfmt
>>
>>56872693
Try to contact your lord and savior Lennart Poettering. Maybe he can give you a job at RedHat.
>>
>>56872626
So is poorly written procedural, when you trow in enough branching, loops and function calls.
>>
New thread: >>56872731
>>
>>56872225
1. Have a coding style
2. Reject all patches that don't follow it
>>
>>56872717
I know! I know!

"C++ with classes" is shit
>>
>>56872736
still better than C
>>
>>56872717
>get job
>codebase is entirely in boost
>>
>>56872800
kek
>>
>>56870399
One horse is equal to 10
One horseshoe is equal to 4
One cowboy boot is equal to 2
2+10*4= ?
Use pemdas
Multiplication comes before addition
10 multiplied by four is forty
Forty plus two is equal to forty two.
If you are incapable of getting this answer, you deserved special ed more than I did.
>>
>>56873118
>One horseshoe is equal to 4
>One cowboy boot is equal to 2
Wrong. Two horseshoes is equal to 4. Therefore 1 horseshoe is equal to 2. Some thing with cowboy boots. Notice how in the last line you're only give 1 boot instead of a pair. So it's 1 + 10 * 2.

Looks like you deserve special ed more than you do.
>>
>>56873369
No, a horseshoe squared, and a cowboy boot squared
>>
>>56870399
sick troll image

so it's actually 21 like >>56870451 said but couldn't bother to explain
>>
>>56873393
So each cowboy boot is 1.414 then. Doesn't make you any less wrong.
>>
>>56873482
I'm not >>56873118
>>
3 horses = 30 => 1 horse = 10
1 horse + 4 horseshoes = 18 => 1 horseshoe = 2
2 horseshoes - 2 boots = 2 => 1 boot = 1

1 boot + 1 horse * 1 horseshoe = 21
>>
>>56873550
genius

this only proves that OOP sucks
Thread posts: 327
Thread images: 26


[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.