frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Anthropic's pre-IPO valuation has officially hit $1T

https://xcancel.com/i/status/2048793675606659309
1•simonpure•1m ago•0 comments

Bettertrumpet: The volume mixer Windows never built

https://bettertrumpet.hiii.boo/
1•xammen•5m ago•1 comments

Turkey's underground city of 20k people (2022)

https://www.bbc.com/travel/article/20220810-derinkuyu-turkeys-underground-city-of-20000-people
1•thunderbong•13m ago•0 comments

The moderately easy problem of consciousness

https://www.noahpinion.blog/p/the-moderately-easy-problem-of-consciousness
1•nradclif•18m ago•0 comments

Anthropic's definition of safety is too narrow

https://jonathannen.com/anthropic-safety-too-narrow/
3•jwilliams•27m ago•0 comments

Engineering the Fashion Catalog of Summer 2026

https://rapidkt.com/pages/blog/engineering_the_fashion_catalog_of_summer_2026
2•greenpau•28m ago•1 comments

Show HN: 49Agents – Infinite canvas IDE for AI agents

https://github.com/49Agents/49Agents
2•alpadurza•28m ago•0 comments

The Man Behind AlphaGo Thinks AI Is Taking the Wrong Path

https://www.wired.com/story/david-silver-ai-ineffable-intelligence-reinforcement-learning/
1•fmihaila•29m ago•0 comments

Using native Rails rate-limits in production

https://amzcartshare.com/native-rails-rate-limits
1•hbroadbent•30m ago•0 comments

Agents can't choose between structure and flexibility

https://frontierai.substack.com/p/agents-cant-choose-between-structure
1•gmays•32m ago•0 comments

Ted Nyman – High Performance Git

https://gitperf.com/
2•gnabgib•33m ago•0 comments

FAA to begin collecting user fees for commercial launches

https://spacenews.com/faa-to-begin-collecting-user-fees-for-commercial-launches-and-reentries/
1•polalavik•41m ago•0 comments

Xiaomi MiMo-v2.5-Pro Open-Sourced: 1T Parameter Model

https://huggingface.co/XiaomiMiMo/MiMo-V2.5-Pro
2•gainsurier•54m ago•0 comments

Unreal Struggles with Renaming Stuff (and how to fix it)

https://larstofus.com/2026/04/26/how-unreal-struggles-with-with-renaming-stuff-and-how-to-fix-it/
1•caminanteblanco•55m ago•0 comments

portless – named .localhost URLs for Development

https://portless.sh/
2•bpierre•56m ago•0 comments

Google staff urge chief executive to block US Military AI use

https://www.ft.com/content/9270ce04-558c-44e8-816f-a40219cd5007
4•propagandist•57m ago•0 comments

Generative AI Vegetarianism

https://sboots.ca/2026/03/11/generative-ai-vegetarianism/
11•marvinborner•57m ago•10 comments

Google Staff Urge Pichai to Refuse Classified Military AI Work

https://www.bloomberg.com/news/articles/2026-04-27/google-staff-urge-pichai-to-refuse-classified-...
4•johnshades•58m ago•0 comments

People Using AI to Represent Themselves in Court Are Clogging the System

https://www.404media.co/people-using-ai-to-represent-themselves-in-court-are-clogging-the-system/
4•pavel_lishin•1h ago•0 comments

Professors Disturbed to Find Their Lectures Chopped Up and Turned into AI Slop

https://www.404media.co/asu-atomic-ai-modules-arizona-state-university/
4•pavel_lishin•1h ago•0 comments

AI App Builders vs. Traditional Development: Which Is Right for You?

https://aiappbuild-cb8b4jpw.manus.space/
1•nexus-build•1h ago•0 comments

To My Students

http://ozark.hendrix.edu/~yorgey/forest/00FD/index.xml
186•marvinborner•1h ago•74 comments

Samsung may post first-ever mobile division loss this year, blaming RAM crisis

https://9to5google.com/2026/04/22/samsung-is-increasingly-worried-about-first-ever-mobile-divisio...
1•webninja•1h ago•0 comments

Constellation Draw

https://neal.fun/constellation-draw/
2•webninja•1h ago•0 comments

Signs Your S3 May Be Slowing Down Your SoC

https://scanner.dev/blog/7-signs-your-s3-may-be-slowing-down-your-soc
1•flw_0311•1h ago•0 comments

Software engineering may no longer be a lifetime career

https://www.seangoedecke.com/software-engineering-may-no-longer-be-a-lifetime-career/
5•webninja•1h ago•4 comments

The Full-Cycle Agentic Experience

https://normalphd.substack.com/p/the-full-cycle-agentic-experience
1•dooku0721•1h ago•0 comments

Ask HN: Views on abilities of large cos to disrupt supply

1•sourcegrift•1h ago•1 comments

The Brink of Global Recession [audio]

https://www.theatlantic.com/podcasts/2026/04/david-frum-show-adam-posen-global-recession/686900/
1•BiraIgnacio•1h ago•0 comments

Global energy shock tests limits of oil reserves

https://mondediplo.com/2026/05/02energy
1•JumpCrisscross•1h ago•0 comments
Open in hackernews

Ask HN: Java why put string in a constant?

1•ramsicandra•11mo ago
I'm relatively new to Java. I often notice a pattern where there is a list of constant which value are equal to the name.

  class Constant {
    public static final String ALBUM = "album";
    public static final String NAME = "_name";
    public static final String DISPLAY_NAME = "display-name";
    public static final String SERVICE_NAME_METRIC_NAME_PREFIX = "service_name.metric_name";
  }

Here is a public example of this practice I could find: https://developer.android.com/reference/android/provider/MediaStore.MediaColumns

I could understand that this might help in 2 ways refactoring and typo. This reduces chance of typo because you'll get compile error instead of run-time error if you typo a constant. This might also help in refactoring if you ever wants to change the value. but if may use this android public API example, I don't think it's wise to change a field name ever. If it's decommissioned, it's good to keep it so we don't re-use the field. If it's a new better field available, I think it should have a different name. I maybe making a straw man argument here. Let me know. If it's an internal API where such refactoring might make sense -- I still kind of think internal API should also be backward compatible, replacing a string are not a complicated operation in my opinion.

I see that this practice has a cost. One being that in every class that use this API. You need to add an import. It's also often the const is only used once from my experience.

  import static com.example.MediaFields.NAME;
  import static com.example.MediaFields.DISPLAY_NAME;

  String value = json.getString(NAME);
  String value2 = json.getString(DISPLAY_NAME);
vs

  String value = json.getString("name");
  String value2 = json.getString("display_name");
You write 1 line for declaration plus 2 lines for each class using this API. This is not a big deal in terms of LoC and I'm not an LoC police. However, my sense is the cost outweigh the benefit.

What do you think?

Comments

lanna•11mo ago
You just made TWO typos: "display-name" vs "display_name" and "_name" vs "name", automatically counter-argumenting your point.

It is also for documentation. With the declared constants, we know all possible values. With plain strings, how am I supposed to know which values to use?

The benefits far outweigh the marginal cost.

ramsicandra•11mo ago
The -, _, and leading _ are just variations of white space / separator I have encountered. I think it's possible to document all the allowable values in the Javadoc section of the function that takes in string as their argument.

In the specific android example, I would put it here. Under projection params where it takes in all the Images.Media.* string consts.

https://developer.android.com/reference/android/content/Cont...

Though, if it's a practice of Java Engineer to document allowable enum like string as a constant, then I can say that's a valid argument.