frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

A world that no longer exists: preserving family legacy and travel experience

https://arceri.netlify.app/?lang=en
1•tcsenpai•1m ago•1 comments

A safety checklist in the prompt didn't measurably help frontier models

https://theagentforge.io/lab/4/results
1•djayamaha•1m ago•0 comments

China rushes to shore up markets as AI trade sours

https://www.ft.com/content/2bb82c45-04b2-4ccc-9002-f54483fb044e
1•JumpCrisscross•1m ago•0 comments

Show HN: Chopstick – Mac notch widgets built by your coding agent

https://chopstick.sh/
1•joshuaknauber•2m ago•0 comments

Show HN: Parley – coding-agent sessions that collaborate over IRC

https://github.com/colinsurprenant/parley
1•colinsurprenant•3m ago•1 comments

Studio 3e8: Mesa 1, Metal 3D Printer

https://www.studio3e8.com/post/studio-3e8-launch
1•danthompson41•3m ago•0 comments

Is It O.K. To Be a Luddite?

https://archive.nytimes.com/www.nytimes.com/books/97/05/18/reviews/pynchon-luddite.html
1•lifeisloving•4m ago•0 comments

Show HN: Algeon – Compose GPU graph, vector, and ML algorithms in SQL

https://github.com/algeon-dev/algeon
1•morristai•4m ago•0 comments

Gta.js – The Original 1997 Grand Theft Auto Engine in JavaScript and WebG

https://gtajs.wtf/#demo
1•rmason•4m ago•0 comments

Opus 5.5 is awesome

https://alexkras.com/opus-5-5-is-awesome/
1•akras14•4m ago•0 comments

The AI cost of JavaScript frameworks

https://nolanlawson.com/2026/10/28/the-ai-cost-of-javascript-frameworks/
2•notfried•4m ago•0 comments

Show HN: Arketum – MCP server that makes coding agents stop for human approval

https://www.npmjs.com/package/@rlabs-cl/arketum
1•rlabbe•5m ago•0 comments

Keep the Changelog, Avoid the Conflicts

https://devenv.sh/blog/2026/10/28/keep-the-changelog-avoid-the-conflicts/
1•domenkozar•5m ago•0 comments

Psychometrics, vaccines, meat, Kowloon, luggage destruction

https://dynomight.net/shorts-8/
1•surprisetalk•6m ago•0 comments

Size matters: South Korea spared iPad mini image's potentially offensive gesture

https://appleinsider.com/articles/26/10/28/size-matters-south-korea-spared-ipad-mini-images-poten...
1•docdeek•7m ago•0 comments

GPU vs. CPU. How to Cut Live Streaming and AI Processing Costs?

https://www.red5.net/blog/gpu-vs-cpu-how-to-cut-live-streaming-ai-processing-costs/
1•mondainx•8m ago•0 comments

Show HN: Goxlint, custom linting rule engine for Go inspired by oxlint

https://github.com/egoisutolabs/goxlint
1•generalist_dev•9m ago•0 comments

Show HN: Achive – 12y/O built commitment app, 95% of failed stakes to hospice

https://achive-app.vercel.app/
3•SlovakGuy•12m ago•0 comments

CNC Stone Carving

https://carmelitegothic.com/cnc-stone-carving/
3•bschne•13m ago•0 comments

Museum of Music Technology

https://themmt.org/
1•gregsadetsky•13m ago•0 comments

Show HN: Interview your analysts instead of auto-generating a semantic layer

https://github.com/nodal-data/nodal-context
1•ronpotok•16m ago•0 comments

Ask HN: MCP vs. AI integrated in your software

1•lorinab•16m ago•0 comments

Jeanette Winterson on AI and the future of humanity

https://www.theguardian.com/books/2026/oct/28/no-inevitable-dystopia-jeanette-winterson-ai-future...
1•Archelaos•16m ago•0 comments

Show HN: WorkSnap – a time tracker for freelancers, built spec-first

https://worksnap.eu
1•beybol•18m ago•1 comments

The Manic Pixel Dream Girl: She's hot, hates rent control, and isn't real

https://sfstandard.com/2026/09/30/manic-pixel-dream-girl-ai/
2•rmason•18m ago•0 comments

Show HN: Yavashark: I've Built a JavaScript Engine Every Day for 950 Days

https://yavashark.dev/blog/announcing-yavashark/
1•sharktheone•19m ago•0 comments

Scaling AI in Legal: Building Uber's Redlining Agent

https://www.uber.com/us/en/blog/building-ubers-redlining-agent/
1•zerop•19m ago•0 comments

I built a tool with Claude Code that makes the correction stick

https://github.com/globalmpc/nomore
2•bayarkhuu5155•19m ago•0 comments

Accelerating Ubuntu Core Desktop

https://jnsgr.uk/2026/10/accelerating-ubuntu-core-desktop
4•jnsgruk•20m ago•1 comments

Show HN: Convoy – Easiest way to get paid for sharing your knowledge

https://convoy.so
1•misteryomi•20m 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.