/dpt/ - Daily Programming Thread

OOP & music edition.

What are you working on Sup Forums?

Old thread:

Other urls found in this thread:

tetris.wiki/Category:Rotation_Systems
clojure.org/community/companies
pchristensen.com/blog/lisp-companies/
franz.com/success/
marmalade-repo.org/
elpa.gnu.org/
wiki.libsdl.org/SDL_OpenAudioDevice
twitter.com/AnonBabble

>OOP

Why doesn't he shave?

Tetris clone. Coming along surprisingly well

Is that Tyrian Lannister?

m.. me to user. wow. But mines gonna be really shitty clone. Still learning how to do it. How much lines of code did you write?

Who's right?

Just gave it quick look-over, looks like around 450 lines so far. Haven't implemented rotating pieces, clearing rows, scoring, or changing the rate of falling yet though.

>some lonely autist spent time on making this

I am.
"OOP is trash."

Seconded

Switch to Python and use Kivy.

what they say are not exclusive. left is describing oop, right is describing (loosely) an object, or more precisely, a class.

ARS or SRS?

There is no "message passing" in C++ tho, for example, you can't make an object that reacts to an unknown method.

Why doesn't /dpt/ have a starter guide like /webdev/

I've never done much with audio stuff when it comes to programming so I don't really know much about it. I'm not a big music listener so I don't really know the formats either (I know MP3 and WAV though.) I'm gonna write a program that will need audio now though, larger files too such as music.

Which format would be free and easily integrated? The problem with WAVs to me is that they seem to take such a massive amount of space - packing in all the audio I have would constitute for like 90%+ of the size of the distribution.

MP3 has some sort of licensing issues, doesn't it?

messages are not dynamic but the principle is here.

/dpt/ is not about programming. It focuses on circlejerking on languages

Why? We all know that Rust is the best option in 2k16+1.

>you usually end up paying a lot more than you think
sure, if you don't know what you're doing. but i wouldn't recommend going into something like an embedded project with C++ if you weren't aware of the underlying details

>C happens to provide more direct code
i'd say C++ can provide equally direct code if that's what you're going for. not that it always should be. one of the big upsides to C++, even in an embedded context, is constexpr, with which you can achieve high-level type-safe abstractions with zero runtime overhead. should you really need to manually precompute values or make excessive use of (type-unsafe, error-prone) macros to have a compile time constant value which is the straightforward result of a (potentially higher-order) function? i'd like to think not. it'd be hard to argue that (constexpr-qualifiable) lambdas wouldn't be useful. if i were to use C++ in an embedded context, it's very safe to say i'd be using a limited subset (definitely wouldn't be using runtime polymorphism but that should be extremely obvious). but constexpr is one feature i'd be very happy to have. it doesn't technically do anything that wasn't possible before, but it can do many of those things in a much cleaner and more robust way

>depending on the architecture some abstractions really don't work well (I'm thinking about the implementation of atomics)
sure, but atomics are simply an available abstraction, not your only option. and for what it's worth, they're lock-free on some architectures

I had no idea what those meant until I looked it up just then, and it seems mine is based on SRS.

static int [][] make2D(int n){
int[][] magic = new int[n][n];
for (int i = 0; i

When will functional programming take over the world?

Right after the year of Linux on the desktop.

Technically it already did in the non-programmer world

I use DAX all the time. Pretty comfy for doing data wrangling.

Your good language will never be popular.
The bad language will always be popular.

While (your favorite language) is spending time adding amazing new features and shedding old world concepts that do more harm than good, people are busy finding ways to make old shitty languages fit in new applications because they've already invested too much into them to let them go.

The new popular language will always be something companies can easily move their existing workforce over to with minimal retraining.

was Djikstra a cool goy

>DS lesson
>x DS is the most important DS in the world
>next week same thing for the next DS
hmmmm

tetris.wiki/Category:Rotation_Systems

Probably true for a lot of nerds here.

My favorite language is the old shitty language being re-purposed for new things, though, so I'm fine with this.

lisp is popular
swift is popular
now that google has adopted kotlin, it will become popular.

>lisp is popular

aaahhhhhhhhhhhhhhhahahhahahhahaahhhhhhahah oh user-kun

>lisp is popular
???
>swift is popular
Swift is a language that companies can easily move their workforce over to
>now that google has adopted kotlin, it will become popular.
Doubt.jpg

>Your good language will never be popular.
>The bad language will always be popular.

i think it is ARS. i am looking for a good ways/algorithms for rotation.

I don't think that it's cringe.

...

>Sup Forums
>"""""programming"""""

millions of lisp line of code have been written and thousands are written everyday. you guys have absolutely no idea of what you are talking about.

clojure.org/community/companies
pchristensen.com/blog/lisp-companies/
franz.com/success/
marmalade-repo.org/
elpa.gnu.org/

>thousands are written everyday
That's a few (less than 5) hobbyists working on a project in their spare time, so yeah that sounds about right.

>millions of lisp line of code have been written and thousands are written everyday
I bet COBOL is even more "popular" by this measure.

I'm doing an introductory course to C and trying to do an exercise where I have to build a kind of database of people which lists their name, nationality, gender, etc. What's the best way to achieve this? I was initially thinking along the lines of an array of structures where the individual structures represent the people but would a linked list be a better way to do this? I also have to dynamically allocate the necessary memory.

cobol is only about legacy code now. neither the academy nor amateurs are still using it.

So is Lisp outside clojure and elisp.

Using a linked list needs more work, but it's not hard to implement if you understand pointers.

I'm inclined to think that linked list is a preferable way to do that kind of stuff.

>So is Lisp outside clojure and elisp.
>Don't count those two huge communities that use Lisp, it's totally dead!
C'mon, that's just retarded

>MP3 has some sort of licensing issues, doesn't it?
Patents recently expired, and no one gave a fuck anyway. Use ogg if you want a free as in free speech format, or just pack in some mp3 with the codec and ask your lawyer when you have one. (read: never)

wav is a raw, uncompressed format, so it takes a lot of space, any other format will take less space. mp3 is lossy by design. ogg it depends what options you take (Vorbis/FLAC).

There's no patent on MP3 any more, so there should be some decent free libraries out there you can use legally. OGG was used in plenty of games because its free (i believe).

Well, you kinda right, it's just many people mean CL when they talk about Lisp.
>huge communities
They're bigger than CL's, but not huge in any sense, t b h.

>tfw still hiring lisp hackers

Nobody's used Common Lisp in bloody ages, everybody is either using Clojure for applications or they're using Scheme for academic purposes

You are wrong.

k. keep me posted

>Nobody's used CL for new projects in bloody ages
That's better?

Looks like a decent living. Would make a computer/typing/translation shed too if I could.

So?

what do u guys think of this book?

what do you guys think of uncle bob?

what do you guys think of writing clean code with muh design patterns, abstraction everywhere and shit?

Is this a girls-only thread?

Uncle bob is a ruby shill.

>code
Instant trash.
>"""design patterns"""
Instant trash

>muh

Why aren't you into machine learning?
Is it because you are stupid?

No, this is a girls (male)-only thread

Thanks, I guess I might use .ogg, I think I've seen some libraries support it at least.

I was thinking of using OpenAL (OpenAL Soft) for handling audio. Any thoughts on that? The project also has SDL2 already included in it so I'm not sure if another library is needed, but I wonder if the SDL API is good enough.

>design patterns
>trash
you are retarded neet

Because ML is a fad.

Design patterns being interface abstraction techniques, you can't avoid them without having spaghetti code. They are also vital for quick code comprehension and team communication.

Books like this are shit made for easy money. Its like writing a book about how to properly clean your house or wash the dishes.

If its used as a noun instead of a verb, as it is in that context, what do you call it then? "Compiler instructions in text format"?

@60675450
What is a ``Abstraction"?

I've used SDL_mixer for simple applications before, it's a very easy to use library, and it supports a variety of formats.
Don't write unnecessary code

lol no

>what do you call it then?
Programs. Algorithms.

>""""""Design patterns""""""
Trash. Stopped reading right there.

>code
Try using

Wrong.
Source code.

What is a ``Abstraction"?

>They are also vital for quick code comprehension and team communication.
That's just bullshit. Sure, often times you'll find yourself doing something that resembles one of these design patterns and that's a-ok, because its probably the right away to do it. But teaching "design patterns" as some sort of magical formulas is usually just bad, because it leads to people looking for ways to use a specific patterns here or there when just using common sense would have lead to a simpler, better solution.
Case in point, people with a background in this sort of thing tend to over-design all sorts of message-passing systems with "observers" and "events" and what not even in the simplest of projects when most of the time they could just have been calling a function.

A program, in my opinion, could just as well mean the binary form of the thing, where as code (or source code) marks the human readable form.

abstraction
əbˈstrakʃ(ə)n/Submit
noun
noun: abstraction
1.
the quality of dealing with ideas rather than events.
"topics will vary in degrees of abstraction"
something which exists only as an idea.
plural noun: abstractions
"the question can no longer be treated as an academic abstraction"
synonyms: concept, idea, notion, thought, generality, generalization, theory, theorem, formula, hypothesis, speculation, conjecture, supposition, presumption
"his style of writing focuses on facts rather than abstractions"
antonyms: fact, material consideration
2.
freedom from representational qualities in art.
"geometric abstraction has been a mainstay in her work"
an abstract work of art.
"critics sought the meaning of O'Keeffe's abstractions"
3.
a state of preoccupation.
"she sensed his momentary abstraction"
synonyms: absent-mindedness, distraction, preoccupation, daydreaming, dreaminess, inattentiveness, inattention, wool-gathering, absence, heedlessness, obliviousness; More
antonyms: attention
4.
the process of considering something independently of its associations or attributes.
"the question cannot be considered in abstraction from the historical context in which it was raised"
5.
the process of removing something, especially water from a river or other source.
"the abstraction of water from springs and wells"
synonyms: extraction, removal, separation, detachment
"the abstraction of metal from ore"
Origin

late Middle English: from Latin abstractio(n- ), from the verb abstrahere ‘draw away’ (see abstract).

>code
Use We don't like your kind around here.

Abstraction is keeping the relevant while hiding the irrelevant.

Its working :)

Sorry for shitty web interface, but it's like a Cockpit/Monit like program that aggregates log events from multiple clients on one server and executes actions if they are alarming/overdue

>A program, in my opinion, could just as well mean the binary form of the thing
Sure, there isn't a significant difference though.
>where as c*de (or source c*de) marks the human readable form.
You should mostly be able to tell that from context.

I've used SDL_Mixer but it doesn't come with SDL, its a separate library. And if possible, I would like something that can be linked statically.
The problem with SDL_Mixer is that it didn't work on some specific machines in one of my previous projects and investigating the issue, I found out it was a common issue and something nobody really knew a solution to.
Also, it would be interesting to learn a lower level library to understand how audio works, but that's secondary.

What is a ``Abstraction", though?
You're telling me how to do a ``Abstraction", but I'm asking what it is.

I told you here

Funny, i was already posting here when dpt was not even a thing. Most of the quality people have now left (johnson, nezumi, drpantsune,davexunit,lolirapesimulator,...)

I vaguely recall playing SDL sounds without mixer, using native functions that were pretty confusing. Don't remember why I was doing that

r8 my config syntax

>using design patterns is good, just don't call them design patterns so I can think I'm a special snowflake

wiki.libsdl.org/SDL_OpenAudioDevice
found it

Good programmers don't use design patterns

Doing something which """"design patterns"""" recommend isn't using (following) """"design patterns""""

...

int x = 0;
>oh i see you're using the int pattern
>oh i see you're using the strong typing pattern
>oh i see you're using the RAII pattern
>oh i see you're using the no uninitialised pattern
>oh i see you're using the monoid pattern
>oh i see you're using the meaningful variable name pattern

Both. But they probably both think you should use classes, which they'd both be wrong about. The ideal implementation of OOP, and one we haven't seen yet, would be composing objects exclusively through dynamic multiple inheritance of traits. Types would then be sets of traits, subtypes would be supersets, and supertypes would be subsets, the most elementary base type being any set containing a single trait.

>tfw know how to use synthesizers but cant make good melodies

>tfw know how to use computers but cant make good programs