frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

What British people mean when they say 'sorry'

https://www.bbc.com/travel/article/20260506-what-british-people-really-mean-when-they-say-sorry
1•BiraIgnacio•53s ago•0 comments

Anthropic leases Colossus 1 datacentre from Space X

https://www.ft.com/content/aa0239b8-0d57-4dc8-8c1a-ed7ac4d689fb
1•avianlyric•5m ago•0 comments

We Built an AI Recruiter That Conducts Interviews on Google Meet

https://brydg.app
1•sarh543•7m ago•0 comments

VCV Tower Vertical Construction Starts, Virginia's Tallest Building

https://constructionreviewonline.com/ls-greenlinks-vcv-tower-vertical-construction-starts-in-ches...
1•eatonphil•11m ago•1 comments

Show HN: Screen Adapt – auto-scaffolds responsive CSS and Tailwind variants

https://marketplace.visualstudio.com/items?itemName=ShawnKhoo.screen-adapt
1•Shawn_Something•15m ago•0 comments

Uninstalling Cilium from K3s

https://donotpassgo.me/posts/cilium-bpf-cleanup/
1•throwaway38294•15m ago•1 comments

DeepSeek V4 Pro at 75% off until 31 May

https://api-docs.deepseek.com/quick_start/pricing
4•nateb2022•18m ago•0 comments

App Store is hosting many clones of Google's discontinued Socratic app

https://apps.apple.com/us/iphone/search?term=socratic
1•tech234a•19m ago•1 comments

Pope Leo called his bank's customer service line. They hung up on him

https://www.usatoday.com/story/news/nation/2026/05/06/pope-leo-bank-customer-service-chicago/8996...
2•randycupertino•20m ago•0 comments

Hokusai's erotic art on display at a Kabukicho noh theater

https://www.japantimes.co.jp/culture/2026/04/25/art/shunga-art-exhibition-tokyo/
1•PaulHoule•22m ago•0 comments

Ads on Apple Maps

https://ads.apple.com/maps
2•Vortigaunt•22m ago•0 comments

Anthropic raises Claude Code usage limits, credits new deal with SpaceX

https://arstechnica.com/ai/2026/05/anthropic-raises-claude-code-usage-limits-credits-new-deal-wit...
6•koolba•23m ago•2 comments

Nevada AG files lawsuit against Discord: 'Go-to chat option for child abusers'

https://www.reviewjournal.com/news/civil-courts/nevada-ag-files-lawsuit-against-discord-go-to-cha...
3•anonymousiam•23m ago•0 comments

Show HN: Free tool to mark points and polygon regions

https://tack.pics
2•magikMaker•23m ago•0 comments

MicroSplit: Semantic unmixing of fluorescent microscopy data

https://www.nature.com/articles/s41592-026-03082-1
1•bookofjoe•27m ago•0 comments

Unmonitored Agents and a Local AI

1•jay_kyburz•29m ago•0 comments

Ask HN: Should show HN be renamed?

2•piratesAndSons•30m ago•0 comments

UK businesses brace for jet fuel rationing

https://bmmagazine.co.uk/news/uk-jet-fuel-shortage-rationing-goldman-sachs-warning/
27•OgsyedIE•34m ago•4 comments

Richard Dawkins concludes AI is conscious, even if it doesn't know it

https://www.theguardian.com/technology/2026/may/05/richard-dawkins-ai-consciousness-anthropic-cla...
4•embedding-shape•35m ago•0 comments

New Logic for Programmers (and the future of this newsletter)

https://buttondown.com/hillelwayne/archive/new-logic-for-programmers-and-the-future-of-this/
1•akshayshah•35m ago•0 comments

Grok Imagine Quality Mode API

https://x.ai/news/grok-imagine-quality-mode
3•surprisetalk•37m ago•0 comments

Late-night-regrets – piclaw-addons

https://rcarmo.github.io/piclaw-addons/addons/late-night-regrets/
1•rcarmo•37m ago•0 comments

Ten simple rules for optimal and careful use of generative AI in science

https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1013588
2•tacon•38m ago•0 comments

PawModel – Per-pet LoRA training for AI portraits that look acurate

https://pawmodel.com
2•cmackay•38m ago•0 comments

Show HN: Center-ish, 50 experiments related to centering content on a webpage

https://www.quaxio.com/centerish/
1•amenghra•39m ago•0 comments

The Enshittified States of America

https://www.thebulwark.com/p/the-enshittified-states-of-america
1•mooreds•42m ago•0 comments

David Sacks crashed and burned in the White House

https://www.theverge.com/column/925487/david-sacks-trump-administration-ai-model-review
38•PhotonHunter•43m ago•8 comments

The Disappearance of the Public Bench

https://placesjournal.org/article/the-disappearance-of-the-public-bench/
3•cainxinth•46m ago•0 comments

This Month in Redox – April 2026

https://www.redox-os.org/news/this-month-260430/
2•ladyanita22•47m ago•0 comments

Number of tokens shouldn't be the only metric

https://johnjwang.com/post/2026/05/06/tokens-shouldnt-be-the-only-metric/
1•johnjwang•49m 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.