frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

"Good" AI

https://thoughts.wyounas.com/p/what-does-good-ai-mean
1•simplegeek•29s ago•0 comments

Nonfiction Is Struggling. Publishers Are Making It Worse

https://thewalrus.ca/nonfiction-is-struggling-publishers-are-making-it-worse/
1•simplegeek•1m ago•0 comments

A Lost Schrödinger Manuscript Reveals a Surprising Twist in Quantum Physics

https://www.sciencealert.com/a-lost-schrdinger-manuscript-reveals-a-surprising-twist-in-quantum-p...
1•ibobev•1m ago•0 comments

Cable theft causes Openreach broadband outage for thousands in Thurnscoe, UK

https://www.datacenterdynamics.com/en/news/cable-theft-causes-openreach-broadband-outage-for-thou...
1•GloVin•5m ago•0 comments

Compare grid features, side by side

https://comparegrids.com/features
1•davidvela•7m ago•0 comments

A framework for evaluating agentic AI systems

https://deepsense.ai/blog/your-agent-passed-the-eval-should-you-ship-it/
1•nvmdbljstm•10m ago•0 comments

Patch the Planet – The Trail of Bits Blog

https://blog.trailofbits.com/2026/06/22/introducing-patch-the-planet/
1•janandonly•13m ago•0 comments

Terminal Setup for macOS: ZSH and Oh My Zsh

https://solomk.in/posts/terminal-configuration
1•ankitg12•13m ago•0 comments

Compaction Laundering:Provenance Destruction in Context-Compacting Coding Agents

https://arxiv.org/abs/2610.29869
1•ersinesen•14m ago•0 comments

ChatGPT Ads as over 100k advertisers have used the platform

https://openai.com/index/chatgpt-ads-expands-26-new-countries/
2•haebom•17m ago•0 comments

Show HN: A stateless MCP server over our docs – search, list_topics, get_article

https://chinaready.co/docs/api/
2•martinliucn•19m ago•0 comments

ZK-irp-firewall: Zero-knowledge invariant enforcement for AI agents

https://github.com/trenttrinder1111-byte/zk-irp-firewall
3•trenttrinder111•19m ago•0 comments

A Markdown File Should Just Open

https://joshuamorris.info/notes/2026/10/13/a-markdown-file-should-just-open/
5•TheWoollyBully•21m ago•1 comments

Halloween Gothic Reading Pathway

https://www.betterreads.dev/blog/halloween-gothic-pathway
2•zlu•25m ago•0 comments

AI Agent Observability with OpenTelemetry

https://signoz.io/blog/opentelemetry-ai-agent-observability/
8•dhruv_ahuja•26m ago•0 comments

They Want Your Blood

https://www.theverge.com/column/1015563/blood-death-clock-longevity-apps-health-tech
2•saikatsg•28m ago•0 comments

Show HN: no-fi – a linter for the ASCII wireframes agents draw

https://github.com/p-a-u-l-i-e/no-fi
1•PaulVanOijen•31m ago•0 comments

Turning IPv6 tunnels into programmable delay lines for pulsing DoS

https://blog.apnic.net/2026/10/22/turning-ipv6-tunnels-into-programmable-delay-lines-for-pulsing-...
1•frostbyte7•33m ago•0 comments

Show HN: Aw-1 – Deterministic AST circuit breaker and kernel jail for AI agents

https://github.com/MvikManners/aw1-circuit-breaker
1•MvikVela•33m ago•0 comments

Digital Hygiene (2025)

https://karpathy.bearblog.dev/digital-hygiene/
1•vinhnx•35m ago•0 comments

Claude Code install script is down

https://downloads.claude.ai/claude-code-releases/bootstrap.sh
4•sspross•37m ago•0 comments

Chasing a Flake into OpenSSL's GCM Kloak Path

https://getkloak.io/blog/the-h-that-wasnt-there/
1•neo2006•39m ago•0 comments

Enterprises keep buying software upgrades that IT thinks will make things worse

https://arstechnica.com/information-technology/2026/10/survey-enterprises-waste-28-percent-of-sof...
2•joozio•40m ago•0 comments

"Ignore the Slop"

https://daniel.haxx.se/blog/2026/10/22/ignore-the-slop/
9•asimovDev•42m ago•0 comments

Accrescent: A novel Android app store focused on security, privacy and usability

https://accrescent.app/
1•teekert•46m ago•0 comments

Apple Ordered to Open iPhone to Rival App Stores in Australia

https://forums.macrumors.com/threads/apple-ordered-to-open-iphone-to-rival-app-stores-in-australi...
3•mjy78•48m ago•0 comments

As Politicians Argue About China, US Patients Find Cutting-Edge Treatment There

https://kffhealthnews.org/health-industry/china-cancer-drugs-foreign-travel-pharma-biotech-fda-re...
2•mathgenius•51m ago•0 comments

Show HN: git-found, fixes "Repository not found" with multiple GitHub accounts

https://github.com/advaith334/git-found
1•Advaith_12•52m ago•1 comments

Raycast Glaze

https://www.raycast.com/blog/meet-glaze
2•ankitg12•55m ago•0 comments

AI firms say UK has a year to head off datacentre protests

https://www.theguardian.com/uk-news/2026/oct/22/ai-firms-say-uk-has-a-year-to-head-off-datacentre...
3•beardyw•59m 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.