frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

From a Slack link to production in under 48 hours: cloning Shopify's "Quick"

https://courtyard.io/blog/post/from-a-slack-link-to-production-in-under-48-hours-cloning-shopifys...
1•joetyson•1m ago•0 comments

Jetterix Pressure Nozzle Review 2026 – Worth Buying or Just Hype?

https://finance.yahoo.com/sectors/technology/articles/jetterix-pressure-nozzle-urgent-report-1739...
1•palszaty•3m ago•0 comments

Sandboxing is 47 years old. What changed is who's in the box.

https://cyrusradfar.com/thoughts/sandboxing-from-vms-to-agents
2•cyrusradfar•7m ago•0 comments

A new pkg.go.dev API for Go

https://opensource.googleblog.com/2026/06/a-new-pkggodev-api-for-go.html
1•rcy•8m ago•0 comments

Novo Nordisk reports cyberattack as UK gives Wegovy pill the nod

https://www.theregister.com/security/2026/06/12/novo-nordisk-says-hackers-stole-clinical-trial-da...
1•jruohonen•11m ago•0 comments

Show HN: Skill for your agent to visualize your gbrain and Obsidian

https://github.com/vladignatyev/brain-map-skill
1•v_ignatyev•11m ago•0 comments

Weaker bonds make for more impact-resistant polymers

https://newatlas.com/materials/weaker-bonds-impact-resistant-polymers/
1•breve•12m ago•0 comments

Yoti does not report GrapheneOS users to the authorities

https://www.yoti.com/blog/yoti-does-not-report-grapheneos-users-to-the-authorities/
2•Cider9986•13m ago•0 comments

Musk's War on European Democracy

https://ecfr.eu/article/musks-war-on-european-democracy-how-to-open-up-x-and-fight-back/
4•jruohonen•14m ago•0 comments

Estimating No-Cot Task-Completion Time Horizons of Frontier AI Models

https://www.lesswrong.com/posts/SieLowPgNgRSPGhFw/estimating-no-cot-task-completion-time-horizons...
1•kqr•17m ago•0 comments

Norway to deploy largest fleet of 'flying' electric ferries

https://candela.com/newsroom/norway-to-deploy-worlds-largest-fleet-of-flying-electric-ferries/
1•robin_reala•19m ago•0 comments

Looksy – we research and contact vendors so you don't have to

https://looksy.fyi/blogs/blog/hidden-cost-of-doing-your-own-research
2•sean_looksy•27m ago•0 comments

Dwile flonking returns, but what on Earth is it?

https://www.bbc.co.uk/news/articles/c621z76yvy1o
1•zeristor•30m ago•1 comments

Show HN: Visualize an Obsidian/gbrain vault as an interactive graph and timeline

https://vladignatyev.github.io/brain-map-skill/
2•v_ignatyev•30m ago•1 comments

Parasitic Computing

https://en.wikipedia.org/wiki/Parasitic_computing
1•the-mitr•33m ago•0 comments

lmcli v0.7.0 – TUI harness with smooth performance up to 1M context

https://codeberg.org/mlow/lmcli
1•wolttam•35m ago•1 comments

ArkVault – Per-user ZFS snapshots for managed Nextcloud hosting

https://arkdisk.com/
1•ChristopherArk•39m ago•0 comments

Not Your Weights, Not Your Workflow (Claude Fable 5 Export Ban)

https://thecoder.io/blog/not-your-weights
4•pixelhed•39m ago•2 comments

Map Clustering Is Not My Favorite

https://blog.greg.technology/2026/06/12/map-clustering-is-not-my-favorite.html
1•gregsadetsky•42m ago•0 comments

Blog of http://archive.today/

https://lj.rossia.org/users/archive_today/
1•Cider9986•47m ago•1 comments

Fisher Catches and Releases Great White Shark in Massachusetts [video]

https://www.youtube.com/watch?v=yFIcUT8Q1RU
1•aquir•56m ago•0 comments

Leaving Mozilla

https://blog.unitedheroes.net/5751
3•martey•58m ago•0 comments

Show HN: GripLock – walk in real life to conquer terrain

https://griplock.alephz.com/
2•ishener•59m ago•0 comments

Harness engineering for coding agent users

https://martinfowler.com/articles/harness-engineering.html
2•pramodbiligiri•1h ago•0 comments

Russian mathematician wanted on terrorism charges detained in Armenia

https://caliber.az/en/post/russian-mathematician-wanted-on-terrorism-charges-detained-in-armenia
2•spzx•1h ago•1 comments

Shepherd's Dog: A Game by the Most Dangerous AI Model

https://koenvangilst.nl/lab/claude-fable-shepherds-dog
15•vnglst•1h ago•9 comments

Show HN: FinMind AI – Like Bloomberg Terminal Meets ChatGPT

https://finmindai-moneyverse.vercel.app/
1•heroboy•1h ago•0 comments

Ask HN: What features do you miss in Google Docs for desktop?

2•mci•1h ago•1 comments

Too many people are shockingly bad at prioritisation

https://economist.com/business/2026/06/11/too-many-people-are-shockingly-bad-at-prioritisation
1•andsoitis•1h ago•0 comments

Mise System Packages

https://mise.jdx.dev/system-packages/
4•crbelaus•1h 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.