frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Lake Ontario ("Lake America")

https://community.openstreetmap.org/t/lake-ontario-lake-america/146975
1•rdmuser•1m ago•0 comments

Show HN: AI-powered link building and SEO outreach, smarter

https://outreachlooper.com
1•not_wowinter14•2m ago•0 comments

Semantic Lightness and the Rise of LLMs

https://assertfail.gewalli.se/2026/08/23/Semantic-lightness-and-the-rise-of-LLMs.html
1•wallymathieu•3m ago•0 comments

We Let AI Agents Rewrite a 92M-Message-a-Day Service in Go

https://www.checklyhq.com/blog/agentic-rewrite-nodejs-to-go/
2•tnolet•6m ago•0 comments

Rui Ueyama: "We are rewriting the mold linker in Rust"

https://twitter.com/rui314/status/2094677980857680052
1•afdbcreid•6m ago•0 comments

BitCards – Computer Ads from the Past

https://computeradsfromthepast.substack.com/p/bitcards
1•rbanffy•8m ago•0 comments

Xbot.team – Read a Grok Bot's spec without opening the app

https://xbot.team
1•GrokBotVisbile•10m ago•0 comments

Can we stop AI from deceiving us?

https://www.theguardian.com/news/2026/sep/01/if-you-build-something-vastly-smarter-than-you-it-be...
1•Archelaos•11m ago•0 comments

Formatting as Courtesy to the Reader

https://tracydurnell.com/2026/08/31/formatting-as-courtesy-to-the-reader/
1•serhack_•12m ago•0 comments

Introduction to the NT kernel development (Part 1)

https://geob99.github.io/pages/nt-dev/nt-dev-part1.html
1•serhack_•12m ago•0 comments

Americans Still Skeptical That UFOs Are Aliens

https://news.gallup.com/poll/713765/americans-skeptical-ufos-aliens.aspx
1•helsinkiandrew•13m ago•1 comments

The Meaning of Liff

https://en.wikipedia.org/wiki/The_Meaning_of_Liff
1•Bluestein•14m ago•0 comments

AI Orchestrator that self-learns, run's teams and never sleeps

https://crewmoot.hellodexter.com/
1•dalekirkwood•15m ago•1 comments

Verba: Learn a language by talking to an AI never touches the internet

https://github.com/nuvocode/verba
1•timeoperator•15m ago•0 comments

Inside Colombia's Cocaine Factories

https://www.economist.com/interactive/1843/2026/08/28/inside-colombias-cocaine-factories
1•bookofjoe•16m ago•1 comments

Shein is a global slavery company masquerading as an e-commerce platform

https://en.wikipedia.org/wiki/Shein
2•matheusalmeida•20m ago•0 comments

Show HN: I built a live stream site where every spot is instantly AI-generated

https://videoai.me/live
2•Paul_Grsl•21m ago•0 comments

DuckDB Runs Recursive CTEs Faster

https://duckdb.org/2026/08/25/how-duckdb-runs-recursive-ctes-faster
2•boshomi•24m ago•0 comments

Nix Is Right. Its Cost Is Not

https://nrd.sh/blog/store-was-never-the-point.html
1•ssernikk•25m ago•0 comments

Raindrops are tiny lightning bolts, and they're corroding cars, study finds

https://arstechnica.com/science/2026/08/raindrops-are-tiny-lightning-bolts-and-theyre-corroding-c...
1•Archelaos•28m ago•0 comments

Initial USB4/Thunderbolt Support for Apple M1/M2/M3 SoCs

https://lkml.iu.edu/2608.3/12164.html
1•metrofun•29m ago•0 comments

Why the Way We Append Data to LLM Is Killing Our Cache and Model Attention

https://github.com/orbsh/wiki/blob/main/tail-prompt-optimization-en.md
1•orbsh•30m ago•0 comments

Claude, Codex, and Hermes installed unowned code inside corporate networks

https://arstechnica.com/security/2026/08/claude-codex-and-hermes-installed-unowned-code-inside-co...
1•nreece•35m ago•0 comments

I Tried Every AI Browser, Then Went Back to Safari

https://medium.com/@patricecunliffe/i-tried-every-ai-browser-then-went-back-to-safari-b43ccdeff7a5
3•syumei•35m ago•0 comments

Solaris

https://runway.com/news/research/introducing-solaris
1•o4c•36m ago•0 comments

Londoners Are Stewing over Supercar Tourists Who Park Wherever They Want

https://www.wsj.com/world/uk/london-middle-east-luxury-cars-parking-tickets-b1fb0f0c
2•JumpCrisscross•39m ago•0 comments

But where does taste come from?

https://dustycloud.org/blog/but-where-does-taste-come-from/
1•birdculture•40m ago•0 comments

FakeLinux: Run unmodified Linux binaries on macOS

https://github.com/ayourtch-llm/fakelinux
1•AbuAssar•41m ago•0 comments

Satellite connectivity on a €400 open-source industrial datalogger

https://docs.isurlog.isurki.com/blog/2026/08/31/ntn-on-the-nrf9151-low-cost-satellite-iot-without...
1•tecnica•45m ago•0 comments

AnkiDroid: Google Play no longer allowing Open Collective donation link

https://github.com/ankidroid/Anki-Android/issues/21656
76•hexa555•46m ago•4 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.