frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

AI can write code. But who understands it?

https://medium.com/enrique-dans/ai-can-write-the-code-but-who-understands-it-2e28e3e12f3e
1•ktzar•9m ago•0 comments

Show HN: Chancely – Ace interviews and get hired faster with AI feedback

https://chancely.ai/
1•niliu123•10m ago•0 comments

Growing Up in "404 Not Found" (Part II): The Vanishing Nuclear City

https://vincent404.substack.com/p/growing-up-in-404-not-found-part
2•RMPR•11m ago•0 comments

Shower Thoughts

https://www.patreon.com/posts/shower-thoughts-146872033
1•todsacerdoti•11m ago•0 comments

Generative Refocusing: Flexible Defocus Control from a Single Image

https://generative-refocusing.github.io/
1•trueduke•12m ago•0 comments

Understanding the empirical law of large numbers and the gambler's fallacy

http://science-memo.blogspot.com/2016/08/empirical-law-of-large-numbers-with.html
1•northlondoner•13m ago•0 comments

Kirin 9030 Hints at SMIC's Possible Paths Toward >300 MTr/Mm2 Without EUV

https://chentfred.substack.com/p/kirin-9030-hints-at-smics-possible
1•klelatti•14m ago•0 comments

Growth Marketer

https://secure.jotform.com/253381217909966
1•aisutariVI•22m ago•1 comments

Y Combinator Store

https://ycalumni.store/
1•swatson741•24m ago•0 comments

Alternative Crypto Lending: Personal Experience and Observations

1•Oleksandrslapko•24m ago•0 comments

Building a Reliable Job Scheduler: Leases, Idempotency, and Timezone-Aware Cron

https://github.com/Spooled-Cloud/spooled-backend
1•birdculture•27m ago•0 comments

Boris Cherny (Claude Code Creator) – What Grew His Career and Building Anthropic [video]

https://www.youtube.com/watch?v=AmdLVWMdjOk
1•romenrg•29m ago•0 comments

To sign or not to sign: Practical vulnerabilities in GPG and friends [video]

https://media.ccc.de/v/39c3-to-sign-or-not-to-sign-practical-vulnerabilities-i
1•karel-3d•33m ago•1 comments

Unsatisfying Meetings? Add a Thinking Mode Selector

https://medium.com/analysts-corner/unsatisfying-meetings-add-a-thinking-mode-selector-63d8668b1111
1•royklein•34m ago•0 comments

Show HN: ProfileHunt – Portfolio builder for product managers

https://profilehunt.in/
2•srinivas3651•35m ago•0 comments

The Breath Between Thoughts

https://rodgercuddington.substack.com/p/the-breath-between-thoughts
1•freespirt•37m ago•0 comments

Measuring out-of-sync clocks on the Internet

https://alexsci.com/blog/clock-skew/
1•todsacerdoti•41m ago•0 comments

Ask HN: Could someone kindly spare me an invite to Lobste.rs?

1•debayande•41m ago•1 comments

LSFG-VK: Vulkan layer for frame generation via lossless scaling

https://github.com/PancakeTAS/lsfg-vk
2•sibellavia•49m ago•0 comments

AI Is a Scam, but Don't Let That Spoil Machine Learning

https://gardinerbryant.com/ai-is-a-scam-but-dont-let-that-spoil-machine-learning/
3•chartered_stack•50m ago•1 comments

A tool that reconstructs real UIs from screen recording (not screenshot-to-code)

https://www.replay.build/
2•ma1or•52m ago•1 comments

Beads vs. Agent Hive: Who Stole Who's Take on AI Agent Memory

https://twitter.com/intertwineai/status/2005554519908737117
1•intertwiner•53m ago•0 comments

Show HN: I built an AI-based image-to-Excel tool to avoid re-typing tables

https://jpg2excel.app
1•owoamier•54m ago•0 comments

Uzbekistan's nationwide license plate surveillance system

https://techcrunch.com/2025/12/23/inside-uzbekistans-nationwide-license-plate-surveillance-system/
1•dmitrygr•54m ago•0 comments

Inverting the interface: design, personal agents, and the post-brand world

https://pianabianco.com/inout/inverting-the-interface-design-personal-agents-and-the-post-brand-w...
1•kurren•56m ago•1 comments

Orbital Compute

https://twitter.com/princeofprawns0/status/2005551417403265481
2•printerlover•1h ago•1 comments

Ask HN: How Do I Find an Angel Investor to Support My Startup?

1•Lordarminius•1h ago•0 comments

Show HN: NotebookLM Tools – Chrome ext to manage notebooks, sources, languages

https://chromewebstore.google.com/detail/notebooklm-tools/hiibkpjljigehlnnecbgehkhfibmahjn
1•trungpv1601•1h ago•0 comments

2025: That's a Wrap and Here Are the Stats

https://www.backblaze.com/blog/2025-thats-a-wrap-and-here-are-the-stats/
2•piqufoh•1h ago•0 comments

Payment giants preparing for a world where AI agents book flights, shop for you

https://www.cnbc.com/2025/12/29/ai-agentic-shopping-price-discounts-cheap-sales-commerce-visa-mas...
2•rustoo•1h 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.