frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

How Google is drafting AI chatbot laws around the country

https://www.npr.org/2026/09/18/nx-s1-5968878/ai-chatbots-safety-regulation-google
1•andsoitis•2m ago•0 comments

Giveaway Bot Services

https://discord.com/oauth2/authorize?client_id=1547251904277651578&permissions=4503599627783232&i...
1•jotajx•3m ago•0 comments

Nvidia's Jensen Huang rejects AI extinction warnings as "doomsday narratives"

https://www.cbsnews.com/news/jensen-huang-nvidia-rejects-ai-extinction-warnings/
2•AlexDragusin•5m ago•0 comments

ReBarUEFI: Resizable BAR for almost any UEFI system

https://github.com/xCuri0/ReBarUEFI
1•nateb2022•6m ago•0 comments

OpenAI Sees Burning Through $278B by 2030: FT

https://www.bloomberg.com/news/articles/2026-09-18/openai-projects-burning-through-278-billion-by...
2•sbulaev•7m ago•1 comments

The Roman Space Telescope, explained and up to date

https://romantelescope.info/
1•smcnally•10m ago•0 comments

The Pain Axis: LLMs Represent Self-Directed Harm and Act to Relieve It

https://arxiv.org/abs/2609.16247
1•Anon84•10m ago•0 comments

Show HN: Pollresults.org – free US election opinion poll API

https://pollresults.org
1•ronbenton•12m ago•0 comments

Chasing Speed of Light on TPU v6e

https://www.sailresearch.com/blog/tpu-v6e-gemma
2•simonpure•13m ago•0 comments

1k careers. One universe. Sign up not necessary

https://epie.life/
1•krnmythicx•19m ago•0 comments

Ask HN: Anyone Played with Jetson Orin Nano Super?

1•prologic•22m ago•0 comments

Show HN: Gdocs-me-up: a high-fidelity Google Docs exporter

https://github.com/behdad/gdocs-me-up
1•behdad•27m ago•0 comments

OpenPrompt – one workspace for developers using multiple AI coding tools

https://openprompt.tech
1•harafernando•29m ago•0 comments

Masked LFW (MLFW) Database

http://whdeng.cn/MLFW/index.html
1•teleforce•30m ago•0 comments

CostRift

https://costrift.com
1•DavidFerreira•31m ago•0 comments

Jev, Prolog, Pi, and the dream of probabilistic logic programming

https://deepclause.substack.com/p/jev-prolog-pi-and-the-dream-of-probabilistic
3•schmuhblaster•32m ago•0 comments

Why back propagation goes backward

https://gregorygundersen.com/blog/2018/04/15/backprop/
2•andsoitis•32m ago•0 comments

Recursive Cognitive Optimization (RCO)

https://github.com/sealvlon/Recursive-Cognitive-Optimization-RCO-
1•sealvarezl•37m ago•0 comments

Trump says it's time to rebrand AI with a new name

https://techcrunch.com/2026/09/19/trump-suggests-rebranding-ai-with-a-new-name-says-hes-also-crea...
2•GymInMeCricket•38m ago•2 comments

Can You Beat Jev?

https://antics.gg/can-you-beat-jev
1•eric_khun•44m ago•1 comments

Sub-15ms, non-autoregressive, local drop-in alternative to TypeSafe Jev

https://github.com/wfzyx/von
2•0x1997•47m ago•0 comments

Models know when they're reward hacking – and we can catch them at scale

https://www.goodfire.com/research/reward-hacking-activation-monitors
1•gmays•48m ago•0 comments

Fundamental Theorem of Calculus [Slop]

https://www.proofatlas.ai/library-theorems/fundamental-theorem-calculus/
1•throwyonion•50m ago•0 comments

Show HN: Vsqrd – AWS for Biology Experiments

https://vsqrd.com/
1•misterchocolat•53m ago•0 comments

The First Ten Years

https://gregorygundersen.com/blog/2025/01/30/first-ten-years/
1•andsoitis•54m ago•0 comments

Succinct Sounds-Like Starting Vowels

https://wiredream.com/vowels/
1•dgacmu•55m ago•0 comments

Show HN: Lain, a structural code graph and agent coordinator for coding agents

https://github.com/spuentesp/lain
2•spuentesp•58m ago•1 comments

Two similar AI judges fail together 7.7x more often than independence predicts

https://github.com/LAWLESS1987/covenant
2•Lawless1987•1h ago•0 comments

A refined phylochronology of the second plague pandemic in Western Eurasia

https://www.pnas.org/doi/10.1073/pnas.2534899123
1•Thevet•1h ago•0 comments

How I view LLMs as Sept 2026

https://bhardwajrish.blogspot.com/2026/09/how-i-view-llms-as-sept-2026.html
1•crearo•1h ago•0 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.