frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Show HN: Sidedesk – An AI assistant inbox that looks like Outlook 2003

https://github.com/sebastiandoyle/sidedesk
1•sebastiandoyle•8s ago•0 comments

Show HN: Discord CLI designed for agents to explore/read/send messages

https://github.com/famasya/discord-cli-agent
1•pacific01•7m ago•0 comments

Hide from Meta's spyglasses with this new Android app

https://www.theregister.com/2026/02/25/meta_smart_glasses_android_app/
1•zigmig•7m ago•0 comments

Russian mathematician finds new approach to 190-year-old 'eternal' math problem

https://www.msn.com/en-xl/science/mathematics/russian-mathematician-finds-new-approach-to-190-yea...
1•georgecmu•13m ago•0 comments

Tropical plants flowering months earlier or later because of climate crisis

https://www.theguardian.com/environment/2026/feb/25/tropical-plants-flower-shifted-months-climate...
2•andsoitis•15m ago•0 comments

Less is More when it comes to AI

https://www.bicameral-ai.com/blog/dogfood-bicameral
1•jinhkuan•16m ago•1 comments

The Remote-Work Dream Isn't Dead, but It's Slipping Away

https://www.wsj.com/lifestyle/careers/the-remote-work-dream-isnt-dead-but-its-slipping-away-a19ae9e8
3•RestlessMind•19m ago•0 comments

Show HN: Lingua Universale – session types and Lean 4 proofs for AI agents

https://github.com/rafapra3008/cervellaswarm
1•rafapra•20m ago•1 comments

Rising CO₂ and warming jointly limit phosphorus availability in rice soils

https://phys.org/news/2026-02-jointly-limit-phosphorus-availability-rice.html
1•PaulHoule•20m ago•0 comments

Show HN: Knox–Full Stack L1 Post-Quantum Privacy Crypto (Built with My 11yo)

https://github.com/ULT7RA/KNOXProtocol
1•KnoxProtocol•21m ago•0 comments

Show HN: Agentic Power of Attorney (APOA) – An open standard for AI agent auth

https://github.com/agenticpoa/apoa
1•juanfiguera•23m ago•0 comments

We left OpenAI because of safety

https://twitter.com/gothburz/status/2026810017593057739
3•mellosouls•23m ago•1 comments

Theory of Space

https://theory-of-space.github.io/
1•vinhnx•23m ago•0 comments

Divexa Exchange: Compliance in Low-Latency Systems

1•DanielOnBlock•24m ago•1 comments

Show HN: Right-click any text on macOS to add it to your calendar (open-source)

https://github.com/VimalMollyn/Right-Click-and-Add-to-Cal
1•mollynpaan•25m ago•0 comments

Show HN: Projekt – All-in-one workspace for building with agents

https://www.getprojekt.com/
1•bobbydotdesign•26m ago•0 comments

The Horrifying Truth Behind the 1990s Olestra Crisis

https://www.ranker.com/list/olestra-wow-chips-history-explained/jtdesaulnier
1•pkaeding•27m ago•0 comments

Add dormant user re-engagement email and improve name parsing

1•nishiohiroshi•29m ago•0 comments

Harness engineering: leveraging Codex in an agent-first world

https://openai.com/index/harness-engineering/
1•fmihaila•32m ago•0 comments

The man building Team USA's Olympic bobsleds

https://www.adirondackexplorer.org/community-news/people/lake-placid-man-builds-team-usas-olympic...
2•wrsh07•33m ago•0 comments

Ask HN: Apache prefork under crawler load – main domains OK, subdomains fail

1•PhongSGC•34m ago•1 comments

Schedule Recurring Tasks in Cowork

https://support.claude.com/en/articles/13854387-schedule-recurring-tasks-in-cowork
1•ed•34m ago•0 comments

Apple Foundation Models SDK for Python

https://github.com/apple/python-apple-fm-sdk
1•gok•38m ago•0 comments

Americans Are Leaving the U.S. in Record Numbers

https://www.wsj.com/us-news/americans-leaving-the-us-migration-a5795bfa
33•reaperducer•44m ago•8 comments

What I learned from 14,000 AI agent sessions

https://coasty.ai:443/
1•nkov47as•46m ago•1 comments

Why is your Mac WiFi Slow?

https://whyfi.network/
1•jamesgresql•48m ago•2 comments

Disrupting the Gridtide Global Cyber Espionage Campaign

https://cloud.google.com/blog/topics/threat-intelligence/disrupting-gridtide-global-espionage-cam...
1•0in•49m ago•0 comments

Code Is Cheap – Now What?

https://www.zackaryia.com/blog/2026-02-25/code-is-cheap-now-what/
1•Zackaryia•49m ago•1 comments

How to Thrive as a Remote Worker

https://spectrum.ieee.org/remote-work
1•jnord•50m ago•0 comments

Terra would have collapsed regardless of Jane Street

https://fragileequilibrium.substack.com/p/algorithmic-stablecoins-are-provably
2•brandoncarl•52m ago•0 comments
Open in hackernews

Ask HN: Java why put string in a constant?

1•ramsicandra•9mo 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•9mo 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•9mo 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.