frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Sabotage Risk Claude Opus 4.6 [pdf]

https://www-cdn.anthropic.com/f21d93f21602ead5cdbecb8c8e1c765759d9e232.pdf
1•salkahfi•2m ago•0 comments

Modular Acquires BentoML

https://www.bentoml.com/blog/bentoml-is-joining-modular
2•djhu9•5m ago•0 comments

The First Day of the Cenozoic

https://www.pnas.org/doi/full/10.1073/pnas.1909479116
1•mturmon•7m ago•0 comments

Toddlers expect ingroup loyalty to override personal prefs when outgroup present

https://www.pnas.org/doi/epdf/10.1073/pnas.2521041123
2•DustinEchoes•9m ago•0 comments

Early signals that EU AI Act compliance is becoming a sales blocker for AI SaaS

1•rishe_s•9m ago•0 comments

I'm Always in the Club

https://www.lrb.co.uk/the-paper/v48/n02/christian-lorentzen/i-m-always-in-the-club
2•Thevet•9m ago•0 comments

Solving Automata Cam Profiling with Grasshopper

https://www.youtube.com/watch?v=grgIhw1YbHw
2•deoxykev•11m ago•0 comments

Everyone Is Oppressed, Especially the Powerful

https://gilpignol.substack.com/p/everyone-is-oppressed-especially
1•light_triad•11m ago•1 comments

Hyundai to supply 50k vehicles to Waymo as physical AI move accelerates

https://www.kedglobal.com/future-mobility/newsView/ked202602100001
1•xnx•12m ago•0 comments

Community Living as a Solution to Late Stage Capitalism

https://spidgorny.medium.com/community-living-as-a-solution-to-late-stage-capitalism-8975205f02d2
2•depidsvy•12m ago•0 comments

Flicker: Upload Videos for Free

https://joinflicker.pages.dev/
1•telui•14m ago•1 comments

Ball Lightning Phenomenon

https://en.wikipedia.org/wiki/Ball_lightning
1•JumpinJack_Cash•15m ago•0 comments

Chrome Announced WebMCP Integration

https://docs.google.com/document/d/1rtU1fRPS0bMqd9abMG_hc6K9OAI6soUy3Kh00toAgyk/edit
3•zkitty•18m ago•2 comments

FDA refuses to review Moderna's mRNA flu vaccine

https://arstechnica.com/health/2026/02/fda-refuses-to-review-modernas-mrna-flu-vaccine/
4•sklargh•19m ago•0 comments

Cloudflare forecasts annual sales above estimates as AI drives cloud demand

https://www.reuters.com/business/cloudflare-forecasts-annual-sales-above-estimates-ai-drives-clou...
3•rfv6723•25m ago•0 comments

RAG and Data Boundaries in Multi-Tenant Systems

1•arthit-pkg•26m ago•0 comments

2026 Is the Year of Serious AI Engineering

https://stefano.chiodino.uk/posts/2026-02-10-2026-is-the-year-of-serious-ai-engineering/
1•StefanoC•26m ago•0 comments

The future of coding agents is vertical integration (and why ACP matters)

https://tidewave.ai/blog/the-future-of-coding-agents-is-vertical-integration
1•vinhnx•26m ago•0 comments

Built a Python Dependency Audit Tool Because Vulnerability Lists Weren't Enough

https://github.com/0x5A65726F677275/AuditDeps
2•zerogru0x00•27m ago•1 comments

Elon Musk's xAI loses second cofounder in 48 hours

https://www.businessinsider.com/elon-musk-xai-loses-second-cofounder-jimmy-ba-2026-2
8•spenvo•33m ago•1 comments

Google Chrome 145 Released with JPEG-XL Image Support

https://www.phoronix.com/news/Chrome-145-Released
3•lawrencejgd•35m ago•0 comments

Sodium Ion Battery Puncture Test [video]

https://www.youtube.com/watch?v=DCRXWkeoEXs
2•olgs•38m ago•0 comments

Scientists reimagine a forgotten battery design from Thomas Edison

https://newsroom.ucla.edu/releases/how-ucla-scientists-helped-reimagine-a-forgotten-battery-desig...
2•geox•38m ago•0 comments

Rivian R2: Electric Mid-Size SUV

https://rivian.com/r2
2•socialcommenter•42m ago•0 comments

Show HN: ScanDo – A zero-UI camera that predicts your next action locally

https://play.google.com/store/apps/details?id=jp.joinclass.scando&hl=en_US
1•kyoagun•43m ago•0 comments

Open Climate Risk

https://carbonplan.org/research/climate-risk
1•coloneltcb•43m ago•0 comments

The insane biology of: The saltwater crocodile [video]

https://www.youtube.com/watch?v=Z5rCogD4e2k
1•teleforce•46m ago•0 comments

Google Chrome: WebMCP is available for early preview

https://developer.chrome.com/blog/webmcp-epp
2•nthypes•47m ago•0 comments

Show HN: NameToGradient – deterministic gradients from text input

https://nametogradient.com/
1•RndmNode•49m ago•0 comments

Jjdag: A Jujutsu TUI

https://github.com/anthrofract/jjdag
1•anthrofract•49m ago•0 comments
Open in hackernews

Ask HN: Java why put string in a constant?

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