Live data from Hacker News

Let's build a JPEG decoder: Huffman tables

imrannazar.com

1–10 of 15 posts

Re: Let's build a JPEG decoder: Huffman tables

#2
Huffman encoding should be a mandatory topic you can explain before you are allowed to write a web api.

I hate when people output json that's not self documenting enough because they don't understand that aReallyNiceLongNameThatDescribesTheAttribute and nam1 compress to functionally the same size once you turn on compression.

One API recently I saw had a few single letter names. I could still figure it out, but it was figuring it out instead of just reading the name.

Re: Let's build a JPEG decoder: Huffman tables

#3
post #2

Huffman encoding should be a mandatory topic you can explain before you are allowed to write a web api. I hate when people output json that's not self documenting enough because they don't understand that aReallyNiceLongNameThatDescribesTheAttribute and nam1 compress to functionally the same size once you turn on compression. One API recently I saw had a few single letter names. I could still figure it out, but it wa…

While I do agree that web APIs should keep compression in mind, as the user of the API I don't necessarily want to type aReallyNiceLongNameThatDescribesTheAttribute either. I'd rather see a word or two than a letter, but I'd rather see a letter than a sentence.

Re: Let's build a JPEG decoder: Huffman tables

#4
post #2

Huffman encoding should be a mandatory topic you can explain before you are allowed to write a web api. I hate when people output json that's not self documenting enough because they don't understand that aReallyNiceLongNameThatDescribesTheAttribute and nam1 compress to functionally the same size once you turn on compression. One API recently I saw had a few single letter names. I could still figure it out, but it wa…

This seems fitting.

There are only two hard things in Computer Science: cache invalidation and naming things.

-- Phil Karlton

Re: Let's build a JPEG decoder: Huffman tables

#5
post #2

Huffman encoding should be a mandatory topic you can explain before you are allowed to write a web api. I hate when people output json that's not self documenting enough because they don't understand that aReallyNiceLongNameThatDescribesTheAttribute and nam1 compress to functionally the same size once you turn on compression. One API recently I saw had a few single letter names. I could still figure it out, but it wa…

technically your example is incorrect unless the same attribute name is used quite a few times. Regardless, premature optimisation is the root of all evil, especially in places that are highly unlikely to be a bottleneck and even more so when it's used to remove valuable documentation.

Re: Let's build a JPEG decoder: Huffman tables

#6
Slightly off topic, but heck.

I was lucky enough to have David Huffman as an instructor at UC Santa Cruz. Very engaging and smart guy. He got a little tired about being asked about "Huffman Coding" all the time, given it was so long in the past and he had done a number of other things.

One of the things he enjoyed talking about during office hours (if help wasn't needed) was his paper folding:

http://www.graficaobscura.com/huffman/

Gives a good example.

Re: Let's build a JPEG decoder: Huffman tables

#7
post #2

Huffman encoding should be a mandatory topic you can explain before you are allowed to write a web api. I hate when people output json that's not self documenting enough because they don't understand that aReallyNiceLongNameThatDescribesTheAttribute and nam1 compress to functionally the same size once you turn on compression. One API recently I saw had a few single letter names. I could still figure it out, but it wa…

This seems fitting. There are only two hard things in Computer Science: cache invalidation and naming things. -- Phil Karlton

"...and off by one errors"

:)

Re: Let's build a JPEG decoder: Huffman tables

#8
post #7

Earlier quoted context omitted.

This seems fitting. There are only two hard things in Computer Science: cache invalidation and naming things. -- Phil Karlton

"...and off by one errors" :)

I had a very heated argument with a friend on saterday about 0 indexed arrays. God damn I hate them.

Re: Let's build a JPEG decoder: Huffman tables

#10
post #7

Earlier quoted context omitted.

"...and off by one errors" :)

I had a very heated argument with a friend on saterday about 0 indexed arrays. God damn I hate them.

Just stop using the word index and start using the word offset. Problem solved.

The notion that the first brick in a run has an offset of 0 as does the first upright stud in a frame is something that's been basic to bricklayers and carpenters for a very long time.

Sometimes it's natural to refer to elements by their position, or offset, other times it's natural to talk about sequence numbers or indexes.

Post reply on HN