frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

AI's Real Problem Is Illegitimacy, Not Hallucination

1•JanusPater•42s ago•0 comments

'I fell into it': ex-criminal hackers urge UK pupils to use web skills for good

https://www.theguardian.com/technology/2026/feb/08/i-fell-into-it-ex-criminal-hackers-urge-manche...
1•robaato•1m ago•0 comments

Why 175-Year-Old Glassmaker Corning Is Suddenly an AI Superstar

https://www.wsj.com/tech/corning-fiber-optics-ai-e045ba3b
1•bookofjoe•2m ago•1 comments

Keeping WSL Alive

https://shift1w.com/blog/keeping-wsl-alive/
1•jakesocks•3m ago•0 comments

Unlocking core memories with GoldSrc engine and CS 1.6 (2025)

https://www.danielbrendel.com/blog/43-unlocking-core-memories-with-goldsrc-engine
2•foxiel•3m ago•0 comments

Gtrace an advanced network path analysis tool

https://github.com/hervehildenbrand/gtrace
2•jimaek•4m ago•0 comments

America does not trust Putin or Trump

https://re-russia.net/en/review/809/
1•mnky9800n•7m ago•0 comments

Let's Do Music in Linux [video]

https://www.youtube.com/watch?v=IHgsOdoLuBU
1•mariuz•8m ago•0 comments

"Nothing" is the secret to structuring your work

https://www.vangemert.dev/blog/nothing
1•spmvg•12m ago•0 comments

AI Makes the Easy Part Easier and the Hard Part Harder

https://www.blundergoat.com/articles/ai-makes-the-easy-part-easier-and-the-hard-part-harder
1•birdculture•13m ago•0 comments

Show HN: Fine-tuned Qwen2.5-7B on 100 films for probabilistic story graphs

https://cinegraphs.ai/
1•graphpilled•14m ago•1 comments

A failed wantrepreneur's view on common startup advice

https://developerwithacat.com/blog/202602/startup-advice/
1•mmarian•14m ago•0 comments

Show HN: BestClaw Simple OpenClaw/MoltBot for non tech people

https://bestclaw.host/
1•nihey•14m ago•0 comments

AI is making me anxious and stupid

https://tom.so/posts/ai-is-making-me-anxious-and-stupid
1•tomupom•18m ago•0 comments

Show HN: Real-time path tracing of medical CT volumes in the browser via WebGPU

https://grenzwert.net/
1•MickGorobets•21m ago•1 comments

United States – Crypto Scam Help – Intelligence Cyber Wizard Safe Guide

1•Forensics•25m ago•0 comments

What to Do After a Crypto Scam (USA) Intelligence Cyber Wizard Explained

1•Forensics•25m ago•0 comments

The Physics of 588: A 17.64μm Isolation Barrier Strategy for 5nm Process

https://github.com/eggpine84-del/NHE-CODING
1•eggpine84•26m ago•0 comments

My Eighth Year as a Bootstrapped Founder

https://mtlynch.io/bootstrapped-founder-year-8/
1•mtlynch•27m ago•0 comments

Data Modelling Open Source

https://github.com/sqlmodel/sqlmodel
1•Sean766•29m ago•0 comments

Mid-life transitions

https://blogs.gnome.org/chergert/2026/02/06/mid-life-transitions/
2•pabs3•29m ago•0 comments

My Airships – My "No. 9," the Little Runabout

https://en.wikisource.org/wiki/My_Airships/Chapter_22
1•interstice•30m ago•0 comments

Show HN: Portview, A diagnostic-first port viewer for Linux (~930 KB, zero deps)

https://github.com/Mapika/portview
4•Mapika•31m ago•0 comments

Show HN: Claude has a compiler, I have SlopScript

https://slopscript.netlify.app/
1•hiten_sharma•34m ago•0 comments

Context Is Part of the Game

https://joy.pm/context-is-part-of-the-code/
1•rafadc•34m ago•0 comments

Dave Farber has passed away

https://lists.nanog.org/archives/list/nanog@lists.nanog.org/thread/TSNPJVFH4DKLINIKSMRIIVNHDG5XKJCM/
17•vitplister•35m ago•3 comments

Researchers find brain mechanism behind 'flashes of intuition'

https://medicalxpress.com/news/2026-02-brain-mechanism-intuition.html
1•pseudolus•38m ago•0 comments

Extracting Xcode's Claude Code Prompt

https://www.jackpearce.co.uk/posts/extracting-xcodes-claude-code-prompt
1•jkpe•38m ago•0 comments

AI is not another abstraction because god plays dice

https://rakhim.exotext.com/ai_is_not_another_abstraction_because_god_plays_dice
3•freetonik•39m ago•0 comments

Show HN: Tandem – An open-source, local-first AI workspace (Rust and React)

1•frumu•41m 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.