frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Show HN: Clodcapture – save and resume Claude.ai chats across sessions

https://chromewebstore.google.com/detail/clodcapture/mhapejnhlmepeinjmlppoopcoicmgojb
1•leo_agent•1m ago•0 comments

Cherry Kearton: The eccentric influence on a young Sir David Attenborough

https://www.bbc.com/future/article/20260507-cherry-kearton-the-eccentric-influence-on-a-young-sir...
1•breve•5m ago•0 comments

Two more public disclosures, it will never stop

https://deadeclipse666.blogspot.com/2026/05/two-more-public-disclosures-it-will.html
1•Animux•5m ago•0 comments

Fuck You, Bambu Lab. Go Ahead, Sue Us

https://gamersnexus.net/fk-you-bambu-lab
2•pabs3•9m ago•0 comments

Anything that is underneath the cursor gets fed into Google's surveillance AI

https://mastodon.social/@mcc/116563821063587689
3•doener•11m ago•0 comments

RealtimePokerCalculator

https://www.mik.lt/RealtimePokerCalculator.zip
1•reztart•11m ago•0 comments

The Walled Garden of the Surveilled Web

https://kirill.korins.ky/articles/the-walled-garden-of-the-surveilled-web/
1•catap•12m ago•0 comments

Snack giant switches to black and white packaging as Iran war hits ink supplies

https://www.bbc.com/news/articles/c78k405j8pdo
1•breve•12m ago•0 comments

Show HN: Dexgram – Telegram to Codex Desktop Bridge for Windows

https://github.com/yashau/dexgram
1•yashau•14m ago•0 comments

Not so dusty: How tech is changing woodworking

https://www.bbc.com/news/articles/c747n11933eo
1•breve•15m ago•0 comments

Waymo recalls U.S. robotaxi fleet after vehicle swept away in flood

https://www.expressnews.com/business/article/waymo-recall-san-antonio-flood-22254607.php
1•zzzeek•16m ago•1 comments

OpenAI Trial – Greg Brockman's Journal

https://www.wsj.com/tech/musk-openai-trial-greg-brockman-diary-journal-6950270e
1•ilarum•19m ago•0 comments

Could At-Home Brain Stimulation Reduce Psychiatry's Reliance on S.S.R.I.s?

https://www.nytimes.com/2026/04/28/health/depression-at-home-brain-stimulation-fda.html
2•bookofjoe•19m ago•1 comments

Open source rule based guardrails for coding agents

https://github.com/falcosecurity/prempti/tree/main
1•knoxa2511•20m ago•0 comments

America is experiencing a productivity miracle

https://www.economist.com/finance-and-economics/2026/05/11/america-is-experiencing-a-productivity...
1•mackmcconnell•26m ago•0 comments

Turritopsis Dohrnii

https://en.wikipedia.org/wiki/Turritopsis_dohrnii
1•thelastgallon•28m ago•0 comments

Loading/running every LLM with 4M ctx in 3 clicks

https://old.reddit.com/r/Hugston/comments/1tbgrbb/4_million_ctx_for_every_ai_llm_model/
1•trilogic•28m ago•0 comments

DuckDB Quack Announcement [video]

https://www.youtube.com/watch?v=RQBhuL9Ve8g
1•fredguth•31m ago•0 comments

The Unmet Needs Index

https://www.convoke.bio/blog/introducing-the-unmet-needs-index
3•ray__•34m ago•0 comments

How AI Is Making Us All Dumber [video]

https://www.youtube.com/watch?v=eSABedBwZjQ
2•mooreds•36m ago•0 comments

All the demons hiding in your AIs

https://drtompollak.substack.com/p/all-the-demons-hiding-in-your-ais
1•gmays•36m ago•0 comments

Companies start getting tariff refunds after Supreme Court decision

https://www.cnbc.com/2026/05/12/trump-tariff-refunds.html
2•tcp_handshaker•36m ago•0 comments

Apple will soon start using AI-generated presenters on its Sales Coach app

https://9to5mac.com/2026/05/12/apple-will-soon-start-using-ai-generated-presenters-on-its-sales-c...
1•cdrnsf•37m ago•0 comments

Twin brothers wipe 96 government databases minutes after being fired

https://arstechnica.com/tech-policy/2026/05/drop-database-what-not-to-do-after-losing-an-it-job/
5•jnord•38m ago•1 comments

The revolt against I-Ready: Private equity-backed education software faces fury

https://www.nbcnews.com/news/education/iready-school-software-faces-parent-teacher-student-fury-r...
1•Umofomia•39m ago•0 comments

I Bought a "Junk" PSP from Japan: Here's How It Went

https://gardinerbryant.com/i-bought-a-junk-psp-from-japan-heres-how-it-went/
1•Kate0CoolLibby•39m ago•0 comments

Subvert: The music platform owned by its community

https://www.subvert.fm/
1•vectordust•40m ago•0 comments

Preview bill is now available

https://copilot-billing-preview.github.com/
1•predkambrij•43m ago•0 comments

Empathy as Principal Computation Substrate

1•mimoos•48m ago•0 comments

Two Thousand Line educational operating system released by Cornell University

https://github.com/yhzhang0128/egos-2000
3•argosopentech•53m ago•1 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.