frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

When AI writes almost all code, what happens to software engineering?

https://newsletter.pragmaticengineer.com/p/when-ai-writes-almost-all-code-what
1•Brajeshwar•41s ago•0 comments

Show HN: A commitment model for usage billing

https://twitter.com/tryflexprice/status/2009226683849773430
1•sudeepsd__•41s ago•0 comments

Trump Lays Out a Vision of Power Restrained Only by 'My Own Morality'

https://www.nytimes.com/2026/01/08/us/politics/trump-interview-power-morality.html
1•Stevvo•1m ago•0 comments

Ask AI via Lightning payments (no accounts, no API keys, no stored history)

https://satsforai.com/
1•LightProx•3m ago•1 comments

The most popular Go dependency is

https://blog.thibaut-rousseau.com/blog/the-most-popular-go-dependency-is/
1•bzGoRust•6m ago•0 comments

Ralph Wiggum Experiment – Can AI meaningfully improve through iterative loops?

https://github.com/UtpalJayNadiger/ralphwiggumexperiment
1•iacguy•7m ago•0 comments

Implementing a web server in a single printf() call (2014)

https://tinyhack.com/2014/03/12/implementing-a-web-server-in-a-single-printf-call/
1•nateb2022•8m ago•1 comments

Kelly Evans: Goodbye, Google

https://www.cnbc.com/2026/01/07/kelly-evans-goodbye-google.html
1•cebert•11m ago•0 comments

Spirit Cave Resilience: How Do We Explain a 10k-Year Continuity

https://www.cambridge.org/core/journals/american-antiquity/article/spirit-cave-resilience-how-do-...
1•1659447091•13m ago•0 comments

Show HN: LSP Skill – IntelliSense for Coding Agents That Works

https://lsp-client.github.io/
1•observerw•20m ago•0 comments

Against the 'METR Graph'

https://arachnemag.substack.com/p/the-metr-graph-is-hot-garbage
1•zygmunt417•20m ago•0 comments

Cellular Landscape

https://gaelmcgill.artstation.com/projects/Pm0JL1
2•o4c•20m ago•0 comments

Is Craigslist the Last Real Place on the Internet?

https://www.wired.com/story/is-craigslist-the-last-real-place-on-the-internet/
2•susam•21m ago•0 comments

Lisa

https://github.com/blencorp/lisa
1•handfuloflight•24m ago•0 comments

Show HN: I built OnePlayer: A lightweight, Material 3 offline player

https://play.google.com/store/apps/details?id=com.googol.android.apps.oneplayer&hl=en_US
1•iZakirSheikh•24m ago•0 comments

Show HN: Call Your Loved Ones

https://cylo.mkaye.dev/
2•mrkaye97•24m ago•0 comments

Promise Theory

https://en.wikipedia.org/wiki/Promise_theory
1•dvrp•25m ago•0 comments

Show HN: Owl – Golang NVR with GB28181/Onvif Support and YOLO Detection

2•ixugo•27m ago•0 comments

AI images and internet rumors spread confusion about agent involved in shooting

https://www.npr.org/2026/01/08/nx-s1-5671740/ice-minneapolis-grok-ai-renee-nicole-good
2•rolph•28m ago•0 comments

Industrialising Code as we know it

https://medium.com/@igorcosta/industrialising-code-as-we-know-it-7d7000aa4b6d
1•igorpcosta•29m ago•2 comments

Repeating fast radio burst shows diverse activity and hints at magnetar origin

https://phys.org/news/2026-01-fast-radio-diverse-hints-magnetar.html
1•wglb•30m ago•1 comments

Why Are Grok and X Still Available in App Stores?

https://daringfireball.net/linked/2026/01/08/grok-x-app-stores
2•chmaynard•33m ago•1 comments

Jupiter's moon Europa lacks undersea activity needed to support life

https://phys.org/news/2026-01-jupiter-moon-europa-lacks-undersea.html
2•wglb•33m ago•1 comments

Videos Contradict Trump Administration Account of ICE Shooting in Minneapolis

https://www.nytimes.com/video/us/100000010631041/minneapolis-ice-shooting-video.html
9•shepherdjerred•35m ago•2 comments

Nanoplastics have diet-dependent impacts on digestive system health

https://phys.org/news/2025-12-nanoplastics-diet-impacts-digestive-health.html
2•PaulHoule•37m ago•1 comments

Why does mint make water taste so cold?

https://theconversation.com/why-does-mint-make-water-taste-so-cold-a-scientist-explains-267550
1•wjb3•38m ago•0 comments

Ruby 4.0 released – but its best new features are not production ready

https://devclass.com/2026/01/06/ruby-4-0-released-but-its-best-new-features-are-not-production-re...
4•thunderbong•40m ago•0 comments

Giant phantom jellyfish spotted deep in Pacific

https://www.popsci.com/environment/giant-phantom-jellyfish-spotted-deep-in-pacific/
2•wjb3•42m ago•0 comments

A.I. Slop Will Crescendo into a Cultural Shift [video]

https://www.youtube.com/watch?v=QyIlxg3z2eQ
1•mooreds•44m ago•0 comments

MiniMax jumps 54% in Hong Kong debut after US$619M IPO

https://www.businesstimes.com.sg/startups-tech/startups/minimax-jumps-54-hong-kong-debut-after-us...
1•dworks•45m 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.