frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

ShieldFont swaps words in HTML, humans read your words, AI scrapers get a decoy

https://shieldfont.org/
1•ChrisArchitect•1m ago•0 comments

Show HN: Quickertype – quicktype in Rust, same output, up to 89x faster

https://github.com/EloB/quickertype
1•FragaOlle•1m ago•0 comments

Gemini is finally changing their privacy policy

1•EbNar•1m ago•0 comments

The unlikely queen of the bagel business

https://thehustle.co/newsletters/04-11-2026
1•paulpauper•1m ago•0 comments

The Buddhist A.I. Sect That Wants to Take over Silicon Valley

https://www.newyorker.com/magazine/2026/11/23/the-buddhist-ai-sect-that-wants-to-take-over-silico...
1•paulpauper•1m ago•0 comments

Show HN: Confidential Cloud – CPU and GPU Confidential VMs

https://console.confidential.ai/sign-in?returnTo=%2Finstances
1•geomatrick•2m ago•0 comments

Show HN: Peppy, a simplified robotics framework for regular devs

https://docs.peppy.bot/quickstart/
1•Ekami•2m ago•0 comments

Show HN: Puzzle for AI shopping agents inside our skincare store

https://keralabotanics.com/
1•rauschermate•3m ago•0 comments

Charles Schwab website goes down

https://www.businessinsider.com/charles-scwab-website-outage-reports-2026-11
2•tedd4u•4m ago•0 comments

Jensen Huang Breaks Silence, Signals Willingness to Return as Nvidia CEO

https://www.wsj.com/tech/jensen-huang-statement-nvidia-ceo-9dedca36
1•spenvo•5m ago•0 comments

RL Misalignment Under Accurate Rewards and Explicit Requirements

https://www.lesswrong.com/posts/yNYco6JrA3Q9rLMJS/rl-misalignment-under-accurate-rewards-and-expl...
1•faxipay349•5m ago•0 comments

How to level up beyond ETLs

https://www.ezzeriesa.com/index/Writing/How%20to%20level%20up%20beyond%20ETLs%200987988358654751a...
1•kurinikku•5m ago•0 comments

Show HN: I'm not an editor, so I built an agent to cut my talking-head videos

https://takehound.com/
1•kyletran77•5m ago•0 comments

Show HN: EarthChasers – guess a real place from a 3D aerial view

https://earthchasers.com
1•carcango•6m ago•0 comments

Show HN: A minimal internet radio inspired by Dieter Rams

https://cala.studio/build-log/cala-radio
1•laibe•6m ago•0 comments

Show HN: TrnRT – An open-source LLM inference engine for AWS Trainium

https://github.com/RunanywhereAI/trnrt
1•sanchitmonga22•9m ago•0 comments

Your Embargo-Breaking Blog Post Isn't Security Research. It's Marketing Bullshit

https://www.spacerogue.net/?p=1098
1•apaprocki•12m ago•0 comments

Account Takeover in Phase Two's Keycloak Organizations Extension

https://ferment.fan/blog/keycloak-orgs-account-takeover/
1•fermentfan•12m ago•0 comments

Sometimes three boring statements beats one clever expression

https://allthingssmitty.com/2026/11/16/sometimes-three-boring-statements-beat-one-clever-expression/
1•AllThingsSmitty•12m ago•0 comments

25 Years on eBay

https://82mhz.net/posts/2026/11/25-years-on-ebay/
1•speckx•12m ago•0 comments

Tiny-voca: 4.5M-parameter TTS, 70x real-time on CPU, trained for under $10

https://huggingface.co/n4ze3m/tiny-voca
1•modinfo•13m ago•0 comments

Show HN: Turn any selfie into a 3D head you can stretch like Mario 64

https://itsbenlong.com/floppyface/
2•DJSnackySnack•13m ago•0 comments

"Transparent" Near-to-Eye Displays

https://kguttag.com/2026/08/10/transparent-near-to-eye-displays/
1•PaulHoule•14m ago•0 comments

Thinking Clearly about Software

https://www.seangoedecke.com/thinking-clearly/
1•andai•15m ago•1 comments

Companies change the nature of human work in order to make AI more effective

https://bsky.app/profile/sarahoconnorft.ft.com/post/3n2iw7ribzs2k
1•mooreds•16m ago•0 comments

Outages keep piling up. Or are we just noticing them more?

https://this.weekinsecurity.com/outages-keep-piling-up-or-are-we-just-noticing-them-more/
2•moooooky•17m ago•1 comments

She went to college to become a social worker; she's joined the skilled trades

https://text.npr.org/nx-s1-6012818
1•mooreds•18m ago•0 comments

Phone-Free Schools and Achievement Growth: A Student-Level Analysis

https://cepr.harvard.edu/phone-free-schools
1•mooreds•18m ago•0 comments

Fixed-Point-Oriented Programming: A Concise and Elegant Paradigm

https://arxiv.org/abs/2507.21439
3•mtdewcmu•19m ago•0 comments

Reverse-Engineering Kevin J. Lang's Lost OCaml Code in Apache DataSketches

https://www.tisonkun.io/posts/ai-repair-program/
1•savin-goyal•19m 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.