frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Building a cheaper review loop for coding agents using Jev

https://oxtan-maker.github.io/parallix/articles/jev-review-evidence/
1•magnusekdahl•3m ago•0 comments

Alignment Is a System Property, Not Just a Model Property

https://zenodo.org/records/23585146
1•rayanpal_•4m ago•0 comments

Tokenomics at scale: Jamf built real-time spend enforcement for Amazon Bedrock

https://aws.amazon.com/blogs/machine-learning/tokenomics-at-scale-how-jamf-built-real-time-spend-...
1•ankitg12•6m ago•0 comments

Unauthorized AI agents are reportedly accessing US bank accounts

https://www.msn.com/en-us/news/other/unauthorized-ai-agents-are-reportedly-already-accessing-us-b...
1•gvieri•13m ago•0 comments

Synapse AI

https://techonward.co.ke
1•TommyTosh•15m ago•0 comments

LiveCoding in CommonLisp [video]

https://www.youtube.com/watch?v=xzTH_ZqaFKI
1•so-cal-schemer•16m ago•1 comments

ReactOS reaches major milestone with NTFS install support

https://arstechnica.com/information-technology/2026/10/reactos-reaches-major-milestone-with-ntfs-...
1•vintagedave•20m ago•0 comments

Show HN: Kuron – A 5-device airline system from one prompt, no code generated

https://claude.ai/artifact/UMMbf2FcV3ULi6d5WaW1yp
1•kofdai•21m ago•0 comments

The end of startups

https://evanjconrad.com/posts/end-of-startups
1•Anon84•26m ago•0 comments

An Explainer on the eMudhra Fiasco

https://finshots.in/markets/an-explainer-on-the-emudhra-fiasco/
1•vismit2000•29m ago•0 comments

Show HN: Saltmere, a browser-based city builder about sea-level rise

https://saltmere.thefinotin.com
1•saptashwa•29m ago•1 comments

A graphic explaining the drone rescue of a wounded Ukrainian soldier

https://www.reuters.com/graphics/UKRAINE-CRISIS/DRONE-RESCUE/znvngmqxzpl/
3•giuliomagnifico•32m ago•0 comments

The Current Situation of the Intensifying RAM Crisis

1•StizzurpXDD•32m ago•0 comments

I built COLAX – a campus app for NIT Warangal

https://play.google.com/store/apps/details?id=com.priyal.colax&hl=en_US
1•Priyalgang•35m ago•0 comments

The DNSSEC Root Signing Ceremony

https://www.cloudflare.com/learning/dns/dnssec/root-signing-ceremony/
1•maxall4•36m ago•0 comments

Show HN: Emails on Your Mac's Notch

https://gotemail.net/
3•nazbasho•36m ago•2 comments

A first for CRISPR: prime editing alters DNA directly in the human body

https://www.nature.com/articles/d41586-026-03371-x
1•frostbyte7•36m ago•0 comments

Owning C types from Rust code

https://lwn.net/Articles/1099015/
2•signa11•38m ago•0 comments

EU planned to scrap clock changes. Why are they still happening? – Euronews

https://www.euronews.com/2026/10/22/eu-planned-to-scrap-clock-changes-why-are-they-still-happening
3•xbmcuser•38m ago•0 comments

Show HN: Stenograf – Free offline transcription and translation for Android

https://play.google.com/store/apps/details?id=audio.soniqo.stenograf&hl=en_US
1•aufklarer•38m ago•0 comments

GCC development with large-language models

https://lwn.net/Articles/1098672/
1•signa11•39m ago•0 comments

Show HN: Audimind – Create audiobooks in one AI-powered workspace

https://www.audimind.ai
1•pagepeng•40m ago•0 comments

Why is AI-generated language so hard to understand?

https://arxiv.org/abs/2610.29162
3•Anon84•40m ago•0 comments

Cutting our inference bill by 68% by being obsessive about optimization

https://blog.cloudflare.com/obsessive-inference-optimization/
1•ryanskidmore•41m ago•0 comments

The First Gist on GitHub

https://gist.github.com/schacon/1
1•amanverasia•41m ago•0 comments

Designing an AI serving harness built to last

https://www.technologyreview.com/2026/10/22/1146109/designing-an-ai-serving-harness-built-to-last/
1•joozio•42m ago•0 comments

A neat trick I found for reusing physical memory

https://sebsite.pw/w/20260728-cow.html
1•signa11•43m ago•0 comments

Please Don't Mess with Links

https://maurycyz.com/misc/real_links/
1•stosssik•44m ago•0 comments

GitHub – mamund/APIs-and-agents: service choreography demos

https://github.com/mamund/apis-and-agents
1•fagnerbrack•44m ago•0 comments

Show HN: A TypeScript remake of Chinese Paladin (1995), now in English

https://github.com/IllegalCreed/type-pal
1•illegalscreed•48m 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.