frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

The Environmental Cost of AI: Carbon, Water, and Land Footprints

https://unu.edu/inweh/collection/environmental-cost-of-AIs-Enrgy-Use-Carbon-water-and-land-footpr...
1•SupremumLimit•1m ago•0 comments

Rockstar fit a city into PlayStation 2 memory [video]

https://www.youtube.com/watch?v=cIbCxbrBCys
1•birdculture•2m ago•0 comments

Google's Top DMCA Sender Plateaus at 70M Takedowns per Week

https://torrentfreak.com/googles-top-dmca-sender-plateaus-at-70-million-takedowns-per-week/
1•aa_is_op•4m ago•0 comments

I built a local news website

https://www.thomasmcgee.co/article/i-built-a-local-news-website
1•SunshineTheCat•5m ago•0 comments

Changing Document Version Control Forever

https://github.com/SCCS-HQ/legal-contract-version-control
1•slveer•7m ago•0 comments

Mac-sudo-touchid: When coding agents sudo, use touch ID instead of password

https://github.com/Divide-By-0/macos-sudo-touchid
1•gyush•10m ago•0 comments

Breaking Circular Imports in Python Without Losing Type Safety

https://www.orcaset.com/blog/breaking-circular-imports-in-python-without-losing-type-safety
1•jrdnocs•15m ago•0 comments

Journey to JPEG XL: open-source experiments shaped the future of image coding

https://opensource.googleblog.com/2026/06/journey-to-jpeg-xl-how-open-source-experiments-shaped-t...
2•ledoge•16m ago•2 comments

MisoTTS Emotive Speech Model

https://www.misolabs.ai/blog/miso-tts-8b
1•heystefan•20m ago•0 comments

Subpostmaster federation hit by ransomware attack

https://www.computerweekly.com/news/366643958/Subpostmaster-federation-hit-by-ransomware-attack
1•latein•21m ago•0 comments

ReactOS Joins VCF Southwest for the First Time

https://reactos.org/blogs/vcfsw-2026/
1•samtheDamned•23m ago•0 comments

Moravec's Paradox

https://en.wikipedia.org/wiki/Moravec%27s_paradox
3•chistev•25m ago•0 comments

Ask HN: How to voice disagreement over S&P500 inclusion rules change for SpaceX?

6•MakersF•26m ago•1 comments

Reddit user creates DB and MCP to mine Polygon, finds patterns on Polymarket

https://old.reddit.com/r/ClaudeAI/comments/1tvefqd/i_wired_claude_code_into_a_database_of_every/
3•consumer451•26m ago•0 comments

Plants like canola, tomatoes and rice reduce iron uptake in drought

https://ucalgary.ca/news/research-shows-plants-such-canola-tomatoes-and-rice-reduce-iron-uptake-w...
1•gmays•27m ago•0 comments

Terrifying -Two airliners took off just metres above airport workers

https://www.sbs.com.au/news/article/how-a-runway-change-led-to-two-terrifying-near-misses-at-this...
1•asdefghyk•27m ago•2 comments

Diverging Network Architecture of the C.elegans Connectome and Signaling Network

https://journals.aps.org/prxlife/abstract/10.1103/6wgv-b9m6
1•jonnonz•28m ago•0 comments

Show HN: Code3DBench – single-image to executable Three.js benchmark

https://github.com/VladimirGl/Code3DBench
1•vladgl94•31m ago•1 comments

Maybe Don't Rely on Google's "Modern Web Guidance"

https://adrianroselli.com/2026/05/maybe-dont-rely-on-googles-modern-web-guidance.html
5•klueinc•32m ago•0 comments

Timeclock.Kiwi – Launching Our Mobile App

https://timeclock.kiwi/blog/q8sf5s6-mobile-app-launch
2•loic-joachim•32m ago•0 comments

EU wants households to cut peak time energy use as industry and AI demand soars

https://www.politico.eu/article/eu-households-electricity-energy-artificial-intelligence-ai/
8•pseudalopex•33m ago•0 comments

How should we think about Starship?

https://mceglowski.substack.com/p/how-should-we-think-about-starship
2•PanMan•33m ago•0 comments

'Beauty and the Beast' singer Peabo Bryson dies at 75

https://abcnews.com/GMA/Culture/singer-peabo-bryson-dies-75/story?id=133533357
2•bookofjoe•34m ago•0 comments

Microsoft Deliberately Bricking All Office for Mac 2019/2021 Installations

https://www.osnews.com/story/145179/microsoft-is-intentionally-bricking-all-office-for-mac-2019-i...
3•m463•34m ago•1 comments

Are Young People Lazy, or Are They Just Hopeless?

https://www.newsweek.com/are-young-people-lazy-hopeless-2037840
3•paulpauper•35m ago•0 comments

Advice for amateur mathematicians on writing and publishing

https://cohn.mit.edu/advice/
1•paulpauper•36m ago•0 comments

Do you really want that computer-science degree?

https://www.economist.com/graphic-detail/2026/06/01/do-you-really-want-that-computer-science-degree
2•pseudolus•37m ago•1 comments

Inference Optimization for MiniMax Sparse Attention

https://www.together.ai/blog/serving-minimax-m3-for-efficient-inference-unlocking-1m-token-contex...
1•zagwdt•37m ago•0 comments

Why We've Been Thinking about the Fertility Crisis Wrong

https://www.richardhanania.com/p/why-weve-been-thinking-about-the
1•paulpauper•38m ago•0 comments

A Mathematician's Lament – Paul Lockhart (2002) [pdf]

https://worrydream.com/refs/Lockhart_2002_-_A_Mathematician%27s_Lament.pdf
2•xeonmc•39m 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.