frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Show HN: Kitcat 2.0 – A Matplotlib back end for terminal plotting

https://mil.ad/blog/2026/kitcat-2.0.html
1•playnext•2m ago•0 comments

Show HN: Ingestlayer – Programmable event tracking pipelines

https://ingestlayer.com
1•benmann•5m ago•0 comments

Can You Spot the AI Bodega?

https://www.curbed.com/article/ai-slop-bodega-signage-design.html
1•SVI•5m ago•0 comments

Show HN: Open-source job search plugin for Claude Code

https://github.com/agent-data/job-search
1•jb_hn•6m ago•0 comments

VigilSwift – A fast, free web security scanner built for devs

https://vigilswift.com
1•alex_vs•6m ago•0 comments

Five Eyes warns AI models capable of toppling governments are months away

https://www.theguardian.com/technology/2026/jun/22/anthropic-claude-fable-ai-model-artificial-int...
4•speckx•13m ago•1 comments

Steam Machine Launches Today

https://store.steampowered.com/news/group/45479024/view/685257114654870245
17•no_news_is•13m ago•3 comments

Steam Machine Game Testing

https://www.lttlabs.com/articles/2026/06/22/the-newell-nucleus-steam-machine-ltt-companion-article
4•LabsLucas•15m ago•0 comments

Iris – A portable runtime for durable AI agents

https://github.com/xoai/iris
2•xoai•15m ago•0 comments

Show HN: Block/buzz: a workspace built for teams of humans and agents

https://github.com/block/buzz
6•ThomPete•15m ago•1 comments

Geometry of causal set theory with physics implications

https://docs.google.com/document/d/1yYXSX_XssHXV5msGj2eC74fs6P2PG_sL/edit
1•Darktidemage•16m ago•1 comments

Angeldust – a solo-built voxel world that runs on everything [video]

https://www.youtube.com/watch?v=zssnlbRibFM
1•coolwulf•17m ago•0 comments

Does AI have a UI/UX problem?

https://twitter.com/PereraBinoy/status/2068432457234513955
2•adisingh13•17m ago•1 comments

Daybreak: Tools for securing every organization in the world

https://openai.com/index/daybreak-securing-the-world/
3•tabletcorry•17m ago•0 comments

A Glimpse into the "Search Your Target" Market for Stolen Credentials

https://www.bleepingcomputer.com/news/security/a-glimpse-into-the-search-your-target-market-for-s...
1•Brajeshwar•19m ago•0 comments

A 10-person team cut median cycle time from 72 to 27 hours in 30 days

https://www.poggle.ai/blog/engineering-productivity-case-study
1•Ghostcrawl3r•20m ago•0 comments

Meta's Crawler Ate My 2TB Bandwidth

https://www.rodneyosodo.com/blogs/2026-06-22_metas_crawler_ate_my_2TB_bandwidth
1•rodneyosodo•20m ago•1 comments

Steam Machine 512GB

https://store.steampowered.com/sub/1629447/
17•Philpax•21m ago•1 comments

A viral doomsday scenario aims to shake Europe out of its AI complacency

https://www.theguardian.com/technology/2026/jun/20/europe-sleepwalking-ai-disaster-us-china
3•gmays•22m ago•0 comments

Steam Machine

https://store.steampowered.com/hardware/steammachine
44•theschwa•22m ago•7 comments

Blogger Defeats Photographer's Copyright Claim-Sokolskyfilm vs. Messiah

https://blog.ericgoldman.org/archives/2026/06/blogger-defeats-photographers-copyright-claim-sokol...
10•speckx•26m ago•0 comments

Unit Tests for a Novel

https://worldfall.ink/blog/
4•isobelvane•26m ago•0 comments

My journey of making my first-ever circuit

https://medium.com/@khwajamaazahmedsiddiqi/my-journey-of-making-my-first-ever-circuit-4f1de935fecd
2•pknerd•26m ago•0 comments

The Download: record-breaking subsea tunnels and flexible data centers

https://www.technologyreview.com/2026/06/22/1139385/the-download-rogfast-subsea-tunnel-flexible-d...
2•joozio•28m ago•0 comments

Europe faces rising competition for energy from Asia

https://www.politico.eu/article/every-man-for-himself-europe-warned-of-rising-competition-for-ene...
3•alephnerd•28m ago•0 comments

Tata Electronics cyber breach claiming to expose Apple, Tesla trade secrets

https://www.yahoo.com/news/world/articles/indias-tata-electronics-hit-cyber-153155513.html
11•Hypathia•28m ago•1 comments

Show HN: Loqi, a "local-first" translation tool using Ollama/llama.cpp

https://github.com/danterolle/loqi
2•danterolle•30m ago•0 comments

Show HN: React Native Boost – swaps RN's Text/View wrappers for native ones

https://github.com/kuatsu/react-native-boost
3•mfkrause•30m ago•1 comments

It Was Always Email

https://www.primitive.dev/blog/it-was-always-email
5•mymx•32m ago•0 comments

Plans for battery swapping Electric trucks in UK

https://www.independent.co.uk/cars/electric-vehicles/battery-swap-for-electric-trucks-octopus-cat...
4•lonelyasacloud•33m ago•1 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.