There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

lemmy.ml

Aceticon , to programmerhumor in optimal java experience

I actually have a ton of professional Java experience and have done a lot of microcontroller stuff of late (for fun mainly) and if you go at doing software for ARM Cortex-M microcontrollers the Java way you’re going to end with overengineered bloatware.

It’s however not a Java-only thing: most of those things have too little memory and processing resources for designing the whole software in a pure OO way, plus you’re pretty much coding directly on the low-level (with at most a thin Hardware Abstraction Layer between your code and direct register manipulation) so only ever having used high-level OO languages isn’t really good preparation for it, something which applies not only for people with only Java experience but also for those whose entire experience is with things like C#.Net as well as all smartphone frameworks and languages (Objective-C, Kotlin, Swift).

odbol ,

I used to write a lot of performance-critical Java (oxymoron I know) for wearables, and one time I got a code reviewer who only did server-side Java, and the differences in our philosophies were staggering.

He wanted me to convert all my code to functional style, using optionals and streams instead of simple null checks and array iterations. When explained that those things are slower and take more memory it was like I was speaking an alien language. He never even had to consider that code would be running on a system with limited RAM and CPU cycles, didn’t even understand how that was possible.

eth0p ,

This may be an unpopular opinion, but I like some of the ideas behind functional programming.

An excellent example would be where you have a stream of data that you need to process. With streams, filters, maps, and (to a lesser extent) reduction functions, you’re encouraged to write maintainable code. As long as everything isn’t horribly coupled and lambdas are replaced with named functions, you end up with a nicely readable pipeline that describes what happens at each stage. Having a bunch of smaller functions is great for unit testing, too!

But in Java… yeah, no. Java, the JVM and Java bytecode is not optimized for that style of programming.

As far as the language itself goes, the lack of suffix functions hurts readability. If we have code to do some specific, common operation over streams, we’re stuck with nesting. For instance,

<pre style="background-color:#ffffff;">
<span style="color:#323232;">var result </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#323232;">sortAndSumEveryNthValue(</span><span style="color:#0086b3;">2</span><span style="color:#323232;">, 
</span><span style="color:#323232;">                 data.stream()
</span><span style="color:#323232;">                     .map(parseData)
</span><span style="color:#323232;">                     .filter(</span><span style="color:#0086b3;">ParsedData</span><span style="color:#323232;">::isValid)
</span><span style="color:#323232;">                     .map(</span><span style="color:#0086b3;">ParsedData</span><span style="color:#323232;">::getValue)
</span><span style="color:#323232;">                )
</span><span style="color:#323232;">                .map(value </span><span style="font-weight:bold;color:#a71d5d;">-></span><span style="color:#323232;"> value </span><span style="font-weight:bold;color:#a71d5d;">/ </span><span style="color:#0086b3;">2</span><span style="color:#323232;">)
</span><span style="color:#323232;">                ...
</span>

That would be much easier to read at a glance if we had a pipeline operator or something like Kotlin extension functions.

<pre style="background-color:#ffffff;">
<span style="color:#323232;">var result </span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#323232;"> data.stream()
</span><span style="color:#323232;">                .map(parseData)
</span><span style="color:#323232;">                .filter(</span><span style="color:#0086b3;">ParsedData</span><span style="color:#323232;">::isValid)
</span><span style="color:#323232;">                .map(</span><span style="color:#0086b3;">ParsedData</span><span style="color:#323232;">::getValue)
</span><span style="color:#323232;">                .sortAndSumEveryNthValue(</span><span style="color:#0086b3;">2</span><span style="color:#323232;">) </span><span style="font-style:italic;color:#969896;">// suffix form
</span><span style="color:#323232;">                .map(value </span><span style="font-weight:bold;color:#a71d5d;">-></span><span style="color:#323232;"> value </span><span style="font-weight:bold;color:#a71d5d;">/ </span><span style="color:#0086b3;">2</span><span style="color:#323232;">)
</span><span style="color:#323232;">                ...
</span>

Even JavaScript added a pipeline operator to solve this kind of nesting problem.

And then we have the issues caused by the implementation of the language. Everything except primitives are an object, and only objects can be passed into generic functions.

Lambda functions? Short-lived instances of anonymous classes that implement some interface.

Generics over a primitive type (e.g. HashMap<Integer, String>)? Short-lived boxed primitives that automatically desugar to the primitive type.

If I wanted my functional code to be as fast as writing everything in an imperative style, I would have to trust that the JIT performs appropriate optimizations. Unfortunately, I don’t. There’s a lot that needs to be optimized:

  • Inlining lambdas and small functions.
  • Recognizing boxed primitives and replacing them with raw primitives.
  • Escape analysis and avoiding heap memory allocations for temporary objects.
  • Avoiding unnecessary copying by constructing object fields in-place.
  • Converting the stream to a loop.

I’m sure some of those are implemented, but as far as benchmarks have shown, Streams are still slower in Java 17. That’s not to say that Java’s functional programming APIs should be avoided at all costs—that’s premature optimization. But in hot loops or places where performance is critical, they are not the optimal choice.

Outside of Java but still within the JVM ecosystem, Kotlin actually has the capability to inline functions passed to higher-order functions at compile time.

/rant

booklovero , to linux in What are the main challenges in Linux adoption for New users, and how can it be addressed?

Maybe it needs a rebranding. If people have heard of linux, they think it’s for devs, IT nerds, too complicated, etc. Most of the people just have never heard of linux because they don’t look out for it. Most people don’t know what FOSS is, etc. People just don’t know that their OS is spying on them. Chromeos is linux, it’s in every store. Linux made it. Gnu didn’t.

h0rnman , to programmerhumor in Gitar hero

Yo, please tag this NSFW… we didn’t come here to see this kind of smut

Mog_Spawn , to world in Climate change is a hoax /s
@Mog_Spawn@lemmy.world avatar
BilboBargains , to mildlyinfuriating in That pattern

Glitch in the matrix, they’re coming for you.

SamVergeudetZeit , to linux in What are the main challenges in Linux adoption for New users, and how can it be addressed?
@SamVergeudetZeit@feddit.de avatar

I come from a Windows and Mac environment and I now happily use Linux Mint. It has a similar aesthetic and is really easy to use. I think not recommending newbies Arch would be a good start.

batvin123 ,
@batvin123@reddthat.com avatar

I agree. Zorin OS is another good option, if people accept the fact that new users don’t care about snaps vs flatpaks. And Zorin OS Pro helps the distro maintainers put food on the table. BTW, its been too long of a wait for Zorin Grid

DeusHircus , to mildlyinfuriating in That pattern

They clearly didn’t use the printing tiddy, if they did the pattern would be in one piece

Lifter ,

The what? ELI5?

athaki ,

There’s a machine that’s used to print designs on bowls that looks like two boobs.

Example of machine

HouseWolf , to linux in What are the main challenges in Linux adoption for New users, and how can it be addressed?

Life long windows user currently dual booting and trying to fully switch.

I’ve gotten used to the terminal and I’m no stranger to editing config files but I still find myself saying ‘This could literally be a toggle or drop down menu’

I can mostly put up with it but I got friends who REALLY hate digging into files for basic stuff like global dark mode, If it’s not in a GUI it’s as good as none existent to some.

XPost3000 ,

Yeah honestly same, I hate having to sudo into random system files to change something basic or having to open a terminal and remember the specific magic words to do what I need

so whenever I have the option I use GUI over CLI every time

that_one_guy ,

This is heavily influenced by choice of DE. Some of them really do have all their options well laid out in the system settings, but others rely entirely on config files. I have little experience with GNOME, but with KDE I was able to customize my experience very heavily using only the system settings by just playing around in the GUI. Meanwhile, on another machine running Hyprland, I have had to read a lot of documentation in order to customize it, but the available options are relatively more powerful than the KDE setup.

Neither of these methods are more right than the other, but one is absolutely more new-user friendly, assuming they do not want to simply accept the defaults.

Joosl , to linux in What are the main challenges in Linux adoption for New users, and how can it be addressed?

It’s still software support. Yes, there are many great alternatives, but not being able to use apps like everyone and not being aplble to keep the apps you have is just too complicated for many

cerement , to programmerhumor in Sourcery
@cerement@slrpnk.net avatar

Hacker folklore that pays homage to ‘wizards’ and speaks of incantations and demons has too much psychological truthfulness about it to be entirely a joke.

The Jargon File (version 4.4.7)

Semi-Hemi-Demigod ,
@Semi-Hemi-Demigod@kbin.social avatar

Why do you think the most senior people, the ones who carved business logic out of raw Perl with their bare hands and a text editor, have beards?

pingveno ,

I carved business logic out of the Ant build language in my previous (and first) job. It was a long and disgusting challenge driven by a technical lead who had made technical and process decisions that I find pretty questionable. He also wasn’t using a ticket tracker, then blamed it on me when my ADHD brain had trouble keeping track of verbally assigned tasks. Unfortunately I didn’t have the background or heft yet to tell him to get off my back until we had a proper ticket tracker.

bill_1992 , to programmerhumor in Sourcery

Not understanding the true power you wield or the consequences of your actions

Sibling, I make CRUD apps with React and Python. I don’t think it’s that dramatic lmao

donnachaidh ,

Do you understand the functioning of both interpreters, down to the CPU instructions? How the database you’re using performs those updates, or quickly finds your items? The precise function of the virtual DOM? TLS handshake protocol? If so, good on you, but you don’t need to know more than the surface level of any of these for a CRUD app. But these and other systems you use hold the raw power, and wielding them poorly could lead to bugs, or security or performance issues.

On the other side, whatever you do may seem mundane to you, but lighting a fire would seem mundane to a sorcerer the umpteenth time they’ve done so. A simple CRUD app could seem dramatic if you have no idea where you’d even start building one, which is the state the majority of people are in.

F4stL4ne , to linux in What are the main challenges in Linux adoption for New users, and how can it be addressed?
@F4stL4ne@programming.dev avatar

The main challenge is resisting the urge to install Linux on your own. Because you will need help at some point, so start now by asking for help.

And then, when you don’t find the solution by yourself don’t waste time and ask for help.

In time you will get it enough to know what you’re doing.

NaoPb ,

The challenge is also to find these people that can help you out.

F4stL4ne ,
@F4stL4ne@programming.dev avatar

Yes that can be difficult some time.

But it’s really mandatory to anyone wanting to use GNU/Linus.

Skyketcher , to mildlyinfuriating in That pattern

I kind of want this just to anger coworkers and strangers

LillianVS ,
@LillianVS@lemmy.world avatar

Secret Santa gift ideas for that co-worker that will hate it 😈

Peruvia , to programmerhumor in Sourcery
@Peruvia@lemmy.ml avatar

I feel like I am crazy for just enjoying coding. I don’t troubleshoot, I think about the ways the code works. The problem itself can be confusing, but alas, I don’t speak in a professional capacity.

pingveno ,

I used to code on the side for fun more. Now the side project is less alluring. Most of that is that I more or less enjoy my on-the-job software development, so I would rather spend my free time doing something else. Before was either college or a job that sucked the joy out of coding. Both left me with a hankering for exploration.

ohlaph , to linux in What are the main challenges in Linux adoption for New users, and how can it be addressed?

Most people buy computers with the OS already installed and would get just as lost trying to install MacOS or Windows.

bouh ,

This is the correct answer. If Linux was pre-installed, most problems would vanish. My Linux computers are far, far more stable than windows once they run.

CoderKat ,

The pre installation also means the OEM will verify compatibility, a common complaint.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • lifeLocal
  • goranko
  • All magazines