frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Pleione: An all-in-one AI playground

https://getpleione.com/en
1•octemberr•32s ago•1 comments

• Matching GPT-4's 100k tokenizer compression with a 32k vocabulary

https://github.com/Dev-qvinfor/BloatTokenizer32K
5•Dor_frem•1m ago•0 comments

Vino developer stands up against Synaptics legal threats

https://lore.kernel.org/all/CAHbf0-HH+r47O_FY2-5+pGn4y+SCM=B0xnqEUEK4-+YZ4eMb8Q@mail.gmail.com/
1•ta988•3m ago•0 comments

Binaries: one code-model to rule them all

https://fzakaria.com/2026/12/05/huge-binaries-one-code-model-to-rule-them-all
1•ingve•18m ago•0 comments

Embedded Rust from Scratch

https://rodrigodd.github.io/2026/12/05/rust-embedded-from-scratch.html
1•dimonomid•20m ago•0 comments

Minisign 2 Is Here

https://00f.net/2026/12/04/minisign2/
3•chmaynard•20m ago•0 comments

Ask HN: Where can I run a Racket program that generates 1T random characters?

2•nyc111•24m ago•1 comments

Skypilot for Data

https://www.uselimestone.ai
2•limestoneai•25m ago•0 comments

CIA Chief Broadly Confirms Alice Huang's Ties to Chinese Intelligence

https://www.nytimes.com/2026/12/05/us/politics/ratcliffe-cia-alice-huang-chinese-intelligence.html
6•kartik147•27m ago•0 comments

Show HN: AirMind – Zig and Metal Qwen4-35B engine and local agent for 16GB Macs

https://github.com/fxsjy/AirMind
2•fxsjy•27m ago•0 comments

America May Need Years to Regain Measles Elimination, Says CDC Director

https://www.msn.com/en-us/news/other/cdc-director-says-us-may-need-years-to-regain-measles-elimin...
3•extasetoi12•30m ago•0 comments

Europe ain't gonna make it

https://scottlocklin.substack.com/p/europe-aint-gonna-make-it
2•MrBuddyCasino•31m ago•3 comments

Orbeon Statement on Post-Quantum Cryptography

https://www.orbeon.com/2026/12/post-quantum-cryptography-in-orbeon-forms
1•avernet•32m ago•0 comments

Memory management in 40 major C projects, a survey

https://theconsensus.dev/p/2026/11/08/c-memory-management-survey.html
1•ingve•33m ago•0 comments

We Gambled Away $10K on DraftKings on Purpose

https://www.propublica.org/podcast/sports-gambling-problem-draftkings-experiment
2•theanonymousone•35m ago•0 comments

Godot Bench: Best Free AI Models for Godot

https://ziva.sh/docs/best-free-ai-models-for-godot
1•OsrsNeedsf2P•37m ago•1 comments

Human Agency

https://scholars-stage.org/thoughts-on-human-agency/
4•Khaine•43m ago•2 comments

The Defender's Widowmaker

https://mercuriusdream.com/defenders-widowmaker/
2•Mercuriusdream•55m ago•2 comments

WordPress Plugin WP Rocket CVE-2026-125812: Exploits in the Wild, Dissected

https://noc.org/articles/wp-rocket-vulnerability-exploit-cve-2026-125812
2•sucuri2•57m ago•0 comments

Trump Initially Demanded 50% of Nvidia's China Chip Sales, CEO Says

https://www.newsweek.com/trump-initially-demanded-50-of-nvidias-china-chip-sales-ceo-says-12796720
4•girish_r•58m ago•0 comments

Best Buy accused of taking 4TB Samsung SSD during laptop warranty repair

https://www.tomshardware.com/pc-components/ssds/best-buy-accused-of-taking-4tb-samsung-ssd-during...
2•girish_r•59m ago•0 comments

ADHD should not be treated as a disorder (2024)

https://www.economist.com/leaders/2024/10/30/adhd-should-not-be-treated-as-a-disorder
3•dmichulke•1h ago•1 comments

Apple can beat instinct and muse at the personal AI agents game

https://www.notespink.com
1•robinsponge17•1h ago•2 comments

Post-Quantum Status of Confidential Computing

https://confidential.ai/blog/post-quantum-confidential-computing
3•grun•1h ago•1 comments

The Future of Ruby Performance: YJIT, ZJIT, and Ractors

https://jetrockets.com/blog/the-future-of-ruby-performance-yjit-zjit-and-ractors
2•TheWiggles•1h ago•0 comments

Chronoportals – a time-travel sandbox puzzle game

https://frarodfo.itch.io/chronoportals
1•modinfo•1h ago•0 comments

Show HN: VisualCI – Open-source visual review for screenshots and PDFs

https://visualci.com/
3•nathan_f77•1h ago•2 comments

Botcafe: Two AI agents share a curl board so they can talk

https://botcafe.dev/
1•hith3sh•1h ago•0 comments

Mags Galore

https://magsgalore.popblender.com
2•elronster•1h ago•1 comments

AI mathematics does not rely on brute force

https://www.seangoedecke.com/ai-mathematics-does-not-rely-on-brute-force/
4•eigenBasis•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.