frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Amorce – Universal Trust Protocol for AI Agents

1•trebortgolin•26s ago•0 comments

Open Sourcing the Remix Store

https://remix.run/blog/oss-remix-store
1•doppp•1m ago•0 comments

Linux Foundation Leader: We're Not in an AI Bubble

https://thenewstack.io/linux-foundation-leader-were-not-in-an-ai-bubble/
1•CrankyBear•1m ago•0 comments

San Francisco Sues Ultraprocessed Food Companies

https://www.nytimes.com/2025/12/02/us/san-francisco-ultraprocessed-food-lawsuit.html
1•raybb•2m ago•0 comments

Spectrum ISP SSL/TLS Interception Bug

https://andrewgazelka.notion.site/SSL-Issue-2c46ce90d17f80a9bc30ff3402f7f865
1•sleepingreset•3m ago•0 comments

Techmeme: The news site SV CEOs like

https://techmeme.com/
1•sleepingreset•5m ago•0 comments

How to Use N8n to Sync Google Calendar Automatically

https://www.indiehackers.com/post/how-to-use-n8n-to-sync-google-calendar-automatically-a6BYizPK8i...
1•plakhlani2•6m ago•0 comments

Foundations of Metrology (1981) [pdf]

https://nvlpubs.nist.gov/nistpubs/jres/086/jresv86n3p281_A1b.pdf
1•nill0•7m ago•0 comments

The Future of Fleet – The Fleet Blog

https://blog.jetbrains.com/fleet/2025/12/the-future-of-fleet/
1•ossusermivami•7m ago•0 comments

Prisma ORM Without Rust

https://www.prisma.io/blog/prisma-orm-without-rust-latest-performance-benchmarks
1•justinhj•9m ago•0 comments

The Day We Realized Who Colonizes the Galaxy

1•EGreg•12m ago•0 comments

Show HN: Edit JSON files with comments, read them as clean JSON

https://github.com/skorotkiewicz/jsonc
2•modinfo•14m ago•0 comments

Major N.L. healthcare report contains errors likely generated by AI

https://theindependent.ca/news/lji/major-n-l-healthcare-report-contains-errors-likely-generated-b...
1•toomuchtodo•17m ago•1 comments

RGE-256:A New ARX-Based PRNG with Structured Entropy and Empirical Validation

1•sreid90•19m ago•0 comments

The power of proximity to coworkers [pdf]

https://pallais.scholars.harvard.edu/sites/g/files/omnuum5926/files/2025-11/Power%20of%20Proximit...
4•yodon•26m ago•2 comments

Satellite boom is a 'growing threat' to space telescopes

https://abcnews.go.com/Technology/satellite-boom-growing-threat-space-telescopes-nasa-study/story...
2•gmays•29m ago•0 comments

Australia's teen social media ban has unofficially begun

https://www.abc.net.au/news/2025-12-04/when-is-the-teen-social-media-ban-what-apps-are-banned/106...
3•jacobedawson•31m ago•3 comments

Cooperation and rapport promote interpersonal synchrony

https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0333709
1•PaulHoule•38m ago•0 comments

British Transport Police to Trial Live Facial Recognition at Railway Stations

https://www.btp.police.uk/news/btp/news/england/british-transport-police-to-trial-use-of-live-fac...
1•a2fz•39m ago•0 comments

Operation Bluebird Inc files petition to cancel the Twitter trademarks

https://ttabvue.uspto.gov/ttabvue/v?pno=92090266&pty=CAN&eno=1
3•davideg•41m ago•1 comments

Gall's Law: Working complex systems invariably evolve from simple systems

https://principles-wiki.net/principles:gall_s_law
2•kaonwarb•43m ago•0 comments

BRICS Gold-Backed Digital Currency: Reshaping Global Trade in 2025

https://discoveryalert.com.au/brics-gold-backed-digital-currency-initiative-2025/
1•rguiscard•46m ago•0 comments

Common Performance Tuning Advice: Some Flaws

https://ricomariani.medium.com/common-performance-tuning-advice-some-flaws-b2c427fad7ca
1•dbgrman•47m ago•0 comments

Model sizes are currently constrained by availability of inference hardware

https://www.lesswrong.com/posts/Q9ewXs8pQSAX5vL7H/ai-in-2025-gestalt?commentId=PEiZF3D3PZttPRWzt
1•ipnon•47m ago•0 comments

Show HN: Namefi built WebGPU-powered in-browser LLM pure client-side infer UX

https://search.labs.namefi.io/?tab=brainstorm&query=dna
1•xinbenlv•47m ago•0 comments

Ask HN: What's the Best HN Client?

1•billsunshine•51m ago•1 comments

Learning to love mesh-oriented sharding

https://blog.ezyang.com/2025/12/learning-to-love-mesh-oriented-sharding/
1•matt_d•53m ago•0 comments

Free open-source tool let me upscale old photos without paying a cent

https://www.makeuseof.com/free-tool-upscale-old-photos-without-paying/
1•NayamAmarshe•53m ago•0 comments

Show HN: Dabuun – Turn one line of text into a social video

https://dabuun.com
1•kazusan•1h ago•0 comments

I am at my best when I am obsessed, what about you?

https://www.rupokghosh.com/productivity-obsession
1•Rupok•1h ago•0 comments
Open in hackernews

Ask HN: Java why put string in a constant?

1•ramsicandra•6mo 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•6mo 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•6mo 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.