frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Should LLMs write in mainstream languages?

https://www.nobodywho.ai/posts/why-is-pi-not-written-in-lisp/
1•nikolovv•1m ago•0 comments

Instagram without reels, across updates

https://jean-voila.github.io/FeurStagram/
1•steveskids•3m ago•0 comments

After further discussion, we have decided to withdraw PEP 836

https://discuss.python.org/t/pep-836-jit-go-brrr-the-path-to-a-supported-jit-compiler-for-cpython...
1•Ralfp•4m ago•0 comments

The Secret Life of Circuits is now in stock everywhere

https://blog.coredump.cx/p/the-secret-life-of-circuits-is-now
1•surprisetalk•4m ago•0 comments

OSS Scanner

https://red.anthropic.com/oss-scanner/
2•pretext•7m ago•0 comments

Physicists prove a long-suspected quantum speed limit for thermalization

https://phys.org/news/2026-10-physicists-quantum-limit-thermalization.html
1•rbanffy•7m ago•0 comments

Work on what you're bad at in your career

https://coached.com/essays/why-you-should-work-on-what-youre-bad-at-in-your-career/
1•rohanm93•8m ago•0 comments

Revolut down – Global ATM withdrawals and bank transfers failing

1•TomAnthony•8m ago•0 comments

Revolut Down in Multiple Countries

https://downdetector.co.uk/status/revolut/
2•weinzierl•10m ago•0 comments

Marble: Exact sequence parallelism for packed multimodal masks

https://lumalabs.ai/news/packed-multimodal-attention
1•frostbyte7•11m ago•0 comments

Advancing coding in low‑resource programming languages

https://openai.com/index/low-resource-programming-languages/
1•neversaydie•13m ago•0 comments

In Context – Rich Hickey (Clojure/Conj 2026) [video]

https://www.youtube.com/watch?v=P5eO7BNyJao
1•gingersnap•14m ago•0 comments

And what are you doing?

https://substack.com/profile/561234514-lucid-persona/note/c-365502954
1•lucidpersona•15m ago•0 comments

Making the internet better for AI agents might make it worse for everyone else

https://www.technologyreview.com/2026/10/19/1147186/making-the-internet-better-for-ai-agents-migh...
2•joozio•16m ago•0 comments

AMD ROCm in WSL Containers via /dev/dxg, without /dev/kfd (Strix Halo)

https://nhapplied.co.uk/ace
1•NHApplied•20m ago•0 comments

Lexicon Branding

https://www.lexiconbranding.com/
1•g2lang•20m ago•0 comments

ESP-KVM Terminal on an M5Stack Tab5 for ESP-KVM

https://espkvm.io/blog/esp-kvm-terminal-on-an-m5stack-tab5/
1•dexif•21m ago•0 comments

Show HN: I removed every float from GPT-2 for identical neural compression

https://github.com/tac0mania/taco
2•taco-man•23m ago•1 comments

Vibecoding an LLVM TypeScript Compiler

1•harishd30•25m ago•0 comments

What if the world hadn't built wind and solar?

https://www.theclimatebrink.com/p/what-if-the-world-hadnt-built-wind
1•xbmcuser•26m ago•0 comments

Pikeru – a file picker with thumbnails, semantic search, and image viewer

https://github.com/dvhar/pikeru
1•foxrider•29m ago•1 comments

Protect Your PII? Use Pirate Face to Scrub Prompts to Openrouter

https://pirateface.co/inference
6•ahoyymatey•29m ago•0 comments

Google Cloud networking is down in various regions

2•sz4kerto•33m ago•1 comments

Learn the Tool Before You Fight It

https://medium.com/teatime-history/learn-the-tool-before-you-fight-it-61462bf50a1b
2•cadeos•33m ago•0 comments

Hey

1•the1andonlyy69•34m ago•0 comments

Vite+ an excellent toolchain for AI agent development

https://janmichalek.com/blog/vite-plus-agentni-vyvoj?lang=en
15•kanbaruu•38m ago•4 comments

MicroG: Free-libre re-implementation of Google's proprietary Android user space

https://github.com/microg/GmsCore/wiki
2•theanonymousone•42m ago•0 comments

Show HN: A Public Leaderboard for Textual, Coding, and Multimodal Memory

https://twitter.com/AgentMemoryL/status/2101515447816663222
2•SndOfViento•42m ago•0 comments

EFF Launches Privacy Badger for Safari on macOS

https://www.eff.org/press/releases/eff-launches-privacy-badger-safari-macos
2•XzetaU8•43m ago•0 comments

Show HN: Kubectl-skyline – View your Kubernetes cluster as a 3D city

https://github.com/zdk/kubectl-skyline
1•zdkaster•45m 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.