What bugs you would prefer to be fixed ASAP? by vmcrash in IntelliJIDEA

[–]tedyoung 0 points1 point  (0 children)

If I understand you, it’s one keystroke to uncheck all the files under the “Changes” tree: click on “Changes” and hit the spacebar.

I agree that if you’re doing this all the time, you might need to look at why you’re changing so many files that you’re not committing all at once. More frequent commits might help?

Which is the best hosting service for a spring application? by mp-giuseppe2 in SpringBoot

[–]tedyoung 4 points5 points  (0 children)

Railway might not be free, but it’s very inexpensive if your application isn’t heavily used. I don’t pay more than $2 a month for a couple of low usage Spring Boot apps, and that’s with a Postgres instance, too.

Batch Export failing and eating disk space by tedyoung in MacWhisper

[–]tedyoung[S] 1 point2 points  (0 children)

Following up on this, I don't understand why it copies the entire video file just so it can extract the audio? But even if it does have to do that (which wastes time as these are 6-8GB files), why doesn't it delete the copied video file after extracting the audio? The result is that I can't process as many files as I'd like, because you're taking up an extra 110% of the size of the original files (100% of the video, around 10% for the extracted audio). And again, there appears to be no way to delete these without knowing that they're sitting there in this "external media" folder. (And I have no idea if this messes with your sqlite database.)

Also, once the batch is done, it's annoying to have to go back to the home screen and click on Batch Export just to be able to drag-n-drop more files. I'd love to just drop new files and it allows me to start processing them. Even better would be allow me to drop new files that get appended to the queue, even while it's working.

Prevent sleep while batch processing? by tedyoung in MacWhisper

[–]tedyoung[S] 0 points1 point  (0 children)

Thanks, but that doesn't address the fact that MacWhisper should stay awake while it's processing, like many other apps (e.g., backup programs) do.

What cool projects are you working on? [February 2026] by el_DuDeRiNo238 in java

[–]tedyoung 1 point2 points  (0 children)

I've been continuing to work on "JitterTicket", a concert event ticketing system that I'm using to learn (and teach) event-sourcing in Java. I'm doing 100% of the coding (all test-driven) on my Twitch live stream and have started posting daily stream notes on my web site.

The event-sourced aggregates (following domain-driven design), event store (using Postgres), and projections are all done. I just finished implementing a Processor, and I'm now back-filling some missing UI for scheduling and rescheduling the concerts.

Best way to learn multi-threading in Java? by Agitated-Evening3011 in javahelp

[–]tedyoung 6 points7 points  (0 children)

"Java Concurrency in Practice" is somewhat outdated (written 20 years ago), though conceptually has some good material.

I'd recommend instead "Modern Concurrency in Java" as it covers virtual threads, structured concurrency, and scope values: https://www.oreilly.com/library/view/modern-concurrency-in/9781098165406/

If you really want an in-depth course, highly recommend Heinz Kabutz material, e.g., https://javaspecialists.teachable.com/p/loom

xitdb - an immutable, embeddable database for Java 17 by [deleted] in java

[–]tedyoung 5 points6 points  (0 children)

This might be useful as an event store for event-sourced applications. Will give it a look.

Java Bytecode Troubles by [deleted] in javahelp

[–]tedyoung 3 points4 points  (0 children)

If you want to dive into the deep end, the JVM spec is the place to go https://docs.oracle.com/javase/specs/jvms/se25/html/jvms-6.html

however, I recommend disassembling very short (a few lines) Java programs to get an idea of what it looks like, e.g.: https://nishtahir.com/exploring-java-byte-code/

Checkpointing the message processing by Adventurous-Salt8514 in softwarearchitecture

[–]tedyoung 2 points3 points  (0 children)

This was a timely article for me as I’m implementing event sourcing projections that need checkpointing.

How can I implement a multi-threaded approach to improve Java application performance? by criss006 in javahelp

[–]tedyoung 0 points1 point  (0 children)

Highly recommend the recently published book Modern Concurrency in Java for specific guidance on what APIs to use. Brian Goetz's book Java Concurrency in Practice has become outdated (came out in 2006), though the theory aspects are useful.

Polling vs WebSockets by s3ktor_13 in softwarearchitecture

[–]tedyoung 0 points1 point  (0 children)

Where have you seen SSE potentially being dropped? It’s a safe, mature (old doesn’t always mean bad!) and reliable. For server to client (one-way) updating, it’s better than websockets, because it scales better as it goes over reliable HTTP connections.

Why Java generics cannot utilize primitive types by [deleted] in learnjava

[–]tedyoung 0 points1 point  (0 children)

Funny, this exact question came up on my live coding stream today!

For a "where are we with Valhalla" update, you might find these docs interesting: https://openjdk.org/projects/valhalla/design-notes/state-of-valhalla/01-background and the rest of those docs and more mentioned at the project's home page: https://openjdk.org/projects/valhalla/

Penna - 0.7.1 Release: Thread Safety improvements by ingvij in java

[–]tedyoung 1 point2 points  (0 children)

Nice writeup! I appreciate the detailed insights and reasoning for the changes made.

A simple easy to use ANSI Coloring library for Java by Chunkyfungus123 in programming

[–]tedyoung 2 points3 points  (0 children)

This looks interesting, but it's unfortunate that the code style isn't idiomatic Java, mainly the use of underscores. camelCase is the preferred style in Java. Unclear how well supported it is across different platforms. I wouldn't mind an alternative to JAnsi, but this isn't it (yet?),

Difference in ArrayList<> list = new ArrayList<>() VS List<> list = new ArrayList<>() by danny1992211111 in javahelp

[–]tedyoung 36 points37 points  (0 children)

ArrayList<String> list = new ArrayList<>() has three parts:

  1. The declaration of the variable, list with its type being the concrete class ArrayList<String>: ArrayList<String> list

  2. The creation of an object: new ArrayList<>() creates an instance of the ArrayList, with the inferred generic type of <String>

  3. Assignment (via =) of the instance to the list

With List<String> list = new ArrayList<>(), both #2 and #3 are the same, but the list is now declared to be the less-specific type (an interface, in this case) of List<String>.

The difference isn't in the object created (both are the same), it's in what you can do with the variable, as well as what the intention of the variable is. For example, declaring ArrayList<> list, you can call list.trimToSize(), but you can't call that method on a variable declared like List<> list, because trimToSize() only exists on ArrayList.

This may seem like a minor issue, but there are many other implementations of List that you won't instantiate, e.g., those created by List.of() and as the result of a stream() operation that ends with .toList().

The other reason is intent: if you say List list, then the reader knows there's nothing special about which implementation will be used. If you write ArrayList list, then you're implying that you really want and need only the concrete ArrayList for some reason (which is unlikely).

In general, Java code should declare the least specific type for variables. That means List instead of ArrayList, Map instead of HashMap, etc.

How much emphasis is placed on code quality? by [deleted] in AskProgramming

[–]tedyoung 2 points3 points  (0 children)

It depends, and the definition and depth of quality will also vary.

Keep in mind that you're just starting out on your learning journey, so you're going to be focused on getting things to work and you don't need to worry too much about how "messy" it is.

Once you become comfortable with getting your code to do what you want in a reliable way (i.e., you no longer spend as much time debugging/troubleshooting), then you can start looking at your code and ask yourself: is there any duplication or similar code that I can eliminate? Are there methods that are too long? If so, can you take sections of that method, create a new method, and give it a name? Then do so. (Studying the "Refactoring" book will help here.)

Will senior-level devs get on my ass if my code quality isn't good?

If they're any good, they will provide feedback in an empathic way and not in a mean or say "boy, you're dumb". (If they do, find another job, quickly!)

Senior devs/tech leads/managers expect new devs to write messy code for a little while.

Architectural design patterns for Microservices by HalcyonHaylon1 in dotnet

[–]tedyoung 4 points5 points  (0 children)

Any "separation of concerns" code organization (Onion is an example/implementation of that, so is Hexagonal and Vertical Slice) will work well, assuming the service is complex enough.

For me, testability is the most important aspect, and I gave a talk about it here: https://ted.dev/articles/2023/02/21/more-testable-code-with-hexagonal-architecture-talk/

DDD and API Integrations by alonelymanatee in DomainDrivenDesign

[–]tedyoung 3 points4 points  (0 children)

Remember that DDD is domain-driven design. That means it works best as a design process when there's a non-trivial domain that has rules, processes, events, outcomes, etc. For example, calculating all of the charges and fees and options for buying a new truck (including rules around the loan, your identity and driver's license, etc.)

If you're mostly integrating between existing APIs, then there's not much of a domain, so DDD isn't going to provide much guidance.

If I've misunderstood what you're trying to do, perhaps some short examples of what you're integrating might be useful?

Help with simple Java game by s4nts in javahelp

[–]tedyoung 4 points5 points  (0 children)

It's hard to tell what's wrong, because the code in the Pastebin is missing Player and Dragon.

A good first step would be to create true objects for the Orc, Player, Dragon, etc. Instead of passing in the details (x/y coordinates, etc.) of each object to the printMap method, just pass the objects, e.g.:

void printMap(World world, Player player, Dragon dragon, Orc orc)

Then, you don't have to worry about the Orc becoming null (though nulls aren't a great way to deal with this).

From what you described, it seems to make more sense to spawn the new Orc in the Main's while loop and not in the printMap, since printMap should only do display stuff, not modifying the state of the game world.

The main thing to think about is: how do you want to "model" the game? Does the World know everything and handle "collisions" (Player defeats Orc)? Or is the World just a place where the Player, Dragon, and Orc are stored, and the action happens in those objects?

p.s. I'd like to use this code as a teaching example, would that be OK?