frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Show HN: UI testing using multimodal LLMs

https://kodefreeze.com
1•kodefreeze•1m ago•0 comments

San Jose Mayor: CA's proposed wealth tax push burden onto middle class families [video]

https://www.youtube.com/watch?v=muVVOjJsLG8
1•donsupreme•1m ago•0 comments

Max Payne – two decades later – Graphics Critique

https://darkcephas.blogspot.com/2021/07/max-payne-two-decades-later-graphics.html
2•davikr•6m ago•0 comments

Show HN: Just published a hard-SF novel Voyager1 returns with a quantum palantir

https://www.amazon.com/dp/B0GFSMP572
1•dufbugderopa•11m ago•1 comments

Orca: A New Architecture for Efficient AGI Through Parent-Teacher Learning

https://x.com/EricOmnigenius/article/2009656779945451932
2•ericspecullaas•13m ago•0 comments

A curated list of awesome explorable explanations

https://github.com/blob42/awesome-explorables
2•vitalnodo•16m ago•0 comments

The Declining Value of Personal Advice

https://www.gojiberries.io/the-declining-value-of-interpersonal-advice/
1•neehao•16m ago•0 comments

Show HN: Artdots: The benefits of creating a side project

https://artdots.co/blog/artdots-the-benefits-of-creating-a-side-project
1•veliona•21m ago•0 comments

Nvidia Announces Alpamayo Open-Source AI Models to Accelerate Reasoning-Based AV

https://nvidianews.nvidia.com/news/alpamayo-autonomous-vehicle-development
2•lateforwork•23m ago•0 comments

Ask HN: Before codebase review, replace all vars containing simple with complex?

1•gitprolinux•23m ago•0 comments

Show HN: Umaro – An interactive music theory suite for guitarists

https://www.umaro.app/
1•SnowingXIV•25m ago•0 comments

Zluda run unmodified CUDA on non Nvidia hw

https://www.phoronix.com/news/ZLUDA-CUDA-13.1-Compatibility
2•gigatexal•29m ago•0 comments

"About a decade ago... I developed an automated theorem-proving framework"

https://twitter.com/getjonwithit/status/2009602836997505255
2•Ariarule•30m ago•0 comments

Tool for live presentations using manim

https://github.com/jeertmans/manim-slides
1•vitalnodo•33m ago•0 comments

Workers at Redmond SpaceX lab exposed to toxic chemicals

https://www.fox13seattle.com/video/fmc-w1ga4pk97gxq0hj5
6•SilverElfin•35m ago•0 comments

Ask HN: When has a "dumb" solution beaten a sophisticated one for you?

3•amadeuswoo•48m ago•2 comments

Why some clothes shrink in the wash – and how to 'unshrink' them

https://www.swinburne.edu.au/news/2025/08/why-some-clothes-shrink-in-the-wash-and-how-to-unshrink...
1•OptionOfT•52m ago•0 comments

Show HN: VAM Seek – 2D video navigation grid, 15KB, zero server load

https://github.com/unhaya/vam-seek
5•haasiy•53m ago•0 comments

A curated list of free courses with certifications

https://github.com/cloudcommunity/Free-Certifications
3•javatuts•58m ago•0 comments

Bruno – local and Git-native solution to accelerate and secure API

https://www.usebruno.com/
1•javatuts•58m ago•0 comments

OpenAI is reportedly asking contractors to upload real work from past jobs

https://techcrunch.com/2026/01/10/openai-is-reportedly-asking-contractors-to-upload-real-work-fro...
13•pseudolus•1h ago•0 comments

Datadog, thank you for blocking us

https://www.deductive.ai/blogs/datadog-thank-you-for-blocking-us
34•gpi•1h ago•1 comments

Google moonshot spinout SandboxAQ claims an ex-exec is attempting 'extortion'

https://techcrunch.com/2026/01/09/google-moonshot-spinout-sandboxaq-claims-an-ex-exec-is-attempti...
1•Geekette•1h ago•0 comments

The new vs. used car debate is dead. They're both expensive debt traps

https://washingtonpost.com/business/2026/01/10/1000-payments-car-debt-trap/
6•pseudolus•1h ago•1 comments

Show HN: Reverse-engineering images into model-specific syntax(MJ,Nano,Flux,SD)

https://promptslab.app/image-to-prompt
1•jackzhuo•1h ago•1 comments

Npmgraph – a web-based tool that visualizes NPM package dependencies

https://npmgraph.js.org/
2•javatuts•1h ago•0 comments

Show HN: Hashing Go Functions Using SSA and Scalar Evolution

https://github.com/BlackVectorOps/semantic_firewall
2•BlackVectorOps•1h ago•1 comments

Show HN: mister.jar – Modular MRJAR Files Made Easy

http://lingocoder.com/mrjar/mrjar.usage.html
1•burnerToBetOut•1h ago•0 comments

Culture Isn't Stagnating, You Guys Are Just Old

https://www.jenn.site/culture-isnt-stagnating-you-guys-are-just-old/
7•Analemma_•1h ago•4 comments

Show HN: I made an Android app which sends Health Connect data to your webhooks

https://github.com/mcnaveen/health-connect-webhook
1•mcnx097•1h 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.