frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Show HN: Tokyo Trains

https://greggman.github.io/tokyo-trains/
1•greggman65•1m ago•0 comments

Electric Is Joining Databricks

https://electric.ax/blog/2026/08/11/electric-joining-databricks#electrifying-neon
1•drecoe•1m ago•0 comments

A Post-AI CTF Format Could Be a Research Retreat

https://jessicaruan.com/posts/save-ctfs
1•youngkipper•1m ago•0 comments

Why your Amazon order confirmation emails have become so unhelpful

https://www.theverge.com/ai-artificial-intelligence/977733/amazon-order-emails-google-gmail-ai-ag...
1•AdmiralAsshat•1m ago•0 comments

Show HN: Lance-bundle – Portable embeddings to embed once, query forever

https://github.com/cloudkj/lance-bundle
1•cloudkj•2m ago•0 comments

Harry Beck's Idea: A Lesson in Disruption

https://medium.com/design-bootcamp/harry-becks-radical-idea-a-lesson-in-disruption-6637fe2ac38e
1•duxup•2m ago•0 comments

Relevare: Self-driving AI enablement and modernization for non-technical teams

1•npb12•5m ago•0 comments

Show HN: Atlan, Your Mobile-Focused AI Agent

https://github.com/Atlansdaddy/atlan
1•Emirhan123•5m ago•1 comments

Apple Silicon and macOS VMs: 11–16× Faster LLM Inference with Llama.cpp

https://github.com/trycua/cua/blob/main/blog/gpu-passthrough-macos-vms.md
4•frabonacci•5m ago•0 comments

Show HN: Inkvoice – Open-source, self-hosted invoicing in a single SQLite file

https://github.com/pigontech/inkvoice
1•inkvoice•6m ago•0 comments

Allocating OpenRouter Costs

https://www.vantage.sh/blog/allocate-openrouter-costs
1•StratusBen•7m ago•0 comments

Launch HN: Keet (YC S24) – An app to create courses on anything

https://www.trykeet.com/
2•zackashen•7m ago•0 comments

Can Agents Use a Computer Yet? We've Got the Data

https://a16z.com/can-agents-use-a-computer-yet-weve-got-the-data/
1•adamhowell•8m ago•0 comments

New Way to Solve Integrals

https://math.stackexchange.com/questions/5139050/algebraic-integration-is-integration-by-parts-eq...
1•epyre•13m ago•0 comments

React-Native-Firebird

https://asfernandes.github.io/2026/08/09/react-native-firebird
1•mariuz•13m ago•0 comments

Line Breaks in Python and Unicode

https://www.b-list.org/weblog/2026/aug/10/newlines/
1•fanf2•14m ago•0 comments

Inventing ELIZA (Review)

https://ztoz.blog/posts/inventing-eliza-review/
2•Brajeshwar•14m ago•0 comments

CallEDD: A website that calls California EDD Paid Family Leave for you

https://infinitedigits.co/calledd/
1•surprisetalk•15m ago•0 comments

Show HN: OpenCycle – A fun, free virtual cycling platform

https://opencycle.net/
1•awormuth•15m ago•0 comments

Let Them Write RFCs

https://ohadravid.github.io/posts/2026-08-let-them-write-rfcs/
2•ohr•16m ago•0 comments

Show HN: The terminal I live in all day: comment on anything coding agents print

https://github.com/albertwujj/agent-term
1•aywu•16m ago•0 comments

Kitty Chases the Mouse

https://lwn.net/Articles/1080821/#Comments
1•leephillips•16m ago•0 comments

Activist charged with felony, gave border agent "duress code" that wiped phone

https://arstechnica.com/gadgets/2026/07/activist-charged-with-felony-after-giving-border-agent-du...
1•ColinWright•18m ago•0 comments

Woman Calls Out Dr. Wearing Smart Glasses During Consultation

https://www.fashiontimes.co.uk/patient-privacy-concerns-meta-smart-glasses-1762492
1•DemiGuru•19m ago•0 comments

Arizona's Illegal Surveillance Program Sweeps Up Financial Records

https://www.aclu.org/news/privacy-technology/how-the-arizona-attorney-general-created-a-secretive...
3•hedora•20m ago•0 comments

Show HN: Lemma – A declarative language for business rules

https://lemma.run/
3•benrogmans•21m ago•1 comments

I gave Claude's Reimann paper to GPT-5.6-Sol Pro. It's now 67.30%

https://twitter.com/kaizero_ainta/status/2087036655714890052
2•porridgeraisin•21m ago•0 comments

PyPI: The HTML representation of the index API is frozen

https://blog.pypi.org/posts/2026-08-11-html-index-is-frozen/
2•woodruffw•22m ago•1 comments

A layered HTML component system

https://profpowell.github.io/vanilla-breeze/
1•bartonhammond•22m ago•0 comments

2. Ask HN: We built a solution for 100B-node P2P. Does anyone care about this?

2•ikhrabry•23m ago•1 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.