/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Previous thread:

Other urls found in this thread:

github.com/groovy/groovy-core/blob/master/src/main/org/codehaus/groovy/runtime/ArrayUtil.java
joelonsoftware.com/2005/12/29/the-perils-of-javaschools-2/
github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition
hackage.haskell.org/package/lens
web.archive.org/web/20161029175856/http://planetcassandra.org/companies/
twitter.com/NSFWRedditGif

hi

>making a new thread before old one dies

But that's reddit tier.

>tfw if I had more time, I would have written less code.

If Java is so trash how come it is taught in every college and community college across the globe everywhere? Higher education cannot be wrong. Checkmate brainlets

github.com/groovy/groovy-core/blob/master/src/main/org/codehaus/groovy/runtime/ArrayUtil.java

joelonsoftware.com/2005/12/29/the-perils-of-javaschools-2/

* This is a generated class used internally during the writing of bytecode within the CallSiteWriter logic.
* This is not a class exposed to users, as is the case with almost all classes in the org.codehaus.groovy packages.


Hmm, really fires the neurons

>This is a generated class used internally during the writing of bytecode

Forth compiler as a thing to tinker on with optimization (off by default to encourage hand optimization).
At the moment the type system is limited but will get better as I work on the editor.
Also adding cycle and binary size info which will be exposed to the editor and any program using the profiler vocabulary.

The level of "enterprise best practices" brainwashing everywhere is astounding. It's like people have had mantras drilled into their heads so long that they believe they're self-evident truths and that asking for proof is some unspeakable sin.

Oops, accidentally replied to the old thread.

Who needs Thompson and Ritchie when you have TAD & TAD?

is that link saved in your "sick java burns" folder?
also, tell me how that same code would have been implemented in C or another non-OOP language.

it makes me unreasonably mad every time i read the fucking word codehaus

fuck grails and groovy and java even more than that

>createArray overloads with 0 to 250 args
>this is java

For example?

>is that link saved in your "sick java burns" folder?
Nah I happened to have cat v harmful page opened in a tab. Lots of interesting and fun opinions there.

In Rust it's done with a macro.

I have literally never seen anything remotely impressive in /dpt/ in the 4 years that I have used this website.

Post your best project of all time anons.

Variable length args? They exist in C
pretty much the same as lisp (define (array x . xs) ...)
And in forth you can abuse the return stack

Haskell or Idris?

start-code.
fizzbuzz of 1-100000 : optimize 100
end-code.

it's in my language. fizzbuzz is a built-in procedure.

Design patterns
OOP
Mutable variables

#include
#include
#include

int64_t f(uint8_t n)
{
if (n 92) return -1;
n -= 2;

uint64_t a = 1, b = 1, c = 0, d = 1, e = 1, f = 0;

while (n) {
uint64_t g, h;
if (n & 1) {
g = a * d + b * e;
h = b * d + c * e;
f = b * e + c * f;
d = g;
e = h;
}
g = a * b + b * c;
a = a * a + b * b;
c = b * b + c * c;
b = g;
n >>= 1;
}

return d;
}

There are universities that only teach Java?

A popular one is wasting time planning so that you can write shitty code that you ideally never have to change instead of just writing good code that can change without any trouble if it ever needs to.

Hmm, I see. Can you give examples of said brainwashing, of those "mantras" being "forcefully drilled" into people's heads? Like, say, in literature for instance?

In Lisp it's done with a macro. In Rust it's done with a Frankenstein abomination.

Idris if it didn't throw an exception every time I try the repl

Idris.

>planning is a waste of time
Current state of Sup Forums

And when you ask these drones to convince me to do so, they can only sputter "muh industry standard" and "you're dumb if you don't already know this, I shouldn't have to explain it to you", etc.

Convince me I'm wrong. Let's see how this goes.

I don't get how any accredited university could value a language based on OOP crap over a language that has actual memory addresses

Pointers are half of what a computer does. How do you even study a computer without a concept of a memory address.

How about most CS or software degrees and books about programming for the last 30 years?

>java

AbstractChan fourChan = AbstractChanFactory.getChanForNumber(new ConcreteChanNumber(new Integer(4)));
AbstractChanBoard g = fourChan.getConcreteBoardManagerInstance().getBoardForName(new BoardName("Sup Forums"));
AbstractChanThreadIndex catalog = g.getThreadManagerSingletonInstance().queryThreadIndexSynchronously();

if (catalog.getThreadSearchUtilityInstanceForStrategy(ThreadSearchStrategy.BY_OPENING_POST_NUMBER).searchForThread(new ConcreteChanOpeningPostNumber(new Integer(59209636))).getSearchResultsSynchronously().getSearchFindings().isThreadFound()) {

AbstractChanThread thread = catalog.getThreadLocatorUtilityInstanceForStrategy(ThreadLocatorStrategy.BY_OPENING_POST_NUMBER).locateThread(new ConcreteChanOpeningPostNumber(new Integer(59209636)));
AbstractChanOP op = (AbstractChanOP) AbstractChanOpManager.getInstance().getOpManagerForThread(thread).getManagedOP(thread.getThreadPostsCollection().getOpeningPost().asOP());

if (op.getAbstractFaggotryManager().getConcreteInstance().getFaggotryStatusTestingData().isFaggot(op).executeTest().getResults().evaluate()) {
System.out.println(">java");
}
}

Haskell doesn't have pointers bro

I don't see any library imports, I would not push this into production.

Haskell is a language that exists only in academia

Neither do scripting languages which are optimized for automating things that the user could have done by hand

what's your point

read thinking-forth and you'll understand
does said book above count in that brainwashing? It calls most of the other methods shit in the first chapter

Wow, 30 years? Should be easy enough to show me a couple of concrete instances of it then.

>Haskell

import this.doman.does.not.exist.neetsoft.web.clients.abstract.chan.four;

Sup Forums is adept of the eXtreme Go Horse software development methodology.

there we go

>read thinking-forth and you'll understand
I'm not reading a whole book to be convinced of something that is apparently obvious.

OOP = POO

stealing this to make into a check'em

Going to buy a VPS and do all my coding in it, I think I am done with Linux after 10 years

>I don't get how any accredited university could value a language based on OOP crap over a language that has actual memory addresses
Maybe because the "OOP crap" has shown to work extremely well.

We're now also seeing it almost ubiquitously used on cloud clusters (the flexible supercomputers of our time) and personal smartphones.

Handling actual memory addresses is not a job most programmers need to be concerned about in most instances, you should worry about using algorithms that perform well and that are doing the correct thing.

> How do you even study a computer without a concept of a memory address.
You never went to university, right? Of course you also study that. That doesn't mean most of CS or related subjects focus on juggling fucking pointers.

DO IT AND POST RESULTS

github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition

but it does... check out marshal
my company uses it and translates it to scala later

>POO supporter
>rabbit spacing style
huh...

>translates it to scala later
Oh my god, your scala code must be horrendous because scala's type inference is so limited

read the first chapter you dimwit, it covers exactly what happens when you don't plan
read the rest if you care about writing good programs

>Maybe because the "OOP crap" has shown to work extremely well.
Show me. On the contrary, it's subpar for safety and reasoning because of mutable state, it's subpar for efficiency because of virtual calls and bad cache layout, and its common usage is subpar for abstraction and code reuse because inheritance is mathematically nonsensical, subtype polymorphism is not polymorphism in general, and composition of objects rather than pure data leads to lots of boilerplate methods.

>this pajeet again
kys

we use the cats library which makes things a bit better

> cross compiling haskell to scala

that's asking for a hernia

>>rabbit spacing style

Composition is fine if you use a good lens library.

Oh wait, OOP languages don't generally support good lens libraries.

hey, you must be new here. we don't actually have identities on this subreddit.

Can you summarize it for me?

Why cats and not scalaz?

... The fuck is a lens library?

it's what they get for hiring haskell programmers for a scala job... shits a mess before we got here so we're not really adding mess by doing it. It's like a ball of mud but it's not lisp..

>computer science
>memory addressing
ok, kid

hackage.haskell.org/package/lens

Something written by Edward Kmett.

what shitfest

christ

management wanted to move to cats from scalaz as they heard good things about it. Thing is close to haskell so most don't care at this point as we just want to keep our jobs. Last guy who complained was fired on the spot

>Last guy who complained was fired on the spot
is this a joke? how much did he complain...

probably could've done better but this'll do for now

>open lens package
>This package comes "Batteries Included" with many useful lenses for the types commonly used from the Haskell Platform

Yeah no shit...

>and with tools for automatically generating lenses and isomorphisms for user-supplied data types.

Sup guys download the lens package so you can make lenses and it also comes with some great built-in lenses!

>The combinators in Control.Lens provide a highly generic toolbox for composing families of getters, folds, isomorphisms, traversals, setters and lenses and their indexed variants.

... So it does what?

>An overview, with a large number of examples can be found in the README.

... I thought this was the README.

>An introductory video on the style of code used in this library by
>A video on how to use lenses and how they are constructed is
>Slides for that second talk can be obtained
>bla bla bla bla bla bla

You've got to be kidding me

You had ONE job.

that will work

cats is literally a worse scalaz. Your management is full of idiots.

>. Last guy who complained was fired on the spot
>working in this shitty a company

Lenses are the coalgebras for the costate comonad, what's the problem?

literally WHAT

Enough, at least once or twice a week.
Was expected though as he didn't do much work and the complaining was the tipping point.

We want to re factor the code but management sees it as "avoiding work" so we do it when we can

Wow this is UML Java tier.

If you write code for anything that uses more than 1 CPU, it's gonna be in something like OpenCL (using an older standard of C) not java. You have to carefully manage memory, pay attention to how much data you are sending across your bus, know about where memory is stored, datatypes, etc.. The computer knows nothing about OOP.

Anything of consequence that runs on a smart phone (a video player, the OS, the protocol stack) is going to be in a real language. Android apps are all written in Java because it gives the app developer Java as an abstraction from the rest of the OS.

and pointers are absolutely necessary to write efficient algorithms.

and you guys make fun of java

Atleast Java is better structured than this

Pretty accurate
Pays the bills so don't really care and I'll probably leave soon for a better job anyway.
No since you need to read the language history part as that's where half of it is... It covers pretty much every language development up until it was published in short. Just read, you'll enjoy the book

> Show me
Go check what clouds and the big web deployments run. You know, the really massive ones.

Check what the majority of phones run, and what programming style is used there,

> muh subpar reuse
Okay, take over the world with your greatly reusable code.

If you look around a bit what is actually used in production, you'll find that even big companies are really rather flexible in what they use.
Just give them this amazing reuse-ability in a way that can be used by their staff and their computers, they *will* bite.

> mathematically nonsensical
Oh, even a bigger project. Making it so people can use actual maths without doing nonsense. Good luck with that one.

Half understanding even a fraction of the whole poorly accessible mess that is accumulated maths easily gives you a chance of being "Paul Erdős, better variant".

No, pointers aren't really required.
A full description with enough detail is however. If I could tell the compiler exactly how much memory it need it would spew out pretty fast code. Also most compilers pretend there's a further abstraction from the machine. C sees everything as memory blocks, Forth sees stacks and memory, Haskell... everything is a function...

>Its my birthday and I am stuck in the office doing overtime to rush a project that wasn't supposed to involve me in the first place
>But I don't mind because all I am going to do is go home and play video games anyway
Where did it go so wrong guys?

In argumentation theory, an argumentum ad populum (Latin for "appeal to the people") is a fallacious argument that concludes that a proposition is true because many or most people believe it.

>Just give them this amazing reuse-ability in a way that can be used by their staff and their computers, they *will* bite.
It's been around for years, it's called procedural and functional programming. They haven't.

>Oh, even a bigger project. Making it so people can use actual maths without doing nonsense. Good luck with that one.
That's not what I mean. Inheritance is fundamentally broken because it combines subtyping with extension. If A inherits from B, A also subtypes B and extends B. But if A subtypes B then A can't extend B since every value of A must be a value of B as well. It's funny that inheritance breaks even with an example as simple as a square class inheriting from a rectangle class. How do you implement setWidth on a square?

> If you write code for anything that uses more than 1 CPU, it's gonna be in something like OpenCL (using an older standard of C) not java.
Wow, you're really far from the actual industry, right?

What data / processing clouds actually run is actually predominantly JVM based.

You know, Cassandra (web.archive.org/web/20161029175856/http://planetcassandra.org/companies/

Simple, have it return a new rectangle instance with the specified width.

Of course. But now you are going functional rather than object-oriented. In an ideal functional language, a square is just a rectangle coupled with a proof that the sides are of equal length. No encapsulation needed to maintain this, no potential duplication between the square and rectangle definitions that has to be addressed with some kind of boilerplate, etc.

>that posting style

>functional rather than object-oriented
This is a good thing

They're both garbage, friend.

Exactly, I was just proving a point about inheritance.

Haskell and other languages like it are catching up due to the ease of making code run in parallel (it's just a compiler flag and a function for forcing it).

calm down little guy

yes

bepis

> It's been around for years, it's called procedural and functional programming.
If either was this reusable then we'd see oodles of monumentally cool projects and the most feature complete libraries all use them.

They almost never are the most feature complete solutions. OOP usually has far more impressive solutions. Despite allegedly not being "as reusable".

> It's funny that inheritance breaks even with an example as simple as a square class inheriting from a rectangle class. How do you implement setWidth on a square?
No, that's not funny - you're just breaking inheritance.

You actually derive both individually from a Polygon or Shape. Or you model this in immutability (in which case a square can be Subtyped from a rectangle - but obviously has no set* methods.)

In argumentation theory, an argumentum ad populum (Latin for "appeal to the people") is a fallacious argument that concludes that a proposition is true because many or most people believe it.

>You actually derive both individually from a Polygon or Shape.
But you should be able to substitute a square for a rectangle.

>Or you model this in immutability (in which case a square can be Subtyped from a rectangle - but obviously has no set* methods.)
Then the rectangle can't have setters either. With the functional approach, you don't lose mutability, which can be important for performance.

opening your mind will surprise you