frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

State of Harness Engineering

https://www.harness-hub.org/reports/2026-10
1•dbgrman•3m ago•0 comments

GitLab's new 60 req/HR rate limit has a fatal flaw: It blocks the login page

https://docs.gitlab.com/user/gitlab_com/rate_limits/
1•yaledioma•4m ago•0 comments

AI is making niche software viable

https://muddy.jprs.me/posts/2026-10-28-ai-is-making-extremely-niche-software-viable/
1•jprs•4m ago•0 comments

More Ambitious Products

https://probsteide.com/notes/more-ambitious.html
1•probst•4m ago•0 comments

Xlibre, Nouveau, and the Art of Getting Banned from Telegram

https://aliveos.org/news/xlibre-nouveau-and-telegram-bans/
1•jamapy•5m ago•0 comments

A Texas Cop Signed on to Help ICE Deport His Neighbors. It Tore the Town Apart

https://www.propublica.org/article/deportations-ingram-texas-287g-jaron-alexander
2•PaulHoule•5m ago•0 comments

Deepgram is acquiring Daily, makers of Pipecat

https://deepgram.com/blog/daily-pipecat-deepgram
1•pavlov•7m ago•0 comments

LLM Voice

https://martinfowler.com/bliki/LLM-Voice.html
1•ibobev•8m ago•0 comments

Finland investigate Google over destruction of 250k trees

https://yle.fi/a/74-20254086
2•DeepLogin•8m ago•0 comments

Show HN: I built a tamper-evident flight recorder for AI agents

https://github.com/mnestiq/mnestiq
1•lynceus•11m ago•0 comments

Show HN: Boil – Make a logo animate like it was drawn by hand

https://boil.brint.dev/
1•brint-dev•11m ago•0 comments

Former GitHub CEO launches rival Git forge built for AI coding agents

https://www.geekwire.com/2026/former-github-ceo-launches-rival-platform-built-for-ai-coding-agents/
3•indigodaddy•12m ago•1 comments

Advisories in Five Months: Results from the Drupal AI Security Initiative

https://www.drupal.org/blog/256-advisories-in-five-months-results-from-the-drupal-ai-security-ini...
1•wondersky•13m ago•0 comments

Posit Assistant makes better use of your token budget than leading coding agents

https://opensource.posit.co/blog/2026-10-29_ai-newsletter/
1•ionychal•13m ago•0 comments

Show HN: Dead APIs – a graveyard for the integrations that left us

https://deadapis.dev/
1•gertjandewilde•13m ago•0 comments

Lasm: Write formally verified web apps in Lean, deploy to Node, serverless, edge

https://github.com/Millillion/lasm
1•lastmjs•14m ago•1 comments

VanishMe: Remove your address from Google and 300+ data broker sites

https://vanishme.co/
1•eustoria•15m ago•0 comments

Coarse_stat_fs: Zero-syscall access to /proc/self/{stat, schedstat}

https://github.com/htfy96/coarse_stat_fs
1•htfy96•15m ago•0 comments

Speeding up eBPF filepath checks

https://neilnaveen.dev/posts/speeding-up-ebpf-filepath-checks/
4•neil_naveen•15m ago•0 comments

React.lazy, Suspense and the Hidden 300 ms Delay

https://tabwidgets.com/blog/react-lazy-suspense-delay
3•ctrlt•15m ago•0 comments

Chess Cheat Detector v3: Strong Players Are No Longer Mistaken for Engines

https://chesscheatdetector.com/blog/chess-cheat-detector-v3
1•trgfdffd•16m ago•0 comments

Show HN: Howler, a macOS menu bar AI that burns the chat after reading

https://github.com/HiAriesZhou/Howler
2•AriesIMio•16m ago•1 comments

Show HN: Rowsend: Desktop app for email marketing on your own DB and SES

https://rowsend.com/
1•itsrakesh•17m ago•0 comments

Fabrik – A Place to Meet New People IRL

https://www.joinfabrik.com/
1•eustoria•17m ago•0 comments

Configure a UPS on Linux with NUT

https://linuxjunkies.org/guides/configure-a-ups-with-nut
1•eustoria•18m ago•0 comments

Useless but Fun?

https://aired.sh/p/3d4BG6Ywy9
1•dizzy_diz•18m ago•1 comments

Show HN: Grip – Open-Source Screen Studio Alternative for Mac

https://bestboy.dev/grip
2•szymeo•19m ago•0 comments

PyTorch 2.15 Release Blog

https://pytorch.org/blog/pytorch-2-15-release-blog/
2•wondersky•19m ago•0 comments

Rethinking the tech writing portfolio in the AI age

https://passo.uno/tech-writing-portfolio-howto/
1•theletterf•19m ago•0 comments

We benchmark LLMs at PostHog on practical tasks with real data

https://posthog.com/blog/how-to-benchmark-ai-agents
1•sortafreel•19m 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.