HNHacker News
TopNewBestAskShowJobs

alex_smart

1,323 karma · joined April 30, 2014

submissionscomments
alex_smart··on My notes on Gitlab's Postgres schema design (2022)
And what is wrong with someone figuring out for themselves and explaining to others why some suggestion makes sense logically, rather than just quoting the manual?
alex_smart··on My notes on Gitlab's Postgres schema design (2022)
>The author effectively wastes many words trying to prove a non-existent performance difference and then concludes "there is not much performance difference between the two types".

They then also show that there is in fact a significant performance difference when you need to migrate your schema to accodomate a change in length of strings being stored. Altering a table to a change a column from varchar(300) to varchar(200) needs to rewrite every single row, where as updating the constraint on a text column is essentially free, just a full table scan to ensure that the existing values satisfy your new constraints.

FTA:

>So, as you can see, the text type with CHECK constraint allows you to evolve the schema easily compared to character varying or varchar(n) when you have length checks.

alex_smart··on Indian government moves to ban ProtonMail after bomb threat
What if it comes by a pigeon? Oh no!
alex_smart··on Inside the proton, the ‘most complicated thing you could possibly imagine’
https://youtu.be/36GT2zI8lVA

Richard Feynman on why questions

alex_smart··on Software Engineers Say the Job Market Is Getting Much Worse
I see this statement as an absolute win for the “senior” dev.
alex_smart··on How random is xkcd? (2015)
With n random bits, you will likely have approximately \sqrt{n} more ones than zeros (or vice versa).
alex_smart··on Positive news from 2023
Or you could just tend your own garden.

https://en.m.wikipedia.org/wiki/Candide

alex_smart··on C Object Oriented Programming (2014)
I don't think ability to forward arbitrary messages is any more a core part of Smalltalk than it is of Java.
alex_smart··on C Object Oriented Programming (2014)
>doesNotUnderstand:/forwardInvocation: isn't different? That is not just syntactical. How would you even begin to orient your objects without like functionality?

Not sure what you mean. Could you please elaborate?

> what are you trying to communicate when you say OOP?

The idea of using dynamic dispatch as a means of taming complexity.

alex_smart··on C Object Oriented Programming (2014)
You can definitely do that in Java too. This is how, e.g., Spring framework handles transactional behavior. It injects a proxy for each bean that is marked as @Transactional and the proxy object handles the coordination with the transaction manager and passes all the arguments to the real object.
alex_smart··on C Object Oriented Programming (2014)
I mean that, to me, the difference between message passing and method calling is not significant enough to say that these languages are following different programming paradigms - like you say OOP vs languages with objects.

Afaict the difference between Smalltalk and Objective-C style message passing and Java and C# style method calling is purely syntactic.

alex_smart··on C Object Oriented Programming (2014)
Is Smalltalk’s message passing really all that different from methods from other OOP languages? Seems like quite an arbitrary distinction to me.
alex_smart··on C Object Oriented Programming (2014)
When you read or write from a FILE in C, do you know or have to care about whether the FILE comes from disk, a pipe, a CD drive, or a device driver or a network mounted drive? What do you think FILE is if not an interface?
alex_smart··on C Object Oriented Programming (2014)
The biggest advantage of C-style polymorphism vs, say, C++ is that it actually offers much better encapsulation.

Having private methods declared in the header file which is supposed to be the public contract for the class is such an anti-pattern. And the usual solutions offered for this problem are ugly in their own right (*pImpl).

I only properly learnt to appreciate the power and beauty of OOP by reading people’s C code.

alex_smart··on The Case for Memory Safe Roadmaps
HFTs have pretty much all moved to FPGAs for sub-microsecond latencies in past few years. C++ can’t compete with that, let alone Java or Haskell.
alex_smart··on Stop Reading News (2013)
>It's interesting that this article was written 10 years ago.

Oh, you will definitely enjoy this quote! Try to guess when it was written. (Warning: there is a spoiler in the replies.)

https://news.ycombinator.com/item?id=38610428

alex_smart··on Stop Reading News (2013)
Nope. Being able to see through the countless subtle ways the news manipulate and misleads you and to gain any meaningful insight requires so much effort and critical thinking that it is simply not practical for vast majority of people.

I firmly stand by my opinion that "Stop reading news" is the best advice that can be given to most people interested in being better informed about the world.

alex_smart··on Stop Reading News (2013)
>I have no idea who it comes from

It was written by Thomas Jefferson.

alex_smart··on Stop Reading News (2013)
99.99% people who read news don’t read it critically, so their “decisions” are completely at the mercy of what the very impressive propaganda machinery that we call news. Any control people feel they have by making opinions based on reading news is an illusion.
alex_smart··on Stop Reading News (2013)
Here is my favorite quote of all time and not just because I agree wholeheartedly. Try to guess who the quote is from and fron when.

> Nothing can now be believed which is seen in a newspaper. Truth itself becomes suspicious by being put into that polluted vehicle. The real extent of this state of misinformation is known only to those who are in situations to confront facts within their knowledge with the lies of the day. I really look with commiseration over the great body of my fellow citizens, who, reading newspapers, live & die in the belief, that they have known something of what has been passing in the world in their time; whereas the accounts they have read in newspapers are just as true a history of any other period of the world as of the present, except that the real names of the day are affixed to their fables. General facts may indeed be collected from them, such as that Europe is now at war, that Bonaparte has been a successful warrior, that he has subjected a great portion of Europe to his will, &c., &c.; but no details can be relied on. I will add, that the man who never looks into a newspaper is better informed than he who reads them; inasmuch as he who knows nothing is nearer to truth than he whose mind is filled with falsehoods & errors. He who reads nothing will still learn the great facts, and the details are all false.

alex_smart··on Jets: Ruby Serverless Framework
Does the “lambda per api endpoint” part help with the application boot part or something? Otherwise I don’t quite see what advantage you would with that get over just one lambda for the entire monolith.

OC also mentions that they run a job to keep the lambdas warm. One disadvantage with the lambda per endpoint is that he has to keep dozens of lambdas warm instead of just one.

alex_smart··on Building end-to-end security for Messenger
Can I just say that I am a little surprised that their engineering blog is hosted on wordpress?
alex_smart··on Git Branches: Intuition and Reality
In my career, it has already happened more than once. And definitely not deliberately.

There are many ways this can happen accidentally. You could be trying to checkout a branch and tab complete your way into a folder name instead. You could be typing alt/esc + . with the intent of getting last argument of previous bash command, keyboard glitches and you end up with . instead.

Just because it hasn’t happened to you yet, you shouldn’t discount the experience of others. That’s like saying you have never messed up dd yet, so there are no problems with dd’s design.

alex_smart··on Git Branches: Intuition and Reality
git checkout is overloaded and has two use cases. git checkout $branch is safe, git checkout $file_or_folder_name will help you shoot yourself in the foot.
alex_smart··on Git Branches: Intuition and Reality
It wasn't replaced, the other two commands were added to the cli.

It will take decades before git checkout will actually get replaced by git switch/restore in all the git books, tutorials and search results. Most normal users will keep learning and using git checkout in the meanwhile.

I understand why they can't actually deprecate existing commands. The git command is used in far too many existing shell scripts across thousands of companies.

I would argue that this is actually a fundamental deficiency of the "unix way" of doing things, where the same command is meant to be used both by human beings and in automated workflows. Automated workflows require backwards compatibility. Humans need easy to use interfaces that don't allow them to easily shoot themselves in the foot. The same tool cannot serve both needs.

alex_smart··on I kind of killed Mercurial at Mozilla
I like it too, unfortunately it will take decades before books, tutorials and google search results can catch up.

It is the same fate as any cli application that needs to maintain backwards compatibility because it is used both by humans and programmatically as part of scripts. My favorite example of this dd. Most tutorials still show using dd against /dev/sda1 etc instead of using device names as humans should, and meanwhile people keep shooting themselves in the foot.

alex_smart··on Git Branches: Intuition and Reality
git checkout will also happily throw away local unstaged modifications, and I would argue that it is even more dangerous because I did not have to type "--hard" to shoot myself in the foot.
alex_smart··on Git Branches: Intuition and Reality
Let us also hope they do a git diff before pushing changes.
alex_smart··on Git Branches: Intuition and Reality
My "minimalist" list of git commands:

    git add
    git blame
    git branch
    git checkout
    git cherry-pick
    git clone
    git commit
    git diff
    git fetch
    git log
    git merge
    git pull
    git push
    git reset
    git rm
    git stash
    git status
17 commands in total. I don't think it is possible to be a professional software engineer without being familiar with them. Granted, some of these you may need more frequently than others.

My guess is, the OC relies on their IDE/editor for the functionality provided by some of these commands. But then, why not just go all the way. Just use all VC features provided by your IDE, and claim that you need zero git commands.

alex_smart··on I kind of killed Mercurial at Mozilla
> you should also shy away from features if you do not really need them

>Learn those and you'll mostly good to go.

I wasn't really talking about "fancy" features of git, like rebasing history to try to make your history pretty or using things like git bisect. You need to develop basic understanding of git internals, even in the most basic workflow.

I would argue that your list of commands is not in any way complete for being "mostly good to go". At the minimum, you also need to know `git clone`, `git push`, `git pull`, `git fetch`, `git diff`, `git log`, `git blame`, and `git reset` as well. You need to save progress on your current feature branch to context switch to review some PR or analyze some production bug, well add `git stash` to the list. Your boss asked you to hotfix your recent commits onto the release branch? Better not forget `git cherry-pick`.

That brings us to 17 commands (up from the 7 you listed). Fine, it is still a finite number. Can you at least use them as a black box without bothering about the internals? NOPE. You also have to learn a lot of concepts to even understand the help and error messages for these commands - the worktree, the index, the stash, HEAD, ours vs theirs, conflicts, remotes, tracking branches.

Besides, so many commands come with their own gotchas (git checkout will happily overwrite your local changes - without any warning). Some have bad defaults, so you need to figure out which of the hundreds of options that command supports to make it do what you actually want (e.g. git log --oneline and git diff -w -b). Still others have overloaded semantics and do two completely different things (git checkout switches branches but also restores files).

← PreviousPage 5 of 19Next →