HackerNews Client

Parth
Written by Parth on
HackerNews Client
The code repository can be found here.

This started off with my introduction to HackerNews and a need to create something tangible as a project. Fresh out of my internship, I have certain degree of experience writing Java. It might not be the language that’s “hip”, but it runs the world. So this is what the project is:

hnfx - A JavaFX based cross-platform GUI client for HackerNews

HackerNews is a content aggregator website, mainly focused on tech-related news and developments. I have been fascinated with the content on “HN” and I decided to create a desktop client for it.

HN provides a pretty straightforward API allowing me to access the news feed as a JSON response, including the comments and content. The comments are tree-based and can be accessed using the kids key. I have used Swing for the Java GUI previously but decided to use JavaFX this time so that I can learn it.

As the screenshot shows, the structure is simple. A ListView on the left that is loaded asynchronously. The right is a TabPane containing two tabs : WebView and the comments tree.I also use a ProgressBar to show the WebView loading.

Scratchpad/Thoughts:



## Current status:

-   19th July 2019 : 
    -   I am intrigued by asynchronously updating the ListView for the initial api call. Works well for now. I'll have to do some testing to make sure nothing is getting lost in the thread jungle.
    -   JavaFX's WebView engine is slow. Or it might be my internet connection. Not sure.
    -   I want to add Firefox as the engine. I'll try that.
    -   Watching my github commit grid show a dark green square makes me happy.
-   20th July 2019 : 
    -   Java 8's JavaFX WebView is [broken](https://bugs.openjdk.java.net/browse/JDK-8175802) as it cannot render modern fonts
    -   Will I need a JRE if I create an exe for Windows, dmg/pkg for Mac etc. ?
    -   I'll implement the data structure for showing the comment tree today
-   22nd July 2019 :
    -   Updated to Java 12. Fixed the WebView font rendering.
    -   I didn't need to create a data structure for the comment tree. Just created a separate method for populating the TreeView.
    -   I'm pretty sure I have screwed up the concurrency for the program. I need to understand and fix that.
-   25th July 2019 :
    -   Fixed the concurrency issues.
    -   Adding a tab for comments and a progress bar to the window.
-   30th July 2019:
    -   The client works!
    -   Except for a random crash, all webpages are rendered with the comments :)