frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Show HN: Stop Destructive Agent Commands Before They Happen

https://github.com/christopherkarani/Orca
1•karc14•1m ago•0 comments

Show HN: Crew – Let Claude Code agents talk to each other

https://github.com/0xmmo/crew
1•mmoustafa•2m ago•0 comments

Linux Looking to Retire a Number of Old ARM Platforms in Early 2027

https://www.phoronix.com/news/Linux-Drop-Old-ARM-2027
1•maxloh•3m ago•0 comments

I am dreading our LLM-written incident report future

https://surfingcomplexity.blog/2026/06/19/i-am-dreading-our-llm-written-incident-report-future/
1•baxtr•3m ago•0 comments

Space startup Katalyst launches orbital rescue for aging NASA observatory

https://www.reuters.com/business/aerospace-defense/space-startup-katalyst-launches-orbital-rescue...
2•JumpCrisscross•11m ago•0 comments

NERM – a tamper-evident audit log that proves itself. Run it yourself

https://github.com/metacentric-tech/nerm-core
1•META-TECH•30m ago•0 comments

What a 1976 Washington Post prediction said about 2026

https://www.washingtonpost.com/history/2026/07/03/what-1976-washington-post-prediction-said-about...
2•reaperducer•32m ago•0 comments

The Age of Decision

https://www.threerulescompany.com/the-age-of-decision
1•dtedesco1•32m ago•0 comments

How Memgraph 3.11 Simplifies Multi-Tenancy for Cross-Database Graph Workloads

https://memgraph.com/blog/memgraph-3-11-multi-tenant-graph-workloads
1•taubek•37m ago•0 comments

Agentic coding notes from Galapogos Island

https://danluu.com/ai-coding/#appendix-agentic-loops-and-writing-this-post
24•gm678•37m ago•3 comments

Redundancy and Bloat Seen in AAA Game Engines

https://zero-irp.github.io/Redundancy-seen-in-AAA-game-engines/
1•davikr•53m ago•0 comments

What the AirCon Debate Says About Britain's Climate Insanity [video]

https://www.youtube.com/watch?v=HwS3l5uP168
1•Bender•54m ago•0 comments

Why A.I. Won't Steal All Our Jobs

https://www.nytimes.com/2026/06/30/opinion/ai-agents-steal-jobs-employment.html
1•reaperducer•56m ago•1 comments

FEOM – Windows GUI automation at 8ms, no GPU needed

https://github.com/a92070888-dev/mcp-os-native-automation
1•a92070888•59m ago•0 comments

PangolinMatrix – write down encoded passwords, not real ones

https://pangolinmatrix.com
2•corvina•1h ago•0 comments

Google reCAPTCHA Reverse Engineered

https://github.com/elyelysiox/recaptcha
3•Pelada•1h ago•0 comments

Where can I find or get in contact with farmers specifically in the US?

2•strapchay•1h ago•2 comments

We Heart It is back

https://weheartit.net/
1•djxjxjcjcjc•1h ago•0 comments

Dory: Docker and Linux containers, native to your Mac

https://augani.github.io/dory/
1•xyzzy_plugh•1h ago•0 comments

Reconstructing SQLite's float-to-text without reading the source

https://github.com/lucasolopes/haruspex
1•byolopes•1h ago•1 comments

EPA approves pesticides that may be considered forever chemicals

https://thehill.com/policy/energy-environment/5950487-epa-pesticides-forever-chemicals-pfas/
3•OutOfHere•1h ago•0 comments

Show HN: Void test: 6 frontier LLMs go silent on "Be silence." Live proof

https://getswiftapi.com/void-test
1•rayanpal_•1h ago•0 comments

Show HN: SmolSignal – signal copilot for Flipper Zero files

https://github.com/SmolNero/SmolSignal
2•edgar_ortega•1h ago•1 comments

Show HN: I replaced my $500/mo legal SaaS with an AI-generated toolkit

https://maxiporonga.gumroad.com/l/ytruk
1•promptalex53•1h ago•0 comments

Show HN: Earshot, a homebrew Claude Tag

https://github.com/Octember/earshot
1•octember•1h ago•1 comments

Maybe you should learn something

https://www.marginalia.nu/log/a_135_learn/
10•tylerdane•1h ago•2 comments

FemiCore Review 2026 – 7-Second Bladder Reset Method Explained

https://gamma.app/embed/FemiCore-Review-2026-7-Second-Bladder-Reset-Method-Explained-9yahcz6mepth...
1•wildriverreview•1h ago•0 comments

Show HN: Local privacy-first Microsoft Recall alternative with Gemma 4

https://github.com/ayushh0110/ScreenMind/blob/main/README.md
2•skye0110•1h ago•0 comments

MagicBookShelf – A modern reader for classic novels – Crime and Punishment

https://magicbookshelf.org/read/crime-and-punishment/
1•philipfweiss•1h ago•0 comments

Four-Byte Burger [video]

https://www.youtube.com/watch?v=i4EFkspO5p4
1•CharlesW•1h 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.