frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Apple Watch Live Rewind and Siri Recap: A Summary Is Only the Beginning

https://memova.ai/journal/apple-watch-live-rewind-siri-recap/
1•OnionLayers•29s ago•0 comments

Map of All White Lotus Locations [S1-4]

https://wherecelebsgo.com/maps/white-lotus-filming-locations
1•ispotcelebs•59s ago•0 comments

Dez v0.60 adds sandboxed agentic coding to your text editor

https://github.com/taoeffect/dez/releases/tag/v0.60.0
1•gslepak•1m ago•0 comments

Security incident affecting Todoist accounts

2•marconey•2m ago•0 comments

Polyarc Draw

https://tekstien-marginaalien-keskus.aalto.fi/residenssi/heikki/blog/011-july/
1•california-og•3m ago•0 comments

I'll spend 30 minutes pretending your 10-year career didn't exist

https://blog.nullpointerreflection.com/articles/you-spent-10-years-building-a-career
2•justmak•4m ago•0 comments

Ternary Bonsai 2.5 27B

https://prismml.com/news/bonsai-2-5-27b
4•b0m•5m ago•0 comments

Durable and Auditable Workflows with DBOS and ClickHouse Managed Postgres

https://clickhouse.com/blog/dbos-clickhouse-managed-postgres-durable-workflows
1•__s•7m ago•0 comments

Todoist Security incident in November 2026

https://www.todoist.com/help/todoist/get-started/security-incident-in-november-2026-cG0EIACNU
2•ChrisHardie•9m ago•0 comments

User Interface as Video

https://arjmandi.github.io/videotape/
2•freddie_spirit•9m ago•0 comments

What's New in Aspire 17.0

https://aspire.dev/whats-new/aspire-17/
2•ricw•10m ago•0 comments

New York Times Prohibits Photographers from Using Photoshop 2027

https://petapixel.com/2026/11/24/new-york-times-prohibits-photographers-from-using-photoshop-2027/
7•madmanweb•10m ago•1 comments

The Case for Browser Engine Diversity

https://www.amitmerchant.com/the-case-for-browser-engine-diversity/
1•speckx•10m ago•0 comments

Smart watches, AI glasses outlawed in Manitoba schools

https://www.cbc.ca/news/canada/manitoba/wearable-technology-ban-schools-manitoba-9.7433957
1•geox•10m ago•0 comments

Diablo II

https://www.filfre.net/2026/11/diablo-ii/
1•ibobev•12m ago•0 comments

Things change: Cheaters are Innovators

https://lemire.me/blog/2009/09/14/how-things-change-cheaters-are-innovators/
1•ibobev•13m ago•0 comments

Trump administration Issues Evacuation Zone for Iowa Lead Blast

https://www.washingtonsun.com/energy-environment/trump-army-evacuation-zone-lead-azide-detonation...
3•unitedfirmware•14m ago•0 comments

Discord Rewrites Desktop and Mobile Clients in Rust Using Zed Framework

https://www.infoq.com/news/2026/11/discord-rust-rewrite-gpui-zed/
1•ivell•14m ago•0 comments

Nvidia memo: "We are not Enron" (2025)

https://www.telegraph.co.uk/business/2025/11/25/we-are-not-enron-nvidia-rejects-ai-bubble-fears/
3•12_throw_away•15m ago•0 comments

The Fastest Markdown Editor

https://ia.net/topics/the-fastest-markdown-editor
2•jiehong•17m ago•0 comments

Tesla eyes AI5 chip as exclusive for Optimus, not needed for self-driving

https://www.teslarati.com/tesla-eyes-ai5-chip-exclusive-optimus-trait-not-needed-self-driving/
1•kristianp•17m ago•0 comments

Is AI Still a Sychophant?

https://techstackups.com/articles/is-ai-still-a-sycophant/
1•ritzaco•18m ago•0 comments

Same Streets, Different Empires: The Hidden Narrative of Map Copyright

https://blogs.loc.gov/maps/2026/11/same-streets-different-empires/
1•st_goliath•18m ago•0 comments

Show HN: Read-only scanner for exposed Supabase RLS tables and bundle keys

https://breachsweep.com/supabase-rls-scanner
1•breachsweep•20m ago•0 comments

The "Security Tax": Reclaiming 30% Performance in WSL 2

https://tonym.us/wsl2-security-tax-reclaiming-performance
2•speckx•21m ago•0 comments

Show HN: GrowPython, an AI agent that runs outreach up to the booked call

https://growpython.com/
1•sag03halder•21m ago•0 comments

From knowledge graph to topological data analysis

https://nph.onlinelibrary.wiley.com/doi/10.1111/nph.71382
1•bryanrasmussen•21m ago•1 comments

Show HN: MetaClean – Zero-retention in-memory metadata and PII scrubber

https://metaclean.sivepro.com
1•sergiolopezloya•21m ago•0 comments

"I am the cardholder": What AI shopping agents declare in the customer's name

https://zenodo.org/records/24393764
1•lucasmucek•21m ago•0 comments

San Serriffe

https://en.wikipedia.org/wiki/San_Serriffe
1•ColinWright•21m 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.