frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Password Storage

https://ciamweekly.substack.com/p/password-storage
1•PretzelFisch•34s ago•0 comments

Citigroup set to cut about 1k jobs this week

https://www.reuters.com/sustainability/citigroup-is-set-cut-about-1000-jobs-bloomberg-news-report...
1•geox•1m ago•0 comments

Show HN: StatefulSet Backup Operator v0.0.3–Configurable snapshots, Redis tested

https://github.com/federicolepera/statefulset-backup-operator
1•lep_qq•1m ago•0 comments

Node.js Tuesday, January 13, 2026 Security Releases

https://nodejs.org/en/blog/vulnerability/december-2025-security-releases
1•syvanen•2m ago•0 comments

Show HN: DSAT – Data Subject Access Toolkit

https://codeberg.org/erkinalp/dsat
1•anticensor•2m ago•0 comments

Software Is Mostly All You Need

https://softwarefordays.com/post/software-is-mostly-all-you-need/
2•jbmilgrom•3m ago•0 comments

Pentagon is embracing Musk's Grok AI chatbot as it draws global outcry

https://www.cnbc.com/2026/01/13/pentagon-is-embracing-musks-grok-ai-chatbot-as-it-draws-global-ou...
1•teekert•4m ago•0 comments

The rise (and future fall) of Discord (2024)

https://slugcat.systems/post/24-12-12-the-rise-and-future-fall-of-discord/
1•birdculture•5m ago•0 comments

Apple and Google's AI partnership announcement spells AI wrong

1•pnrth•5m ago•0 comments

Show HN: OneView – Autopilot for Marketing Data

https://oneviewhub.com/
2•lunarrocket•7m ago•0 comments

Overflow: React Flow component library for user-friendly diagrams and flows

https://github.com/synergycodes/overflow-ui
2•diagrammode•8m ago•1 comments

Show HN: Analyze JUnit test files in the browser

https://reportoire.kaafihai.com
1•azan-n•9m ago•1 comments

Hatch: A Modern Approach to Python Project Management

https://hatch.pypa.io/1.16/
1•lailaDar•9m ago•2 comments

US inflation remains at 2.7% according to Dec 2025 CPI report

https://www.bls.gov/news.release/cpi.nr0.htm
1•Agreed3750•9m ago•0 comments

You can't parse [X]HTML with regex

https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags
2•redbell•10m ago•0 comments

A Growing Passport Divide Reshapes Global Mobility in 2026

https://www.henleyglobal.com/newsroom/press-releases/henley-global-mobility-report-january-2026
1•Brajeshwar•10m ago•0 comments

X Is Down

6•takoid•10m ago•4 comments

Command Bars

https://chriscoyier.net/2022/12/18/command-bars/
1•Brajeshwar•10m ago•0 comments

OPA Policies Without Breaking the Bank

https://danielfm.me/posts/opa-policies-without-breaking-the-bank/
1•danielmartins•10m ago•0 comments

Gas Town Emergency User Manual

https://steve-yegge.medium.com/gas-town-emergency-user-manual-cf0e4556d74b
1•virtualSatai•10m ago•2 comments

The Gypsy document editor: celebrating 50 years

https://digitalseams.com/blog/the-gypsy-document-editor-celebrating-50-years
1•Brajeshwar•10m ago•0 comments

Show HN: AI Mime – Record and parameterize workflows for Computer Use agents

https://github.com/prakhar1114/ai_mime
1•prakharjain•11m ago•0 comments

A happy path for Racket in the Collatz benchmark

http://gus-massa.blogspot.com/2026/01/a-happy-path-for-racket-in-collatz.html
1•gus_massa•12m ago•0 comments

Show HN: Built a tool so that you can track where your LLM costs are headed

https://www.watchllm.dev/
1•Kaadz•12m ago•0 comments

Reason is joining LANDR to empower and inspire music creators

https://www.reasonstudios.com/news/post/reason-is-joining-landr-to-empower-and-inspire-music-crea...
2•hgo•13m ago•0 comments

A bombshell': doubt cast on discovery of microplastics throughout human body

https://www.theguardian.com/environment/2026/jan/13/microplastics-human-body-doubt
3•adrianhon•13m ago•0 comments

What Is a Production Process?

https://www.construction-physics.com/p/what-is-a-production-process
1•cybersoyuz•15m ago•0 comments

Show HN: CodeMic – replay coding sessions inside your editor, local-first

https://CodeMic.io/#
1•seansh•16m ago•0 comments

Show HN: Online compiler with real-time stdin/stdout and AI debugging

https://compiler.amit.is-a.dev/
1•notamitgamer•16m ago•0 comments

Rethinking Geolocation on the Internet

https://pulse.internetsociety.org/blog/rethinking-geolocation-on-the-internet
1•todsacerdoti•18m ago•0 comments
Open in hackernews

Ask HN: Java why put string in a constant?

1•ramsicandra•7mo 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•7mo 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•7mo 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.