frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Show HN: Littleguys – Claude Code, Codex and OpenClaw agents in your menu bar

https://littleguys.hervalicio.us
2•herval•4m ago•0 comments

Anthropic asks users to stop being mean to Claude

https://www.theregister.com/ai-and-ml/2026/10/09/anthropic-asks-users-to-stop-being-mean-to-claud...
1•alex_young•6m ago•1 comments

Ocudu 26.10 brings satellite connectivity to open-source 5G

https://www.linuxfoundation.org/press/ocudu-ecosystem-foundation-announces-ocudu-26.10-and-invite...
3•khalidkhair•13m ago•0 comments

Genkit Dart 1.0: Build production-ready agentic apps with Dart and Flutter

https://flutter.dev/blog/announcing-genkit-dart-1-0
1•khalidkhair•14m ago•0 comments

Why your AI agents can't reach the tools you're signed in to, and how to fix it

https://read.aindeev.com/p/why-your-ai-agents-cant-reach-the
3•alexeyindeev•20m ago•0 comments

Long-term memory for AI coding agents as a tree of plain files

https://github.com/gonzaroman/IHMT-MEMORY
3•gonzar79•21m ago•0 comments

Why Constant-Time Crypto?

https://www.bearssl.org/constanttime.html
2•signa11•23m ago•0 comments

Show HN: Markdownee – scrapes web into Markdown, own Trafilatura typescript port

https://www.markdownee.com/
1•seky•24m ago•0 comments

Mindset before tools: How to Win Innovation

https://architectureintel.com/mindset-before-tools-how-to-win-innovation-634ffc570ebb?postPublish...
4•younss•27m ago•1 comments

Sensor Fusion

https://en.wikipedia.org/wiki/Sensor_fusion
3•suopspaces•31m ago•0 comments

Generative AI scandal has come to one of Nikon's competitions

https://www.dpreview.com/news/generative-ai-scandal-has-come-to-one-of-nikons-competitions/
4•DASD•36m ago•0 comments

WallHop – 12ft.io is gone, so I built a replacement

https://wallhop.io/
43•TheWaffleHax•37m ago•22 comments

PSPi 6 – Raspberry Pi in a PSP

https://github.com/othermod/PSPi-Version-6
4•therepanic•38m ago•0 comments

Consistency is not a localized property

https://n-the-loop.com/blog/consistency-is-not-a-localized-property/
3•b-man•39m ago•0 comments

TypeScript-Native Frontend Framework

https://github.com/PureStackStudio/PureStack
4•koculu•40m ago•0 comments

Ask HN: Are iPhones the Handheld Version of Flock?

6•dfps•41m ago•0 comments

LLM Pareto Frontier over time [video]

https://www.youtube.com/watch?v=I01v36VIrno
5•ponyous•42m ago•1 comments

Stop Reaching for WebSockets by Default: WebSockets vs. SSE vs. Long Polling

https://medium.com/@anirbansingha20/websockets-vs-long-polling-vs-server-sent-events-fa9bc1644cb8
4•birdculture•54m ago•0 comments

Show HN: Free LED pixel-pitch and display-size calculators (open source)

https://boardsy.co.uk/free-exhibition-display-tools/
3•Boardsy•57m ago•0 comments

Supreme Court: 401(k) case over private funds and underperformance

https://www.cnbc.com/2026/10/10/supreme-court-case-401k-private-funds-intel.html
5•cramer4next•59m ago•0 comments

Pulp Cover Treatments of Classic Works of Literature

https://lithub.com/50-pulp-cover-treatments-of-classic-works-of-literature/
5•ohjeez•1h ago•0 comments

Veda: The First Agentic Hobby Operating System

https://github.com/vahmoh25/Veda
3•vahmohh•1h ago•0 comments

Microsoft Launches Surface Laptop Ultra, Surface RTX Spark Dev Box

https://www.servethehome.com/microsoft-launches-surface-laptop-ultra-surface-rtx-spark-dev-box/
2•teleforce•1h ago•0 comments

Ask HN: Why aren't Americans rising up against tipping?

25•bjourne•1h ago•59 comments

'We cannot accept foxes in our landscape': the plan to save Australia's wildlife

https://www.theguardian.com/australia-news/2026/oct/11/fox-australia-threatened-native-species-wi...
4•cisc•1h ago•0 comments

A minimal Rust TUI for managing GitHub repos and branches

https://github.com/jorgeandrecastro/github-workflow
6•drew0670•1h ago•1 comments

The 'black box' wastewater trade that rakes in millions for UK utility companies

https://www.theguardian.com/environment/2026/oct/09/uk-water-companies-industrial-commercial-wast...
7•cisc•1h ago•0 comments

Autonomous Delivery Skill

https://gist.github.com/EvanBoyle/8c1a97f682d92dab8c09d0e1ea73f4a0
4•gfortaine•1h ago•0 comments

Anthropic Bans Cruelty to Claude, Still Won't Say What It Protects

https://rews.cc/a/anthropic-bans-cruelty-to-claude-still-won-t-say-what-it-pro-bd99f6
45•ojosilva•1h ago•92 comments

Will We Ever Understand Dementia?

https://www.nytimes.com/2026/10/10/science/will-we-ever-understand-dementia.html
2•bookofjoe•1h ago•1 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.