frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

We ported 65 OSS projects with AI

https://akka.io/blog/we-ported-65-oss-projects
1•TylerJewell•1m ago•1 comments

GoPro: A normal, unremarkable piece of merger activity

https://www.ft.com/content/e7cc6fc2-74ae-497b-92bf-d8254dd161fa
1•root-parent•1m ago•0 comments

How Swiss tables work in Go built-in map

https://victoriametrics.com/blog/go-swiss-table-map/index.html
1•valyala•3m ago•0 comments

Show HN: StillMade – Programmable AI video pipeline; Chat to video (now)

https://www.stillmade.shop
2•nomanWasTaken•4m ago•0 comments

Elmway – Tasks and Notes

1•victor_dd•5m ago•0 comments

OWASP MCP Governance and Risk Framework

https://github.com/OWASP/OWASP-MCP-Governance-and-Risk-Project
1•882542F3884314B•5m ago•0 comments

Paid Actors, AI Writing

https://www.semafor.com/article/09/02/2026/paid-actors-ai-writing-how-a-new-kind-of-video-busines...
1•root-parent•6m ago•0 comments

Show HN: Outfund.me – an open-source platform for alternative startup funding

https://outfund.me/
1•Fotis-Karmpas•7m ago•0 comments

Show HN: Moon – track your mood and see what fills and drains it

https://moonapp.lv
3•nikkey80•7m ago•0 comments

There are many agent harnesses, but this one is mine

https://earendil.com/posts/there-are-many-agent-harnesses-but-this-one-is-mine/
2•tosh•8m ago•0 comments

Show HN: What Engineers must own in the AI Era? [video]

https://www.youtube.com/watch?v=wpxVCZ8fqZA
2•Harish_0089•9m ago•0 comments

You're also a neural network – train on the good stuff

https://magnusludviksson.substack.com/p/youre-also-a-neural-network-train
1•reckoner99•10m ago•0 comments

Flavourbench: LLM Eval with Executable Culinary Ground Truth

https://arxiv.org/abs/2608.20574
1•josefchen•11m ago•0 comments

US urges G20 countries to allow AI training on creators' work

https://www.ctvnews.ca/sci-tech/article/us-urges-g20-countries-to-allow-ai-training-on-creators-w...
2•throw0101d•15m ago•2 comments

He built Russia's FSB surveillance system, then fled with its source code

https://istories.media/stories/2026/09/03/vines-sorm-iz-izbi/
2•Klaster_1•16m ago•1 comments

Will we let you back into the club?

1•BatchJob•18m ago•1 comments

US Government backs OpenAI in New York Times copyright case

https://www.reuters.com/legal/litigation/us-government-backs-openai-new-york-times-copyright-case...
3•Anon84•18m ago•0 comments

Requirements are intentions QA is the proof

1•gigisfndr•19m ago•0 comments

AI and the Profits Boom

https://thenextrecession.wordpress.com/2026/09/01/ai-and-the-profits-boom/
2•lowbar•19m ago•0 comments

Csveee – parsing CSV at up to 192 GB/s in Rust

https://github.com/ackxolotl/csveee
1•foooo4•19m ago•0 comments

Welcome to Pintos

https://pkuflyingpig.gitbook.io/pintos
2•porridgeraisin•23m ago•0 comments

XBOW's Native Team Has Claimed the First Chrome Full Chain Exploit Bonus

https://twitter.com/Xbow/status/2095220385876742456
1•lnenad•23m ago•0 comments

CS146S: The Modern Software Developer

https://themodernsoftware.dev/
1•Anon84•24m ago•0 comments

Nobody Knows Anything

https://www.strangeloopcanon.com/p/nobody-knows-anything
2•thelastgallon•24m ago•0 comments

World Organ: a single-file WebGL2 organism fed by live geopolitical and UAP data

https://iainball.com/world-organ.html
2•articxiframe•29m ago•0 comments

Electric Planes [video]

https://www.youtube.com/watch?v=nM86DBOqgPM
2•2233•34m ago•0 comments

4.5B Posts Scraped from TikTok

https://tiktok-api.seeksocial.io/
17•TheOnlyWayUp•37m ago•4 comments

Show HN: Rendered Markdown with source revealed at point in Emacs 31

https://github.com/Thysrael/markdown-ts-appear
1•gg_equal_G•39m ago•0 comments

Ask HN: Who is using MCP in production?

4•sukit•41m ago•0 comments

PixiEditor: Open-source and cross-platform All-in-One Editor for 2D

https://github.com/PixiEditor/PixiEditor
2•AbuAssar•41m 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.