Hacker News new | past | comments | ask | show | jobs | submit login

It is interesting to think that 500 lines of code is something one can write in one or two days. But, writing a C compiler in 500 of comprehensible code (even in python) is challenge in itself that may take months after a few years of solid learning.

I wonder if is this a good path to becoming an extremely productive developer. If some one spends time developing projects like this, but for different areas... A kernel, a compressor, renderer, multimedia/network stack, IA/ML... Will that turn a good dev into a 0.1 Bellard?




> 0.1 Bellard

Off topic, but a log scale might be useful: 0.1 Bellard --> -10 deciBellards. That allows for: 0.001 Bellard --> -30 deciBellards.

Problem: Programmers with negative productivity cannot be represented on the same log scale.


Sure they can. Abs(). Or if you prefer to not have quite so much micro-nano, you could also use Cumulative Distribution Functions [1] which are basically just sums of Probability Density [2].

Are they a 4σ programmer, 1σ programmer, -0.5σ programmer, -2σ programmer?

Plus, most people are "average" not negative productivity, and CDFs let you use really fun stuff like Beta Distributions (variable, shapable distributions) and Gamma Distributions (exponential distributions). They're super sweet as far as probability statistics.

[1] https://en.wikipedia.org/wiki/Cumulative_distribution_functi...

[2] https://en.wikipedia.org/wiki/Probability_density_function

[3] https://en.wikipedia.org/wiki/Beta_distribution

[4] https://en.wikipedia.org/wiki/Gamma_distribution


The number of people that are average is infinitesimal, even if you define average as “mode” instead of median or mean.

About half are better than median though.


>>> Problem: Programmers with negative productivity cannot be represented on the same log scale.

This is similar to the problem of price-to-earnings ratio. The ratio goes asymptotic as earnings goes through zero. It would be better to quote earnings-to-price ratio. Another screwy reciprocal unit is miles per gallon for cars.


Now that I have an EV with 130 miles of range, I’m finding miles per kwh to be much more useful than efficiency.

I’d bet range anxiety was also a thing for early gasoline powered cars, so the early adopters of those probably preferred mpg over gpm.


at the very least it'll remove a lot of 'magic' from programming. Today a lot of people seem to be not so fond of university education but I'm personally very glad it made me go through implementing a shell, a compiler, a little toy kernel and so on.

The feeling that you write code somewhere in the skies and have no idea how something works underneath has always really bugged me when I've used something.


You don't need a university education to do those things, just some curiosity.

The function of the university in the near future will probably just be to have like-minded curious people to discuss ideas with, and to get a better grasp of what problems need to be solved (specifically scientific ideas, rather than just applying engineering).

The prestige element (specifically of certain universities over others, perhaps not university over high school) is dwindling, and hopefully will be abolished with this new generation.


The "uni degree value" discussion on here is very biased towards the US, where expensive courses exist, some excellent but others perhaps not providing sufficient value for money.

Note that in several countries in Europe, studying is free of charge or only costs a symbolic fee (scholarships aside).

The university system is thousands of years old, and it would be disastrous if it were abolished. I'm a self-taught developer, who also obtained two Masters and a Ph.D. later, and I can attest to it that the speed of learning at uni cannot be compared with the speed of learning via self study, especially self-study in isolation.

Having said this, learning only in groups/herds is also not the best approach IMHO, there is something to sitting alone and figuring something out without external help, at least occasionally, as it trains your analytical skills, your ability to concentrate and it gives you grit/perseverance.


Lectures were made obsolete by Gutenberg. There is little of value (but not none, ok) in wasting time of reputable professors on repeating the same stuff each semester to a hall of 200 students.

Seminars/labs and office hours is where the biggest value of university can come from, but that’s the part that is often left to TA…


I found that attending my home state university afforded me access to facilities and resources I would never have had on my own, and to not just a wealth of knowledge but also mentors and incredibly capable guides for how to navigate that knowledge while putting into productive practice.

Motivation and internet access can get some of those things, but even among those things one would struggle to find them in one place and so readily available to them.


A university degree is much more than this, and I think most people who view its value as “dwindling” have not had the experience…


It would be great if there were more emphasis on some of the aspects that made academia so great many years ago, but unfortunately the scene has changed dramatically.

My perspective on the value dwindling comes from several graduate degrees and teaching at some of these 'prestigious' universities in the northeast.

It is of course just my singular experience, but the handful of research institutions I have worked at actually provided more of a typical 'academic' atmosphere than the universities, unfortunately. I still really want to believe that universities provide the most innovative research environment, but the incentive and operational structures don't really make it as optimal.

The reason I mention the new generation viewing its value as dwindling is that the cost isn't really 'worth it' and many of the best educational resources are actually free online now.

I'm an academic, so the fact that the investment doesn't pay off doesn't really bother me (academics typically don't care about money), but many people do want some financial advantage from education, and that isn't as present anymore.


What is implied by “much more than this” and why shouldn’t those things be available to people not enrolled into a university?


It massively depends on what degree and where I suppose. Most people I know with degrees view it as a complete waste of money.


Most people with a university degree don’t have a traditional university education.

I’m very much pro-education, and think that US high school should include the first two years of a current university education (grades should be roughly split between D, C, B and A, where D means “meets curriculum requirements”).

After that, I don’t think many people should go to a university. Instead, the state should provide up to 10 years of vocational education (splittable and redeemable at any point in life) or 8 years of university education (subject to a B or better average in high school).

Most vocational programs would be under 3 years, so you’d get three-four cracks at finding the right profession for you.

University track would be targeted at educators, researchers and entrepreneurs.

I think this would be better for every socioeconomic demographic in the US, and also help alleviate the housing shortage, enable modern manufacturing, fix many current issues with healthcare, and so on.)


I'm largely taught outside the academic world. so I sympathize with your position.

however, the engineering culture which took the time to tell me about all these cool things and let me grow into being an expert in them seems to be largely gone.


That was already and always the function and value of a university... Notice the academics aren't sitting in lectures 6 hours a day or trying to pass exams to obtain degrees. They're the longterm users of universities and educating themselves their entire lives.


> You don't need a university education to do those things, just some curiosity.

The same is true of any field. Medicine for example. Then again I have several acres of swamp behind my place to help me when lerning from my mistakes.


It does remind me of a project [1] Andrej Karpathy did, writing a neural network and training code in ~600 lines (although networks have easier logic to code than a compiler).

[1] https://github.com/karpathy/nanoGPT


This is an implementation of GPT using the pytorch library. It is not meant to be the shortest implementation of a trainable GPT, however it is very clean code. Pytorch does a lot of the heavy lifting, especially when it comes to training on multiple GPU. This implementation only works with data distributed parallel training, so one could not train models of the size of GPT-4 with it out of the box.


Perhaps they were thinking of https://github.com/karpathy/micrograd


> But, writing a C compiler in 500 of comprehensible code (even in python) is challenge in itself that may take months after a few years of solid learning.

The people behind this project avoided that caveat by simply not implementing C. Apparently they kept a bit of the syntax but then proceeded to cherry-pick features that suited them and not make.an effort to even try to comply with any version of the standard.


It’s a little bit bigger than Small C https://en.m.wikipedia.org/wiki/Small-C


As an experienced developer who did not do a compilers course at university I was able to write a SQL/JSONPath evaluator in TypeScript in a week or so. I don’t expect a minimal C compiler would be that much more complex.

Essentially all you need is a grammar, parser library and a couple of tree walkers to convert the AST first to expand macros and then convert to assembly.

A production compiler with all its optimisation steps is of course far more complex and more modern languages have many more features, but C is really pretty simple (the K&R book is concise and good!) as it was built to work on the computers of half a century ago.


You don't need a parser library; writing the tokenizer + parsing logic isn't a very time consuming endeavor and the code doesn't suffer from it either. The upside is also that you're not taking on some monstrosity of a library for something you can implement in a tenth of the lines yourself. You'll also end up with something you actually fully understand yourself as well, which should be a big plus.


While I suspect I would learn more writing a tokenizer and parsing logic myself I find grammars much easier to read and maintain.

ANTLR is pretty good and is supported across several languages and something I had previously used for some quick Elasticsearch query syntax munging in Python. It also means you can often start from an already existing grammar.

The JS version of ANTLR didn't seem to work for me so for the SQL/JSONPath stuff ended up using the Moo lever and Nearly parser which was rather pleasant. https://nearley.js.org


Using a library is cheating. Any one with enough knowledge can create their own programming language in two weekends using parser combinators.


You might like the book 500 Lines or Less, Experienced Programmers solve interesting problems

https://www.amazon.com/500-Lines-Less-Amy-Brown/dp/132987127...




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: