frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Facility monitoring cybersecurity in Middle East is impacted by NSA outage

https://www.independent.co.uk/news/world/americas/us-politics/nsa-outage-georgia-middle-east-b308...
1•monkeydust•36s ago•0 comments

United States vs. Tunick (1:25-cr-00499)

https://www.courtlistener.com/docket/71998357/united-states-v-tunick/
1•questionedon•37s ago•0 comments

An inspiral of a star inside a common envelope with its giant companion

https://arxiv.org/abs/2611.23470
2•titusblair•53s ago•0 comments

NASA Science Data Powers New Method to Discover Hard-to-Find Pulsars

https://science.nasa.gov/open-science/fermi-data-pulsar-discovery/
2•titusblair•1m ago•0 comments

Dashlane's experience and feedback of Web Extensions Platform

https://github.com/w3c/webextensions/blob/main/_minutes/2026-10-29-wewg-wecg-tpac-dashlane-feedba...
2•lapcat•2m ago•0 comments

PHP: Mixed-case HTTPS and FTPS URLs can expose data in plaintext

https://github.com/php/php-src/security/advisories/GHSA-f6gg-rchx-xw8j
1•fortran77•3m ago•0 comments

Make (no) mistakes: on Patrick Stewart, correctness, and life

https://minhanhday.substack.com/p/make-no-mistakes
2•mday404•3m ago•0 comments

The New Docker: Built to Run on Trust

https://www.docker.com/blog/meet-the-new-docker-built-to-run-on-trust/
2•jamietanna•4m ago•0 comments

I Built Pixelchennai.com with Agent.cloud

https://lossfn.com/blog/pixel-chennai/
2•speckx•4m ago•0 comments

Amber Eye: a Slay the Spire engine approaching top-level play

https://8e9f.github.io/amber_eye/
1•gcmeplz•5m ago•0 comments

Shared-memory multithreading, fault isolation, fibers, and SIMD for Perl 5.40

https://github.com/stratum42/perl5-mt/
1•stratum42•8m ago•0 comments

Show HN: Local Graph for Your Agents

https://github.com/vmikhailov/cypher-mcp
1•vmikhailov•9m ago•0 comments

Project Gryffindor: Meta's plan to get more school kids using Instagram

https://www.npr.org/2026/11/18/nx-s1-6037808/meta-instagram-schools-teens-safety
3•elo2000•10m ago•0 comments

Open Is How Robotics Wins

https://www.eliothorowitz.com/blog/2026/11/18/open-is-how-robotics-wins/
1•hasheddan•12m ago•0 comments

Widthipedia

https://vole.wtf/widthipedia/
1•bookofjoe•12m ago•0 comments

Markdown Web Advances

https://frankmcpherson.blog/2026/11/18/markdown-web-advances.html
1•speckx•13m ago•0 comments

Anthropic hits $2T in Nasdaq debut

https://www.reuters.com/business/finance/anthropics-historic-debut-put-ais-promise-peril-wall-st-...
7•wslh•14m ago•1 comments

We measure your voice instead of your brainwaves

https://medium.com/@6thMind/why-we-measure-your-voice-instead-of-your-brainwaves-345cb518d155
2•smanuel•15m ago•0 comments

Why assessing market fit for healthcare startup has different rules

https://davidngo1562.substack.com/p/its-not-about-the-money-until-it
3•illidan1000•15m ago•0 comments

The F'ed Up Version of Weekend at Bernies: Dead but Dreaming of Electric Sheep

https://lareviewofbooks.org/article/paul-tremblay-dead-but-dreaming-electric-sheep-horror/
1•paimapi•17m ago•0 comments

Microsoft is killing To Do and telling you to "choose another" app

https://www.windowslatest.com/2026/11/19/microsoft-is-killing-to-do-and-telling-you-to-choose-ano...
2•taubek•17m ago•0 comments

Show HN: An open-source harness for Android devs in the terminal

https://github.com/Apple-Pie-AI/pie-tui
1•gerardosuarez•18m ago•0 comments

Discovery: Fail-closed authority checks for AI agent tool calls (v1.0-v1.1.8)

https://github.com/2fastthompson/the-discovery
1•2fastthompson•19m ago•0 comments

Samsung, Tesser to collaborate on nuclear-powered LNG carrier

https://world-nuclear-news.org/articles/samsung-tesser-to-collaborate-on-nuclear-power-lng-carrier
1•PaulHoule•19m ago•0 comments

Why did the BASIC compiler cost less than the BASIC interpreter?

https://devblogs.microsoft.com/oldnewthing/20261117-00/?p=112866/
4•aray07•19m ago•0 comments

My Least Favorite Example in Software Engineering

https://buttondown.com/hillelwayne/archive/my-least-favorite-example-in-software-engineering/
2•aray07•20m ago•0 comments

Chrome AI Features Wasting Much Bandwidth

https://perishablepress.com/chrome-ai-wasting-much-bandwidth/
7•speckx•22m ago•0 comments

Anthropic stock is now trading live on the NASDAQ (symbol: ANT)

https://www.nasdaq.com/market-activity/stocks/ant
8•blinding-streak•23m ago•4 comments

Microsoft to Do Is Retiring

https://support.microsoft.com/en-us/planner/to-do-to-planner
3•Qazpqaz•25m ago•0 comments

Ruminating: A story in forty-eight seconds and five days

https://chapsoft.com/dispatches/ruminating
1•rkohn•25m 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.