Better HN
topnewbestaskshowjobs
Log inSign up

cryptos

1,795 karma · joined Sep 13, 2012 (14y ago) · 646 submissions

Submissions

391.

What Functional Programming Is, What It Isn't, and Why It Matters(inner-product.com ↗)

3 points · by cryptos · 6y ago · discuss

comment 6y ago · link · parent

> good OOP practice means you provide getter and setter methods to control access to that data

It is this superficial understanding of OOP that led to a somewhat bad reputation. At least in the form "getX" and "setX" it would be more of a data structure with mostly useless methods around the fields. If a programmer is able to set each and every field from the outside through a setter, there is no encapsulation at all. To have objects that deserve this name, a method should be more like a "transaction" on the object, so related fields should be changed in one shot.

Apart from that, I don't think it is useful to think in separate camps (OOP vs FP) here, since both approaches are complementary in many cases. It is not like you have to decide for the one or another theses days, since most common languages support OOP and FP style.

comment 6y ago · link · parent

I had a large link collection there, but migrated away when the stumbling began. After trying some of these services, I've settled with diigo.com and never looked back. It seems to be a rock solid business that won't appear anytime soon. As much as I like the idea of a one-man show like pinboard, I don't want to trust thousands of links to a service with a "bus factor" of 1.

comment 6y ago · link · parent

Fair point. A compromise could a somewhat shorter version of the original link:

    https://amazon.com/Fundamentals-Software-Architecture/dp/B0849MPK73/
This includes the main title of the book + ID (this variant also works).

comment 6y ago · link · parent

It would be good if more care would be taken when designing URL schemes. It is not accidental that URL shorteners are used everywhere.

Look for example at this link:

    https://www.amazon.com/Fundamentals-Software-Architecture-Engineering-Approach-ebook/dp/B0849MPK73/ref=sr_1_1?dchild=1&keywords=software+architecture&qid=1594966348&sr=8-1
Maybe each part has a solid reason to exist, but the result is a monster.

I would prefer something like this:

    https://amazon.com/dp/B0849MPK73
And guess what, the above short link actually works! But Amazon didn't use this kind of links as a standard.

396.

Ask HN: Best ways to retain qualified employees?

100 points · by cryptos · 6y ago · 153 comments

comment 6y ago · link · parent

What is the big advantage of replacing the body and updating the header compared to just refreshing the complete page?

comment 6y ago · link · parent

Probably interesting in this context is ROCA, Resource-oriented Client Architecture. The basic idea is to deliver HTML and beeing RESTful, while using JavaScript only to enhance user experience ("Progressive Enhancement").

However, one practical problem with this approach is that HTML forms currently only support POST and GET, although PUT and DELETE were needed in many scenarios. Without JavaScript the only solutions are using POST for everything or using POST + hidden form field with the desired HTTP method and rewriting the request on the server side.

https://roca-style.org/

comment 6y ago · link · parent

I appreciate such efforts and consider QWERTY more or less a historical accident. But how do you actually use these layouts? Do you pull the keys from your keyboard and rearrange them physically? But what about notebooks then where this is often not possible? Or do you train you brain to remember the key positions so that it doesn't matter what character is printed on a key? But how do you _learn_ the layout then?

The longer I think about it the more I come to the conclusion that you have to hammer the new layout into your head, since there are many situations, like the keyboard of a colleague, where the physical layout wouldn't match. But again: how to learn it efficiently without a lot of frustrating typing errors?

The best would be some kind of official standard and the introduction of a new layout in schools.

comment 6y ago · link · parent

We really need more courageous people like Tim Bray!

comment 6y ago · link · parent

What is the business model?

comment 6y ago · link · parent

Thanks, it works.

comment 6y ago · link · parent

While we are at it: Does anyone know how to hide the new commit view? I haven't found a related action I could assign a shortcut to.

comment 6y ago · link · parent

What do you think will be the response of GitLab?

comment 6y ago · link · parent

But tables in LaTeX are not fun, too. Once upon time I was about to write a bunch of big and complex tables with LaTeX and needed to include "mini pages" in table cells to be able to render complex content. It was so awkward that I stopped using LaTeX.

comment 6y ago · link · parent

I totally agree with you. Markdown is nice as a pretty simple documentation format. It is a good fit for something like a letter, a README or a short tutorial. I you go beyond this level, you are better off with something more powerful like AsciiDoc.

From that point of view, tables should have never been part of Markdown.

comment 6y ago · link · parent

The syntax simulates the visual representation of tables, but that doesn't scale for larger tables with many columns and/or large columns with a lot of content. Another downside is that you can not use markup, like bullet lists or source code formatting, in table cells.

Markdown tables are overly simplistic.

comment 6y ago · link · parent

Although it looks nice, tables and Markdown are not a good fit. The syntax for tables in Markdown is broken by design!

AsciiDoc got it right: https://asciidoctor.org/docs/asciidoc-syntax-quick-reference... You can even have formatted source code in AsciiDoc table cells. Try this with Markdown ...

409.

Czech hospital hit by cyberattack while in the midst of a Covid-19 outbreak(zdnet.com ↗)

2 points · by cryptos · 6y ago · discuss

comment 6y ago · link · parent

Java is quite far away from finally solving NullPointerException issues. Kotlin, C# or TypeScript with their compile time null checks solved it mostly. Common to these three languages is that they need null to be interoperable with older language versions (C#) or with related languages (Java, JavaScript). Languages like Rust that don't even know null (or nil as in Go), have finally solved the problem.

comment 6y ago · link · parent

crypto + Switzerland just triggered the thought. Nothing else is special about my example.

comment 6y ago · link · parent

The same could happen with Threema. As much as I like and want to trust Threema, but the story could be repeated, even if I think, that it is not used by governments or military large-scale.

Essentially every closed source crypto application isn't trustworthy. Same is true for operating systems.

comment 6y ago · link · parent

From my experience a good thing to do is to set up strong static code analysis (like eslint, TypeScript strict mode, IntelliJ inspections, Sonarqube, ...) when the project begins. This helps to avoid some endless discussions and some bugs. Another upside is, that the rules are enforced automatically what is better than to remind your colleagues each and every time when the break the rules. With a set of rules written down as a config file for a code analysis tool, there is a definition of clean code (even if not a complete one).

Starting with overly strong rules and relaxing them later is better than starting with loose rules and tighten them later, because it would require much refactoring to introduce a new rule, whereas dropping a rule is a thing of a few seconds.

comment 6y ago · link · parent

Great advice, especially in times where (seemingly?) many people are satisfied with pre-made answers from the internet they just copy and paste without understanding.

comment 6y ago · link · parent

It is not hard but cumbersome, ugly and ruins readability when used a lot.

comment 6y ago · link · parent

Java gets better with every release and is a pretty decent language today. But Kotlin feels just more consistent with less corner cases. Let me name a few things:

    * No checked exceptions destroying lambda expressions and leading to architecture problems (since exceptions are oft not used like the inventors of checked exceptions assumed).
    * Functions are real first class citizens and don't need artificial interfaces.
    * Named parameters with default arguments are very practical.
    * `name: Type` is a better fit for type inference than `Type name`.
    * Null-safety helps to avoid lots of bugs.
    * The type system with `Any` as a unified root and `Unit` instead of the special case `void` makes programming with generics much easier.
    * Constructors are always lean, not only for data classes (record in Java 14).
    * Most things are expressions, so you can write `val a = if(cond) 1 else 99`.
    * Extension functions and operator functions can be used to write simple to use and elegant APIs.
So at least for me Kotlin is definitive the better Java and I wouldn't start a new project with Java, if I could use Kotlin instead.

comment 6y ago · link · parent

I think Scala hast lost most of its appeal due to Kotlin. Scala has some really powerful and clean concepts, but tooling is not as good as Kotlin's. Scala has a much steeper learning curve, and Scala code can look very different depending on who wrote it. These are all drawbacks in real world projects.

With Kotlin you get like 80 % of the good things from Scala for 20 % the efforts.

I've switched from Scala to Kotlin 3 years ago and didn't miss much (real pattern matching come to mind).

comment 6y ago · link · parent

There is a lot more than the language/compiler what influences the results, but at least these benchmarks are closer to real world than solving math puzzles in micro benchmarks.

https://www.techempower.com/benchmarks/

1
131415
22