frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

OpenAI's Egregious Pattern of Misconduct

https://garymarcus.substack.com/p/openais-egregious-pattern-of-misconduct
1•kgwgk•1m ago•0 comments

Does high chess accuracy mean someone is cheating?

https://chesscheaterdetector.com/blog/does-high-chess-accuracy-mean-someone-is-cheating/
1•domhudson•3m ago•0 comments

Proof And Progress In Mathematics (1994) [pdf]

https://www.math.toronto.edu/mccann/199/thurston.pdf
1•pcfwik•4m ago•0 comments

Show HN: Dictámelo, MIT-licensed voice dictation with local and cloud models

https://github.com/sarrazola/dictamelo
1•sarrazola00•6m ago•0 comments

Democrats Are Plotting Government Efficiency in a Post-DOGE World

https://www.notus.org/technology/democrats-government-efficiency-post-doge
1•kadal•6m ago•1 comments

Astra vs. Fable on Vending-Bench: More Money, More Aligned

https://andonlabs.com/blog/gpt-6-astra-vending-bench
1•Tiberium•7m ago•0 comments

Liquid Glass Radar

https://liquidglassradar.com
1•vpgn•7m ago•0 comments

Rust debugging survey 2026 results

https://blog.rust-lang.org/2026/09/07/rust-debugging-survey-2026-results/
1•birdculture•10m ago•0 comments

The Vacuum Tube That Almost Beat the Transistor – TubeTimeUS [video]

https://www.youtube.com/watch?v=XcNLQskUcpk
1•rasz•10m ago•0 comments

The Golden Age of Apple Software Ended with Snow Leopard

https://lightyearlabs.ca/blog/snow-leopard/
2•tmanok•11m ago•0 comments

TCP Path Diagnostics

https://curl.realhackers.org/
1•Bender•13m ago•1 comments

The Pebble Time 2 proves smartwatches got worse, not better

https://www.howtogeek.com/pebble-time-2-review/
2•datakan•15m ago•0 comments

What do Visa and Mastercard do? An intro to card networks

https://tautology.town/2026/06/01/card-networks.html
1•evakhoury•15m ago•0 comments

Can Coding Agents Play Pokemon?

https://bkal01.github.io/posts/radical-red/
1•bkal01•16m ago•0 comments

Doomfly

https://fly-brain-doom.awormuth.chatgpt.site
1•T-A•16m ago•0 comments

Testing race conditions with memory access tracing & stack-based delay injection

https://projectzero.google/2026/09/maccconc-race-condition.html
1•matt_d•16m ago•0 comments

Chdb Postgres extension: High-performance imports from cloud storage

https://clickhouse.com/blog/introducing-chdb-postgres
1•saisrirampur•21m ago•0 comments

Show HN: See all stocks traded by Donald Trump

https://www.capitolisation.com/members/trump
2•Alannnn•21m ago•0 comments

Something's Happening to the Ozone Hole [video]

https://www.youtube.com/watch?v=yWgHx0HE8m8
2•gmays•21m ago•0 comments

Public WebGPU Benchmarking powered by vGPU

https://web3dsurvey.com/benchmark
2•bhouston•21m ago•0 comments

First ever macOS Core Location Spoofing

https://github.com/TimBitBox/mac-location-spoofer
1•Gab01•22m ago•0 comments

Runway Reaches 200M ARR

https://bloomberg.com/news/articles/2026-09-08/ai-startup-runway-hits-200-million-in-annual-recur...
1•utiiiD•24m ago•0 comments

Moving to Graviton 5 halved our ClickHouse query latency

https://www.dash0.com/blog/migration-to-graviton-5-what-upgrading-our-clickhouse-cluster-actually...
2•ishener•24m ago•0 comments

GrapheneOS on AI Usage

https://grapheneos.social/@GrapheneOS/117236529351603001
2•garo-pro•25m ago•0 comments

What Should I Do to Win Back the Love of My Boyfriend?

https://etechx.co.ke/what-should-i-do-to-win-back-the-love-of-my-boyfriend
2•manyik•25m ago•0 comments

Show HN: AI Mood Tracker and Journal for iPhone

https://apps.apple.com/us/app/moon-mood-tracker-journal/id6773049470
3•losteden1•27m ago•0 comments

Robots "protest" in Warsaw to demand regulation of AI and automation

https://notesfrompoland.com/2026/09/08/robots-protest-in-warsaw-to-demand-regulation-of-ai-and-au...
2•giuliomagnifico•27m ago•0 comments

Versign Announce New .web Domain Extension

https://investor.verisign.com/news-releases/news-release-details/verisign-announces-delegation-web/
1•a_paddy•27m ago•0 comments

OpenAI Just Claimed a Math Discovery. Some Academics Are Crying Foul

https://www.wired.com/story/openai-navier-stokes-math-discovery-academics/
2•olalonde•27m ago•0 comments

EU and Canada Plan Far-Reaching Alliance to Strengthen Partnership

https://www.bloomberg.com/news/articles/2026-09-08/eu-and-canada-plan-far-reaching-alliance-to-st...
4•helsinkiandrew•29m ago•1 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.