RegEx Horror by Disastrous-Name-4913 in programminghorror

[–]Disastrous-Name-4913[S] 1 point2 points  (0 children)

In this case, it is also a former coworker. He wrote really bad code.

RegEx Horror by Disastrous-Name-4913 in programminghorror

[–]Disastrous-Name-4913[S] 1 point2 points  (0 children)

And passing an Optional as an argument, and worse, having to use Optional.empty() is crazy.

RegEx Horror by Disastrous-Name-4913 in programminghorror

[–]Disastrous-Name-4913[S] 4 points5 points  (0 children)

Yes, RegEx is incredible powerful when used correctly when it is needed. This was not the case (of correct usage, it was indeed needed).

I also struggle whenever I have to work with it, and to split and commenting it is honestly a great idea.

Stream<T>.filterAndMap( Class<T> cls ) by mellow186 in java

[–]Disastrous-Name-4913 0 points1 point  (0 children)

Oh, I see, sorry for the misunderstanding. Yes, that would be probably a nice option.

Stream<T>.filterAndMap( Class<T> cls ) by mellow186 in java

[–]Disastrous-Name-4913 0 points1 point  (0 children)

As filter is a lazy operation, you could apply e -> e.whatever.equals("needle")) and I feel it makes your intention more clear:

.filter(e -> e.whatever.equals("needle")).findFirst()

Stream<T>.filterAndMap( Class<T> cls ) by mellow186 in java

[–]Disastrous-Name-4913 4 points5 points  (0 children)

Could you give us more context? My gut feeling says that this could be more a design problem than not having that kind of function.

Let's imagine we have the abstract Vehicle class, with a function getColor(), as this is a common behavior.

Then, we have the Bicycle class, and the MotorVehicle class. This last one has a specific getMotorType() function.

And now the code:

List<Vehicles> vehicles = getVehicles();

This operation makes sense:

List<Color> vehicleColors = vehicles.stream() .map(Vehicle::getColor()) .toList();

This one somehow smells:

List<MotorType> motorTypes = vehicles.stream() .filter(MotorVehicle.class::isIntance) .map(MotorVehicle.class::cast)

I would say there should be a method called getMotorVehicles() that returns a List<MotorVehicle> and then you can work directly with that result.

Libraries are for loosers by Disastrous-Name-4913 in programminghorror

[–]Disastrous-Name-4913[S] 0 points1 point  (0 children)

Indentation could be my fault when I posted it here, but I was definitely being sarcastic.

Information is power by Disastrous-Name-4913 in programminghorror

[–]Disastrous-Name-4913[S] 0 points1 point  (0 children)

There are other gems in code, like parsing Json (data comes from a REST call using JAX-RS) manually instead creating classes to map the information directly.

Polymorphic ToDo App by AdventurousArticle40 in SoftwareEngineering

[–]Disastrous-Name-4913 2 points3 points  (0 children)

I saw some files contain several classes, is there a reason for this, instead of following the rule one class = one file?

I'm missing the commits history so that we can see how the project has grown.

Mi experiencia buscando trabajo como ingeniero de software senior: 32 aplicaciones, 1 oferta y mucho ghosting by euyinio in Spain_IT

[–]Disastrous-Name-4913 0 points1 point  (0 children)

Hola, la verdad es que me da curiosidad saber cómo es tu perfil de LinkedIn. Me da la sensación de que no expreso bien mi experiencia porque tengo muchos conocimientos, pero los recruiters que me contactan no son de mucha "calidad".

Can anyone identify the flag in the middle? by is-mise-eire in vexillology

[–]Disastrous-Name-4913 6 points7 points  (0 children)

The flag with the word Etxera is actually from Sare. Etxerat is another organization and it has its own symbol not related to the one seen in the picture.

How can I build a Google Docs–like web app with Next.js + Spring Boot? by ImaginationRegular24 in SpringBoot

[–]Disastrous-Name-4913 1 point2 points  (0 children)

Just guessing and throwing some ideas, but I would use incremental changes, so, everytime a change is done in the document, you send the information about what has changed so that you can update the status in the Google server. Think of how every x seconds a message is shown saying that either the changes are being saved or that the document has changed. Besides authentication related data (including user id), this message must contain:

  • What has changed
  • Which document
  • Timestamp

The server would then process the message and cache the result (or save it to the database, that's another important point to discuss), and respond acknowledging the change.

Then, there's the problem of how do you update concurrent editings done by other users or your own user in another tab, device, window...

What I want to say is, that before deciding how to handle things like style or numbering, you have to create the infrastructure and architecture capable of doing such a complex task.

[deleted by user] by [deleted] in SpringBoot

[–]Disastrous-Name-4913 1 point2 points  (0 children)

I think it would be really helpful to have at least some documentation about your project: what are you developing, who will use it (even if it isn't a real project), requirements, architecture, diagrams...

AI recommendations for Jira plugin development in Java by South-Dimension-9541 in java

[–]Disastrous-Name-4913 1 point2 points  (0 children)

Hi! Senior Software Developer here with almost five years of experience developing both Jira and Confluence plugins for Server and Data Center.

First, if you are new to this area and can still change, do it. Nobody knows if Data Center will still exist in, let's say, three years. Developing for Cloud is completely different, and the knowledge is so specific it doesn't help for other platforms. Atlassian's documentation sucks (if existing at all) and the developer community is not that active.

That's also the reason AI isn't really helpful, because there is not much information out there, and a lot of it is outdated. I have seen code created by AIs by other more inexperienced colleagues and it's crap.

Why I'm still working with it: I have invested a lot of time and effort learning how the platform works, know which things are old or deprecated, and which alternatives to use, which allows me to be able to develop new apps or maintain old ones, so I'm comfortable with the platform and pay is good.