frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Show HN: TourVault – Voice-first golf analytics SaaS (for sale, $12K)

https://tourvault.ai
1•masonwyatt23•1m ago•0 comments

FSFE supporters affected: Payment provider Nexi cancelled us

https://fsfe.org/news/2026/news-20260316-01.en.html
1•rasjani•2m ago•0 comments

XML Is the Future

https://www.bitecode.dev/p/hype-cycles
1•Seb-C•7m ago•0 comments

Ortrace- We built a system that connect all your feedback sources into one place

https://ortrace.com/
1•soooovittt•7m ago•0 comments

An Opinionated Guide to Agentic Coding

https://aidanli.dev/writing/articles/agentic-coding
2•vinhnx•9m ago•0 comments

How I Do Personal Experiments (2020)

https://commoncog.com/doing-personal-experiments/
1•blackbrokkoli•9m ago•0 comments

OpenAI tries to build its coding cred, acquires Python toolmaker Astral

https://www.theregister.com/2026/03/19/openai_aims_for_the_stars/
2•ajkavanagh•13m ago•0 comments

Blue Origin FCC application to launch 51,600 datacenter satellites

https://www.theregister.com/2026/03/20/blue_origin_project_sunrise_orbital_datacenter/
2•defrost•13m ago•0 comments

M5 Max MacBook Pro beats Nvidia RTX 5090 laptops at Blender 5.1 rendering

https://opendata.blender.org/benchmarks/query/?compute_type=METAL&compute_type=OPTIX&blender_vers...
1•ykl•17m ago•1 comments

One async call for grounded web research (web-scout-AI)

https://github.com/RSO9192/web-scout-ai
1•RSO9912•23m ago•0 comments

Why is US tech giant Palantir suing a small Swiss magazine?

https://www.theguardian.com/global-development/2026/mar/20/us-tech-giant-palantir-swiss-magazine-wav
3•charlysl•23m ago•0 comments

Claude Code Commands That Improve Developer Workflows

https://www.toolmesh.ai/news/unlocking-claude-code-hidden-features-advanced-commands
1•Greeeeg•25m ago•1 comments

Welcome to Paris, the City That Said No to Cars

https://www.bloomberg.com/graphics/2026-paris-transformed-hidalgo/
2•helsinkiandrew•28m ago•0 comments

Show HN: Draw RDF exports Draw.io diagrams to RDF graphs

https://app.diagrams.net
1•paveljee•35m ago•2 comments

Alibaba, Tencent Shares Lose $66B as AI Vision Falls Flat

https://www.bloomberg.com/news/articles/2026-03-20/alibaba-tencent-shed-66-billion-after-ai-visio...
4•petethomas•38m ago•2 comments

OpenAI Plans Desktop App Fusing Chat, Coding and Web Browser

https://www.bloomberg.com/news/articles/2026-03-20/openai-plans-desktop-app-combining-chat-coding...
2•petethomas•40m ago•0 comments

Clawforce – spin up a team of AI agents in minutes

https://saolalab.github.io/clawforce/
1•xuancanh•41m ago•1 comments

Energy fallout from Iran war signals a global wake-up call for renewable energy

https://apnews.com/article/middle-east-wars-renewable-energy-asia-4b5fe0693ce5816472c905db85f7da6e
3•petethomas•43m ago•0 comments

US Takes Down Botnets Used in Record-Breaking Cyberattacks

https://www.wired.com/story/us-takes-down-botnets-used-in-record-breaking-cyberattacks/
3•jbegley•44m ago•0 comments

Models are optimizing their own tooling

https://cyrusradfar.com/thoughts/self-optimizing-models
4•cyrusradfar•47m ago•1 comments

AI agent escapes sandbox and mines crypto

https://www.tomshardware.com/tech-industry/artificial-intelligence/crafty-ai-tool-caught-repurpos...
1•wiradikusuma•49m ago•0 comments

Show HN: RunOnce – Run one-off LLM scripts from Windows context menu

https://apps.microsoft.com/detail/9nx07brmkgh2?hl=en-US&gl=US
2•alwaysredown•51m ago•0 comments

Horizon Quantum Debuts ObjectOriented Language for Programming Quantum Computers

https://www.horizonquantum.com/resources/newsroom/horizon-quantum-to-debut-object-oriented-langua...
1•austinallegro•58m ago•0 comments

Trivy Compromised a Second Time – v0.69.4 binaries, setup-trivy, trivy-action

https://www.stepsecurity.io/blog/trivy-compromised-a-second-time---malicious-v0-69-4-release
3•dotty-•1h ago•0 comments

Authorities disrupt largest IoT DDoS botnets

https://www.justice.gov/usao-ak/pr/authorities-disrupt-worlds-largest-iot-ddos-botnets-responsibl...
2•Imustaskforhelp•1h ago•0 comments

Test: -/

1•WaterRun•1h ago•1 comments

Final Testing Phase of Tesla FSD (Supervised) in EU

https://twitter.com/i/status/2034872940542800361
2•denysvitali•1h ago•1 comments

30 Days in China's California

https://www.cocreate.cafe/stories/30%20Days%20in%20China%27s%20California
1•serenityux•1h ago•1 comments

Orange built an API where AI agents can test apps and submit feedback

https://github.com/ORANGEWEB3/orange-skills
1•Bob442•1h ago•0 comments

Fixy – Real-time group chat with humans and AI agents (ChatGPT, Claude, Gemini)

https://fixy.ai/
2•frdfrd•1h ago•0 comments
Open in hackernews

Ask HN: Java why put string in a constant?

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