frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Bret Taylor's Sierra Reaches $100M ARR in Under Two Years

https://techcrunch.com/2025/11/21/bret-taylors-sierra-reaches-100m-arr-in-under-two-years/
1•karakoram•17s ago•0 comments

Show HN: Free SEO Image Generator WordPress Plugin – Rule Based and Zero AI

https://github.com/atraining/featured-image-generator-wordpress/
1•chelm•17s ago•0 comments

Erik Prince, America's most notorious mercenary, spies opportunity in chaos

https://www.economist.com/international/2025/11/21/erik-prince-americas-most-notorious-mercenary-...
1•rguiscard•3m ago•1 comments

I made an app because we kept double feeding our cat

https://www.kibblo.co/
1•hackfast•4m ago•0 comments

Behind Amazon's quiet launch of Haul, which competes with Temu

https://www.cnbc.com/2024/12/22/amazon-haul-takes-on-temu-to-bring-shoppers-cheap-goods-from-chin...
1•mgh2•4m ago•0 comments

Installing FreeBSD 15 on my desktop

https://yorickpeterse.com/articles/installing-freebsd-15-on-my-desktop/
2•todsacerdoti•6m ago•0 comments

PatpDNS Chrome Browser Extention

https://github.com/skilo83/patpDNS-Chrome-extention
1•1o1o1o1o1•13m ago•0 comments

Lawmakers Are Rolling Back Food Safety Rules

https://jacobin.com/2025/11/listeria-food-labeling-shutdown-deal
3•wahnfrieden•16m ago•0 comments

Smart App Control blocks unsigned OSS tools

https://forum.dotnetdev.kr/t/technical-statement-smart-app-control-and-the-future-of-the-windows-...
1•rkttu•16m ago•0 comments

Making Meaningful Contributions to Open Source [video]

https://www.youtube.com/watch?v=bzogTYPv65M
1•mooreds•20m ago•0 comments

Cryptographers cancel election results after losing decryption key

https://arstechnica.com/security/2025/11/cryptography-group-cancels-election-results-after-offici...
7•awkwardpotato•20m ago•0 comments

Nvidia, Microsoft invest $15B in AI startup Anthropic

https://finance.yahoo.com/news/nvidia-microsoft-invest-15-billion-203500905.html
1•mgh2•22m ago•0 comments

Shinzo Python SDK: OpenTelemetry-Native Observability for MCP Servers

https://github.com/shinzo-labs/shinzo-py
2•austin-born•26m ago•1 comments

Ask HN: What are your best tips, speculations on running a Git mirror farm?

1•chanux•30m ago•0 comments

Go's runtime may someday start explicitly freeing some internal memory

https://utcc.utoronto.ca/~cks/space/blog/programming/GoExplicitMemoryFreeing
1•birdculture•36m ago•0 comments

Letter from Codeberg: Onwards and Upwards

https://blog.codeberg.org/letter-from-codeberg-onwards-and-upwards.html
1•todsacerdoti•42m ago•0 comments

Natural emergent misalignment from reward hacking in production rl [pdf]

https://assets.anthropic.com/m/74342f2c96095771/original/Natural-emergent-misalignment-from-rewar...
2•neapolisbeach•42m ago•0 comments

GemRB is a portable open-source implementation of BioWare's Infinity Engine

http://gemrb.org/
1•ibobev•45m ago•0 comments

Drug lord Ryan Wedding's bevy of beauties

https://torontosun.com/news/world/drug-lord-ryan-wedding-women
1•Anon84•45m ago•0 comments

Cognitive Orthogonal Reasoning Engine

https://github.com/Aethelred-dev/c.o.r.e
1•phboot•48m ago•0 comments

Launch ALERT SpaceX Starlink 6-79

https://twitter.com/TLPN_Official/status/1991973488832483402
2•astrozac•49m ago•0 comments

Definitions of AI and How Companies Use Them to Lie [video]

https://www.youtube.com/watch?v=F5ajyr5VzS0
2•tartoran•59m ago•0 comments

Sharper MRI scans may be on horizon thanks to new physics-based model

https://news.rice.edu/news/2025/sharper-mri-scans-may-be-horizon-thanks-new-physics-based-model
2•hhs•1h ago•0 comments

Recycled Nitrogen for Regenerative Agriculture

https://www.mdpi.com/2073-4395/15/11/2503
2•PaulHoule•1h ago•0 comments

LTO-10 bumped to 40 TB as future tape capacities get cut

https://blocksandfiles.com/2025/11/13/lto10-upgrade/
2•bilegeek•1h ago•0 comments

Move Expressions

https://smallcultfollowing.com/babysteps/blog/2025/11/21/move-expressions/
1•emschwartz•1h ago•0 comments

Federal Corrections Officers Are Leaving in Droves for ICE

https://www.propublica.org/article/ice-bop-federal-prisons-corrections-officers
2•measurablefunc•1h ago•0 comments

C.O.R.E Alternative to LLM?

2•phboot•1h ago•1 comments

The Driver of Formula 1 – Willem Toet and Francesco Del Citto [video]

https://www.youtube.com/watch?v=1RffOsDb89Y
1•mtillman•1h ago•1 comments

Snapdragon X2 Elite laptop chip benchmarks

https://www.tomsguide.com/computing/laptops/i-just-benchmarked-every-snapdragon-x2-elite-chip-and...
2•walterbell•1h ago•0 comments
Open in hackernews

Ask HN: Java why put string in a constant?

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