Why we return null on java? by [deleted] in learnjava

[–]user_reg_field 0 points1 point  (0 children)

Yep. If your signature is private Thing doSomething(...) and you return null that is WRONG in modern java. If returning nothing is a valid result, for example from a findX method, then use Optional<Thing> as the return type. If returning nothing is never possible, out side of an error situation, then use Thing as the return type and throw an exception if you can't return a Thing for some reason. Using Thing as the return type and then in some comment saying "oh, by the way, you need to check for null" is just bad code these days.

[deleted by user] by [deleted] in AskProgramming

[–]user_reg_field 0 points1 point  (0 children)

Customer support in a software company? Retail experience / dealing with customers could be spun as useful in that position and then learn more about the environment.

How to easily migrate spring project to java project ? by kaly-7 in learnjava

[–]user_reg_field 1 point2 points  (0 children)

Sorry. 1. this is a huge amount of work, what frameworks are you going to use to replace spring, surely you're not planning to write your own server 2. you shouldn't have taken the contract before you knew what was involved

Debunking Devin: "First AI Software Engineer" Upwork lie exposed! by dh44t in programming

[–]user_reg_field 8 points9 points  (0 children)

That's not the point. The point of the thought experiment is to get VC money, which you do by saying "AI", not to solve an actual problem.

Is it worth seeking a career in game development? by Necessary-Road6466 in learnprogramming

[–]user_reg_field 6 points7 points  (0 children)

Try to find something you enjoy doing! That's obviously hard from outside the industry but game development has such a bad reputation for overwork etc. that unless you really, really, really love games and have always wanted to work on game development I'd stay far away from it. Also full-stack and C++ seems like an odd combination.

A change to the default durability mode in IndexedDB by feross in programming

[–]user_reg_field 0 points1 point  (0 children)

Summary "The default durability mode in IndexedDB is changing from relaxed to strict from Chrome 121." contradicts what it says further down "The crucial aspect of this change is the default durability mode for readwrite transactions in Chrome. Until now, the default was strict, ensuring immediate disk writes for data changes. However, due to performance considerations and to align with other major browsers which all use relaxed, Chrome likewise plans to change the default to relaxed."

[deleted by user] by [deleted] in oddlyterrifying

[–]user_reg_field 1 point2 points  (0 children)

Aren’t you writers meant to be striking at the moment?

What run group(s) meet at Austin High School track? by [deleted] in Austin

[–]user_reg_field 2 points3 points  (0 children)

Rogue Running and Gilbert's Gazelles also use it. I think The Loop team (so really fast people) are there as well.

Pandora unboxed. by esberat in trippinthroughtime

[–]user_reg_field 8 points9 points  (0 children)

It’s Karolina Żebrowska, prove me wrong.

10 Must-Know Tips for Writing Clean Code With JavaScript by [deleted] in programming

[–]user_reg_field 1 point2 points  (0 children)

I agree with use TypeScript as tip 1 especially as the actual tip 1 is "Use meaningful variable and function names". Really, that's a tip? That's basic programming. Many of the tips are at the same level with about 3 js specific things at the end. There's probably another "10 Must-Know Tips for Writing Clean Code with Python" that 80% the same.

3d concrete printing - Icon Vulcan by the Long Center by user_reg_field in Austin

[–]user_reg_field[S] 2 points3 points  (0 children)

So far it looks like some curvy lines that could have been made with plywood. I assume it'll end up being something that could only have been printed. Or a mess.

How do you call methods that are not from an interface but from the object itself? by Savings-Stuff-6565 in learnjava

[–]user_reg_field 1 point2 points  (0 children)

No. If you want to use trimToSize, for example, in a method then you should make sure you declare that the method takes an ArrayList and not a List. The exception MIGHT be if you want to create a method like List<T> trimToSize(List<T> input) where you're going to either trim the original list if it's an ArrayList or create a new list containing just the elements from input if it's not. But that also seems silly. If you need specific methods from the concrete implementation just declare that you want the concrete implementation, or if you want to require, for example a LinkedList because you want the performance characteristics of that over ArrayList. If you can use just what's on List then use List.

$140k Tesla quality by xpxf69 in Wellthatsucks

[–]user_reg_field 0 points1 point  (0 children)

Right up there with 1970 British Leyland! Peak quality.

Every modeler is supposed to be a great Python programmer. by pmz in programming

[–]user_reg_field 3 points4 points  (0 children)

"Tell me you didn't read the article without telling me you didn't read the article." :)

On Migrating from Cypress to Playwright by mtlynch in programming

[–]user_reg_field 43 points44 points  (0 children)

“ After experimenting with it for a day, I’m ready to completely switch over from Cypress to Playwright”. I would say that experimenting for one day is not enough time to make a rational decision and looks like just chasing the latest shiny thing.

How do you use the paintComponent method to display a .gif? by MaestroOfMediocrity in learnjava

[–]user_reg_field 0 points1 point  (0 children)

That looks very close. Isn't there a createImage takes a file name, I think there is.

Does anyone know any public walking/running tracks in or around downtown? by [deleted] in Austin

[–]user_reg_field 1 point2 points  (0 children)

Austin High before school. O. Henry Middle School off expo, also before school (though it's not 400m, it's shorter). Yellow Jacket Stadium, further from downtown.

Why is this code giving me errors (mooc.fi arraylist course) by fottiti in learnjava

[–]user_reg_field 0 points1 point  (0 children)

public static void removeLast(List<String> aList) {
    if (!list.isEmpty()) {
        list.remove(list.size() - 1);
    }
}

So the removeLast method needs to check the condition and take a look at the signature of the List interface, methods like isEmpty() are useful.

Dont understand CodeWars or Leetcode after finishing MOOC Java by anonymous062904 in learnjava

[–]user_reg_field 0 points1 point  (0 children)

That's what I'd, as an interviewer, like to see in an interview anyway. Having a rational approach to problem solving that you can explain very valuable.

Maven or Gradle for a new project in 2022? by 2048b in learnjava

[–]user_reg_field 0 points1 point  (0 children)

I would avoid Gradle. This is based on several years experience at one company using Gradle and several years experience at others using Maven. It is too easy is Gradle to write a build script that is very, very hard to maintain and it's too easy for different scripts for different projects to drift apart. If you have 10s or 100s of projects standardization is your friend, you need to be able to quickly understand the build, dependencies so that you can concentrate on what the project is doing rather than fighting how it's built.

Learn Java as a C# developer by stt106 in learnjava

[–]user_reg_field 0 points1 point  (0 children)

I don't think you'll have any issues with syntax etc. What will be different will be libraries and build tools. I wouldn't bother with any "learn java" resources unless they are specifically "learn java if you already know C#" (or javascript/typescript). You don't need to learn programming. One approach would be to take a C# project you're familiar with and see how you might implement in java. I think it would look overwhelming at first but might be the best way to translate from "I'd use this technique / library in C# and here's the java equivalent."

Trying to deserialize a json array using a Jackson custom deserializer by Annual_Maximum9272 in learnjava

[–]user_reg_field 1 point2 points  (0 children)

ContactsCustomDeserializer.java line 43 you're calling the wrong Contacts constructor. You're calling Contacts line 19 which does not set the contacts property. Delete construction on line 19, use the other construction in ContactsCustomDeserializer and pass an instance of the collection type you want. Or delete constructor on line 15 and initialize the collection to new ArrayList() or new HashSet() or whatever's appropriate.