frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Compile spreadsheets into standalone interactive TUIs

https://github.com/ralsina/sheety
1•nhatcher•59s ago•0 comments

Professor discovered lost medieval castle hiding inside a Victorian-era building

https://www.foxnews.com/travel/lost-medieval-castle-found-hiding-plain-sight-professor-spots-tell...
1•Vaslo•1m ago•0 comments

Show HN: Halv cut AI agent cost by 57.1% using Jev

https://halv.ai/blog/halv-swe-rebench-astra-42-pairs/
1•villaspedro•1m ago•0 comments

Framework Desktop with 192GB Ryzen AI Max 400 released for pre-order

https://frame.work/de/en/products/desktop-diy-amd-aimax400/configuration/new
1•mft_•4m ago•0 comments

Hanami, Why?: Introductions

https://aaronmallen.me/writing/hanami-why-introductions
1•ibobev•5m ago•0 comments

Open Source EDACrux EDA Toolchain Now at 1.0

https://edacrux.app/
1•martinfink•5m ago•0 comments

Branch Target Reuse: Spectre-v2 Attacks in JIT Engines

https://www.vusec.net/projects/btr/
1•ibobev•8m ago•0 comments

Ask HN: Ex-swe what part time did you pickup?

1•conqrr•8m ago•0 comments

"Good" AI

https://thoughts.wyounas.com/p/what-does-good-ai-mean
1•simplegeek•9m ago•0 comments

system design in depth: deep notes and case studies

https://system-design-in-depth.pages.dev/
2•yugtripathi•9m ago•0 comments

Stateless zero trust database schema drift detector in Go

https://veritect.vercel.app
2•mantle_labs•10m ago•0 comments

Ask HN: AI revived my durable delay queue project. Is it worth building on?

1•souravray•11m ago•0 comments

Surprisingly Complex Waves Reveal the Brain's Inner Workings

https://www.quantamagazine.org/surprisingly-complex-waves-reveal-the-brains-inner-workings-20260930/
1•ibobev•12m ago•0 comments

NYSE to Commence Delisting Proceedings Against Getty Images Holdings, Inc

https://www.morningstar.com/news/business-wire/20260929598647/nyse-to-commence-delisting-proceedi...
2•taubek•14m ago•1 comments

Diogo Almeida: Lies, Damned Lies, and Benchmarks

https://www.completeskeptic.com/p/lies-damned-lies-and-benchmarks
1•yarapavan•14m ago•0 comments

Buying a Spam Domain

https://cam-davis.com/blog/posts/buying-a-spam-domain
4•camd32•16m ago•0 comments

Continuing our infrastructure updates: What's changing in the coming months

https://www.reddit.com/r/modnews/comments/1wubgvt/continuing_our_infrastructure_updates_whats/
1•ChrisArchitect•16m ago•0 comments

I made Jev to talk to us like an LLM (almost)

https://github.com/zie1ony/jev-talks/blob/main/demo.gif
1•zie1ony•17m ago•1 comments

Back to the 90s: The Software Engineer Has All the Roles Again

https://martinelli.ch/back-to-the-90s-the-software-engineer-has-all-the-roles-again/
1•speckx•17m ago•0 comments

Agent, your network: How Meta's Muse agent works with Tailscale

https://tailscale.com/blog/meta-muse-ai-agent-tailscale
1•wrxd•18m ago•0 comments

Ask HN: Why isn't Proof-Carrying Code more popular?

1•nwah1•20m ago•0 comments

Show HN: Gatekeeper – Persuade a 34MB Jev-like model to let you into the castle

https://gatekeeper.dopp.sh/
1•mazlix•21m ago•0 comments

Show HN: Hedwig, a free and open-source alternative to Instantly and Smartlead

https://flyhedwig.com
1•gabceboli•22m ago•0 comments

North Korea Beyond Pyongyang [video]

https://www.youtube.com/watch?v=vM_tz35WUCM
1•shmilia•23m ago•0 comments

If You Think You Can Do Real-World Text-to-SQL

https://cacm.acm.org/opinion/if-you-think-you-can-do-real-world-text-to-sql/
1•yarapavan•25m ago•0 comments

Before pixels: Modular industrial dashboards

https://unsung.aresluna.org/before-pixels-modular-industrial-dashboards/
2•leephillips•28m ago•0 comments

The eruption that destroyed Pompeii is helping scientists date Earth's history

https://news.berkeley.edu/2026/09/25/the-eruption-that-destroyed-pompeii-is-helping-scientists-da...
3•gmays•28m ago•0 comments

The Homeless Community in Portland, Oregon That Became a Self-Governed Village

https://www.nytimes.com/2026/09/26/headway/portland-diginity-village-homeless-community.html
3•bookofjoe•28m ago•1 comments

a16z’s State of Markets II

https://a16z.com/state-of-markets-ii/
2•rafaelc•29m ago•0 comments

Jevstiller: Distill a repeated Jev classification task into a local model

https://github.com/tomerglick57/Jevstiller
2•simonpure•30m ago•0 comments
Open in hackernews

Ask HN: Java why put string in a constant?

1•ramsicandra•1y 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•1y 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•1y 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.