frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Embraer Unveils First Saab F-39E Gripen Assembled in Brazil

https://aviationweek.com/defense/budget-policy-operations/embraer-unveils-first-f-39e-gripen-asse...
1•wslh•1m ago•0 comments

Apple discontinues the Mac Pro with no plans for future hardware

https://9to5mac.com/2026/03/26/apple-discontinues-the-mac-pro/
3•bentocorp•2m ago•0 comments

Show HN: A Kanban board where AI agents are first-class team members

https://agent-kanban.dev/
1•saltbo•5m ago•0 comments

Show HN: Zitrus – A 3DS SDK written in pure Zig

https://codeberg.org/GasInfinity/zitrus
1•gasinfinity•6m ago•0 comments

Workers who fall for 'corporate bullshit' may be worse at their jobs

https://www.theguardian.com/business/2026/mar/23/corporate-speak-study
2•mykowebhn•9m ago•0 comments

Show HN: Fio: 3D World editor/game engine – inspired by Radiant and Hammer

https://github.com/ViciousSquid/Fio
1•vicioussquid•9m ago•0 comments

The End

https://www.focalcurve.com/journal/the-end/
2•shminge•10m ago•0 comments

Deploytarot.com – tarot card reading for deployments

https://deploytarot.com/setup
3•rembish•13m ago•2 comments

Harness design for long-running application development

https://www.anthropic.com/engineering/harness-design-long-running-apps
1•rmuchall•14m ago•0 comments

Cloudflare's new Dynamic Workers ditch containers, run AI agent code 100x faster

https://venturebeat.com/infrastructure/cloudflares-new-dynamic-workers-ditch-containers-to-run-ai...
1•CharlesW•14m ago•0 comments

JCal – Jeffrey Epstein's Activities Recreated in Google Calendar

https://jmail.world/calendar
6•ilamont•16m ago•1 comments

Future Vision X Prize: One of the Largest SCI-FI Film Competitions

https://futurevisionxprize.com/
2•andersource•16m ago•0 comments

Ask HN: Personalized mRNA cancer vaccines, how real is the pipeline today?

3•imnotlost•17m ago•2 comments

How Much of AI Labs' Research Is Safety?

https://fi-le.net/safety-blogs/
2•mottiden•20m ago•0 comments

Tutorial: Analyzing Shell Scripts

https://blog.greenberg.science/posts/popl2026-tutorial/
2•vagozino•23m ago•0 comments

Global ocean heat content over the past 3M years

https://www.nature.com/articles/s41586-026-10116-3
2•CGMthrowaway•25m ago•0 comments

3-d genome reorganization foreshadows zygotic genome activation in Drosophila

https://www.nature.com/articles/s41588-026-02503-3
1•PaulHoule•25m ago•0 comments

Claude connects the dots on sleep apnea diagnosis

https://old.reddit.com/r/ClaudeAI/comments/1s41fny/25_years_multiple_specialists_zero_answers_one/
1•dnw•26m ago•0 comments

U.S. Stocks Have Their Biggest Drop Since Start of Iran War

https://www.nytimes.com/2026/03/26/business/oil-stock-gas-prices-iran.html
1•doener•26m ago•0 comments

I Put a Full JVM Inside a Browser Tab

https://bmarti44.substack.com/p/i-put-a-full-jvm-inside-a-browser
1•PaulHoule•29m ago•0 comments

The Little Book of C

https://little-book-of.github.io/c/books/en-US/book.html
1•ghostrss•31m ago•0 comments

New York City hospitals drop Palantir as controversial AI firm expands in UK

https://www.theguardian.com/technology/2026/mar/26/new-york-hospitals-palantir-ai
22•chrisjj•32m ago•4 comments

The Many Roots of Our Suffering: Reflections on Robert Trivers (1943–2026)

https://quillette.com/2026/03/25/the-many-roots-of-our-suffering-reflections-on-robert-trivers-19...
1•Petiver•32m ago•0 comments

Ask HN: Leaving Notion, Codebase as a Wiki?

2•kthaker1224•33m ago•1 comments

Engineers do get promoted for writing simple code

https://www.seangoedecke.com/simple-work-gets-rewarded/
1•dondraper36•35m ago•0 comments

AI comments drove Paul Graham off X notifications

https://twitter.com/gostroverhov/status/2037263858390147535
2•gostroverhov•36m ago•1 comments

Show HN: Photo Triager – Cull Raw Photos on iPhone/iPad with XMP Sidecars

https://photo-triager.junle.li/
2•lijunle•37m ago•0 comments

Show HN: Breakwater

https://www.breakwaterapp.com
2•stympy•37m ago•0 comments

Show HN: Illustrative – AI pipeline that turns books into graphic novels

https://arv.in/illustrative/
3•adangit•39m ago•0 comments

Agent Reliability Engineering

https://github.com/choutos/agent-reliability-engineering
1•choutos•40m 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.