frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

The age of a treacherous, falling dollar

https://www.economist.com/leaders/2026/02/05/the-age-of-a-treacherous-falling-dollar
1•petethomas•6s ago•0 comments

The End of Human Relationships

https://www.hackyexperiments.com/blog/the-end-of-human-relationships
1•bilater•38s ago•0 comments

I built a digital safe with multiple keys after a few too many bike concussions

https://eljojo.github.io/rememory/
1•eljojo•52s ago•1 comments

The Assault on Ukraine's Power Grid

https://www.newyorker.com/news/the-lede/the-assault-on-ukraines-power-grid
1•petethomas•59s ago•0 comments

Where Drupal Still Wins in 2026?

https://kokocinski.me/blog/where-drupal-still-wins-2026
1•firflant•2m ago•0 comments

Tesla likely can't escape 'Blade Runner 2049' lawsuit

https://www.reuters.com/legal/litigation/tesla-musk-likely-cant-escape-blade-runner-2049-lawsuit-...
1•jmkd•3m ago•0 comments

A tale of three kings (Python, Elixir, Go) (2017)

https://medium.com/@marcelo_lebre/a-tale-of-three-kings-e0be17a16e2b
1•tosh•4m ago•0 comments

Don't Look Behind the Curtains

https://rodyne.com/?p=3574
1•boznz•8m ago•0 comments

Show HN: Ironpad – Local-first project management with Git versioning

https://github.com/OlaProeis/ironPad
1•OlaProis•9m ago•0 comments

Irony alert: Anthropic helps UK.gov to build chatbot for job seekers

https://www.theregister.com/2026/01/29/irony_alert_anthropic_helps_ukgov/
1•myk-e•10m ago•0 comments

Consider F# (2024)

https://www.asfaload.com/blog/consider-fsharp/
1•tosh•16m ago•0 comments

The times Yann LeCun has been wrong about LLMs

https://old.reddit.com/r/LovingAI/comments/1qvgc98/yann_lecun_says_basing_agentic_systems_on_the/...
2•aurareturn•17m ago•0 comments

Crazy shit linkers do: Common Data (COMDAT) sections

https://fzakaria.com/2026/02/03/crazy-shit-linkers-do-common-data-comdat-sections
1•ingve•20m ago•0 comments

Ask HN: Resources on how and why these LLM's work

1•jaapz•22m ago•0 comments

Competence as Tragedy

https://crowprose.com/blog/competence-as-tragedy/
1•ahamez•23m ago•0 comments

Unleash endless fun with Baent Games

https://t5.baent.top/
1•LinkLens•25m ago•1 comments

HarfBuzz at 20

https://docs.google.com/presentation/d/1o9Exz1c-Lr-dJjA8dcBn_Vl_Y37cupmFzmclMjBE_Bc/view
1•behdad•25m ago•1 comments

Find the lowest prices on prescription drugs

https://trumprx.gov/
1•alexanderklein•30m ago•1 comments

New in /experimental mode in Copilot CLI: "Fleets"

https://twitter.com/_Evan_Boyle/status/2019497961777172488
1•mparramon•30m ago•0 comments

System Initiative Shutting Down

https://www.systeminit.com/
2•mikidi•31m ago•0 comments

Elon's tech tree is converging

https://www.youtube.com/watch?v=BYXbuik3dgA
1•MrBuddyCasino•33m ago•0 comments

From Roots to Reach: Network Resilience in Natural Disasters

https://blog.apnic.net/2026/02/06/from-roots-to-reach-network-resilience-in-natural-disasters/
1•jruohonen•34m ago•0 comments

Gokin: Go-Native CLI for AI-Assisted Coding with Gemini, DeepSeek, GLM, Ollama

https://github.com/ginkida/gokin
1•ginkida•34m ago•1 comments

Macau's Grand Emperor hotel rips up lobby floor to sell off gold bricks

https://www.theguardian.com/world/2026/feb/06/macau-grand-emperor-hotel-lobby-gold-bricks
1•c420•35m ago•0 comments

I used Gemini to build an all-in-one Chrome extension, and uninstalled 10 others

https://chromewebstore.google.com/detail/fireai-all-in-one-ai-assi/jgpmkbgjngmhibgebdbekognpdoagoag
1•icefunc•36m ago•0 comments

Is C-rating marketing, or does it still matter for LiPo packs?

1•nicole_chen•36m ago•1 comments

Show HN: TurboLibBMP 0.1.1 – single-header BMP in C (no allocations, embedded)

1•DenisDolya•38m ago•0 comments

Serenity Prayer

https://en.wikipedia.org/wiki/Serenity_Prayer
1•baxtr•38m ago•0 comments

Jeffrey Epstein Interview [video]

https://www.youtube.com/watch?v=oIEYmflX090
3•max_•39m ago•1 comments

SQLite in Production? Not So Fast for Complex Queries – Yyhh.org

https://yyhh.org/blog/2026/01/sqlite-in-production-not-so-fast-for-complex-queries/
1•Onavo•57m ago•0 comments
Open in hackernews

Ask HN: Java why put string in a constant?

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