[HN Gopher] Ask HN: Books that teach programming by building a s...
___________________________________________________________________
Ask HN: Books that teach programming by building a series of small
projects?
It is common knowledge that when first learning programming, one
should start with small projects to build something real rather
than learning rules and syntax of the language only. Which are
some of the best books that take a project based approach in
teaching programming to a beginner?
Author : newsoul
Score : 378 points
Date : 2023-01-17 13:24 UTC (9 hours ago)
| fellowniusmonk wrote:
| It's not quite the same as what you are looking for, but I've
| known multiple people who were stuck in their attemp to learn to
| code before using railstutorial, I view it and the book "sql:
| visual quickstart guide" as two very well designed intros that
| manage to avoid having sections with random jumps in difficulty
| and terminology usage that can leave true beginners behind.
| rahuldan wrote:
| There is this excellent Github repo for this:
| https://github.com/codecrafters-io/build-your-own-x
|
| It has a collection of blogs for building various small projects
| to learn different languages.
| asicsp wrote:
| Similar resources:
|
| * Projectbook https://projectbook.code.brettchalupa.com/
|
| * Project Based Learning https://github.com/practical-
| tutorials/project-based-learnin...
| icco wrote:
| Pretty much all of the books at newline do this:
| https://www.newline.co/
| jcon321 wrote:
| No joke, "C for Dummies" - it's more teaching you CS101 concepts,
| less about "C". Tons of examples to go through and the attitude
| of the author is very helpful compared to a lot of other styles
| out there.
|
| I was failing my computer science classes first semester. Towards
| the end of the semester I sat down in the library for a few days
| and just went page by page typing every example and compiling it.
| Aced every IT class I had the next few years. I attribute that
| book to making everything "click" for me.
|
| Once you understand the beginner concepts that book shows, then
| you as an individual would know where to look to gain
| improvement.
| saperyton wrote:
| The Advanced Beginner blog post series by Robert Heaton is great.
| asicsp wrote:
| Link: https://robertheaton.com/2018/12/08/programming-projects-
| for...
| devd00d wrote:
| Not quite programming but certainly covers the "small projects"
| part. This is what taught me the basics of Unreal Engine:
| https://www.youtube.com/watch?v=k-zMkzmduqI
| culopatin wrote:
| My biggest gripe with all the project tutorials I've seen is that
| really quickly you get into a "ok I get what we're doing" and
| then just copy the code they provide. At the end of the day you
| did zero mental workout because you didn't have to figure out the
| code. I hope to find one of these that guides you but doesn't
| give you the code immediately, but has a code answer key at the
| end or something. I get it that it's not easy to do, but there
| must be one out there that doesn't spoon-feed you everything.
| thr0wnawaytod4y wrote:
| For this reason you need to find _your own_ projects, solve
| your own problems (which are actually pretty common, but you
| have to search or figure out a solution)
|
| That's what I tell everyone
| travisjungroth wrote:
| The issue I've found with that in my students is they then
| have to play the role of product manager in addition to
| software engineer. Those choices add a lot of mental
| overhead. There's a balance between motivation and pressure
| for most students.
|
| I think cloning is more the way to go. Pick some existing
| project/product and copy the essential components. Less
| choices, doesn't have to end up getting used.
| dielll wrote:
| Datacamp does what you want
| intelVISA wrote:
| Thinking of building something along those lines i.e. you can
| peek ahead if you really get stuck.
|
| Proj-based learning is really fun to both create and consume
| imo.
| culopatin wrote:
| If it helps you in any way, what I try to do is to use a
| tutorial book to build my own app. For example a Flask
| tutorial that shows how to build a blog app, but I'm building
| a library. I still learn about the Flask way and I learn some
| building blocks but I have to figure out the equivalent for
| what I want to do. I often get stuck though.
|
| So maybe showing the building blocks and letting you use them
| for something. You could perhaps show 2 or 3 suggested
| projects that are built with the building blocks. You show
| the generic version of the blocks, and then you figure out
| how to tweak them to make one of the 2 or 3 suggested
| projects.
|
| Sort of buying the legos and then showing what you could do
| with them. But building it is up to you.
| intelVISA wrote:
| Good idea, originally I would just build something that
| already exists from scratch e.g. a UNIX-like OS complete
| with 99 footguns.
|
| Now I've learned better I try to channel my learning
| energies into extending my portable, reusable library that
| solves common problems I can iterate, improve and port into
| future projects.
| ojl wrote:
| That's why I like The Ray Tracer Challenge. He gives you test
| scenarios and a little bit of pseudo code (sometimes). The
| actual implementation has to be done by the reader.
|
| http://raytracerchallenge.com/
| aeontech wrote:
| That's really cool, probably deserves its own submission for
| discussion!
| the_gastropod wrote:
| +1 This is one of my favorite programming books. It's a very
| rewarding-feeling experience to build something so capable so
| quickly.
| cardanome wrote:
| One thing that helps me a lot when learning new languages is to
| NOT copy and paste but actually re-type the code.
|
| You will be forced to read more carefully and, more
| importantly, you will make typing mistakes. Hunting down your
| own mistake will teach you the subtleties of the syntax as well
| as further increase your understanding of the code.
|
| For more advanced programmers, there is also the challenge of
| translating the code into another language entirely, which
| requires a actual semantic understanding of the code.
|
| Also once the project is done, adding small additional bonus
| features will further deepen your understanding.
| culopatin wrote:
| I re type it but I don't necessarily learn how to come up
| with that code when I'm off the leash. It's useful when
| learning new syntax for sure though.
| grugagag wrote:
| It's a stepping stone. Doing that will make you a little
| bit less uncomforable when you get out of your depth, that
| until you hit another stepping stone and feel even more
| comforable.
| gre wrote:
| You can try to retype it from memory too. Or write down a
| list of the crux functions (like a word bank) and then
| figure it out again.
| mgomez wrote:
| To force myself "to figure out the code," I typically do the
| tutorial in a different language. I wanted to get familiar with
| Java last year, but all the books/tutorials were boring to me.
| What I ended up doing was going through a book that showed how
| to write a backend in Go (which was also unfamiliar to me at
| the time) while simultaneously porting it to Java (using
| Vert.x). Probably sounds inefficient tackling two languages at
| once, but it was the only way I was able to stay engaged with
| the material. Of course I ended up with something unidiomatic
| in terms of Java, but the project works and I now have
| motivation for a proper refactor to keep the momentum going.
| usmannk wrote:
| I was looking for golang in this thread and this is the only
| reference I found. Would you mind linking the Go book you
| reference? Thanks
| mgomez wrote:
| Sure thing:
|
| https://lets-go-further.alexedwards.net
|
| That book is a follow-up to an easier book [1] that I also
| bought, but ended up skipping since I was only interested
| in writing JSON APIs.
|
| [1] https://lets-go.alexedwards.net
| dgb23 wrote:
| I have done the same thing! Read Crafting Interpreters but
| wrote the first half in Clojure instead of Java.
|
| I think it's a good method for experienced programmers, who
| are self-taught (like me) or just want to brush up some
| skills and knowledge.
|
| Yes, you stay engaged, but there is also something to be said
| about porting code between different languages. The
| differences, strengths, weaknesses etc. stand out more,
| similarities become more clear and things that seem
| different, but are analogous emerge.
| maCDzP wrote:
| I like "The Elements of Computing Systems: Building a Modern
| Computer from First Principles".
|
| You build a whole computer from scratch through small projects.
|
| Sure, you want learn a specific language, but you'll grock
| programming in general.
| jtmiclat wrote:
| I found Al Sweigart's books nice for beginners.
|
| Highlights https://automatetheboringstuff.com
| https://inventwithpython.com/bigbookpython
| kennyfrc wrote:
| There's quite a few:
|
| - Zed Shaw's Learn More Python the Hard Way[1]
|
| - Brian Hogan's Exercises for Programmers (best for beginners or
| for learning a new language)[2]
|
| - Hal Fulton's The Ruby Way[3]
|
| - Chris Ferdinandi's Vanilla JS Academy[4]
|
| - Marc-Andre Cournoyer's Great Code Club (it's old, and the
| community doesn't exist anymore, but i think he still maintains
| it)[5]
|
| - A few python books from No Starch Press (notably those authored
| by Al Sweigart)
|
| I learned the most as a beginner from Zed Shaw's work, and from
| reading open source code.
|
| Once you're done with the initial "learn from tutorials" phase,
| there's no better resource than reading open source code.
|
| [1] https://www.amazon.com/Learn-More-Python-Hard-
| Way/dp/0134123...
|
| [2] https://www.amazon.com/Exercises-Programmers-Challenges-
| Deve...
|
| [3] https://www.amazon.com/Ruby-Way-Programming-Addison-
| Wesley-P...
|
| [4] https://vanillajsacademy.com/
|
| [5] https://www.greatcodeclub.com/
| 7speter wrote:
| > and from reading open source code.
|
| Do you just search for projects in the language your using on
| github?
| kennyfrc wrote:
| Yes, and I would typically search for simple projects using
| keywords such as "micro", "small", "tiny", or "pico".
|
| I would then try to re-implement the "getting started" code
| in the readme from scratch, like a little programming puzzle.
| If I can't figure it out, I'll add in some debugger
| breakpoints, inspect the stack trace to understand how it
| works, then code the needed methods / classes as I go.
|
| If you're a ruby programmer, soveran's work in github can be
| read in a day or two. I specifically like cuba (micro
| webframework) and mote (microtemplate).
| darreninthenet wrote:
| Is Shaw's first Python book any good?
| cameron_b wrote:
| I found his _Learn Python3 The Hard Way_ to be a great series
| of exercises if you 're starting out or starting again. You
| won't find -everything- on any topic, but the exercises are
| complete enough to get you rolling and seed the sort of
| patterns that will make you successful in looking for more
| material.
|
| I had a little bit of Python(2) under my belt from general
| curiosity, and I've done some C++ in high school so I have
| some "CS Theory"
|
| There is a "more" python version out now
| https://learncodethehardway.org/more-python-book/
|
| Amazon ( the "newer" version proposed is not, it's his
| python2 book ) https://www.amazon.com/Learn-More-Python-Hard-
| Way/dp/0134123...
| danpalmer wrote:
| Shaw has had some strong opinions that have gone
| significantly against the mainstream viewpoint in Python.
| Whether he's right or not doesn't really matter - as an
| educator that is targeting the mainstream it's fairly
| important to stay on that and not introduce personal bias
| around these things. Unfortunately his criticism was often
| not very constructive.
| cameron_b wrote:
| despite my other comment here I do agree with you on this,
| especially remembering his comments on test tools, nose for
| example
| danpalmer wrote:
| Yeah, he pushed back hard against the Python 3 migration,
| by picking on a small number of trade-offs that he
| personally didn't like and using that to conclude that
| the entire endeavour was doomed. The Python 3 migration
| wasn't flawless by any means, but it was better than he
| made out.
|
| I know his "criticism" also held back many from moving
| their libraries to Python 3 by sowing doubt in the
| community, and ultimately may have slowed down adoption
| overall.
| kennyfrc wrote:
| If you're a pure beginner with zero programming experience,
| yes. If you've programmed a few scripts and have done a flask
| web app, his first book might be too easy.
| mayankkaizen wrote:
| If you ignore his strong opinions, it can be good. Although
| he was (is?) very much hated back in the day (when Python 2
| was still mainstream), many many noobs did benefitted from
| his book. So I'd say give it a try.
| Zhyl wrote:
| Specifically "Automate the Boring Stuff with Python" is my
| favourite Al Sweigart book.
| downrightmike wrote:
| Best explanation of Regex that I have ever seen
| michaelcampbell wrote:
| I'm not much of a Python guy, but concur with this; I enjoyed
| this book and did get something out of it.
| lazyant wrote:
| > - A few python books from No Starch Press (notably those
| authored by Al Sweigart)
|
| Yes for example https://nostarch.com/inventwithpython and
| https://nostarch.com/big-book-small-python-projects
| jypepin wrote:
| I learnt ruby with Zed Shaw's Learn Ruby the Hard Way. Was a
| really great experience!
| LastTrain wrote:
| When I was young, I went about it the opposite way. I thought of
| some small project and researched how to implement it, then moved
| on to something bigger. Everybody is different of course, but I
| felt like I learned more having to figure out how to go about
| implementing each myself.
| poszlem wrote:
| I can recommend "Programming: Principles and Practice Using C++",
| although the fact that it uses C++ as a first language can be a
| downside to some.
| rwieruch wrote:
| Shameless plug if allowed: "The Road to React" goes through one
| large project to teach React.js from beginner to intermediate. I
| learned that going through one project it allows the teacher to
| go through a series of foundational aspects of the topic before
| implementing more advanced domain specific features which make
| use of the earlier learned building blocks for the real world
| project. Does it make sense?
|
| https://www.amazon.com/Road-learn-React-pragmatic-React-js/d...
| throwawaybnb123 wrote:
| Codecademy has projects page: https://www.codecademy.com/projects
| Taylor_OD wrote:
| Most udemy/MOOC courses are structured this way. I tend to just
| look for the highest rated ones on whatever language I'm
| interested in and make sure it says build projects or something
| similar.
| bartvk wrote:
| Learn Swift in 100 days. It start with the basics using Swift
| Playgrounds. But as soon as possible, it starts with building
| apps.
|
| https://www.hackingwithswift.com/100
| _jcrossley wrote:
| Came to say the same thing - plus, there's a great 100 Days of
| SwiftUI as well, which gets nontrivial apps running pretty
| quickly.
| CraigJPerry wrote:
| HTDPv2 https://htdp.org/ - it's about learning to program rather
| than teaching a specific language.
|
| I thought the little projects you build along the way struck a
| good balance of interest, e.g. you're building a snake game by
| section 2 (but crucially you've already been exposed to how to
| think about data so you're not just dropped into the deep end
| with some boilerplate to fiddle with).
|
| Anyway, i could write tons of praise for this book but it's
| convinced me to ditch python for teaching newbies and i LOVED
| python for getting newbies started real quick with projects for
| years.
| newsoul wrote:
| I wouldn't mind if you write some more about the book.
| agumonkey wrote:
| Interesting, I rarely see it mentioned. How do people react to
| the mindset it teaches ? I really like that it's near language-
| less programming book, really more about and/or :)
| dns_snek wrote:
| That sound like an interesting approach and I'd love to hear
| more about it!
|
| One striking difference compared to most "beginner languages"
| is the Lisp-like syntax. I think focusing on problem solving
| rather than learning syntax is a great goal, but does this
| particular choice of a language make it harder for your
| "students" to continue learning in another language?
|
| I'm assuming they would switch to a more popular language at
| some point (with syntax that resembles C), so I'm curious what
| that transition is like for beginners.
| rcardo11 wrote:
| This is the best programming book I have ever picked
| https://www.amazon.com/-/es/Noam-Nisan/dp/0262539802/ref=sr_...
| werber wrote:
| https://eloquentjavascript.net/ is nice and project based, it
| builds up from 0
| phowat wrote:
| http://landoflisp.com/
|
| Was a really fun read.
| rg111 wrote:
| A similar great book is Realm of Racket.
| kriro wrote:
| "Hands on Rust" teaches Rust by building a rogue like game step
| by step. Before that there's a chapter where you rebuild Flappy
| Bird from scratch that teaches the "basics" before diving into
| more advanced concepts in the rogue like. I liked the approach
| and recommend the book but it's fast paced and expects quite a
| bit from the reader (it's excellent if you have some programming
| experience already but probably daunting as a true first book
| imo).
| myers wrote:
| I second this one. This was a great book.
|
| There are some follow ups to the final project I like
|
| Compile to WASM so you can run on the web: <https://hands-on-
| rust.com/2021/11/06/run-your-rust-games-in-...>
|
| Port to the Bevy ECS: <https://saveriomiroddi.github.io/learn_b
| evy_ecs_by_ripping_o...>
| kriro wrote:
| Oh cool I wasn't aware of these. Thanks for sharing, both
| look very interesting. I like the idea of reusing projects to
| teach different tech :)
| hgsgm wrote:
| checkio.com for increasing challenges in Python or JS.
|
| But also pretty much every book does that.
| rg111 wrote:
| I recently finished the book that teaches programming by
| developing games using DragonRubyGameToolkit. Really loved this
| book.
|
| _____
|
| _Python Crash Course_ by Eric Matthes has a section dedicated to
| projects.
|
| I really liked this book.
|
| This is what taught me Python.
|
| I knew C before.
| dartharva wrote:
| I don't know why jtimiclat's comment recommending Al Sweigart's
| books got downvoted and faded out, they are indeed quite good for
| beginners wanting to get their hands dirty with programming
| instead of cramming it in an academic way.
|
| Not to mention they're all freely available and give excellent
| value for both time and money: https://inventwithpython.com/
| olkyts wrote:
| Learning Rust, I use these 2: 1. Command-Line Rust: A Project-
| Based Primer for Writing Rust CLIs 2. Zero To Production In Rust
| (it's actually one project)
| kgwxd wrote:
| Programming Games for Atari 2600
| https://forums.atariage.com/topic/339819-upcoming-book-on-at...
| ojl wrote:
| I mentioned The Ray Tracer Challenge in a comment below, and it
| seems quite popular so I'll submit it here as well.
|
| http://raytracerchallenge.com/
|
| It's not really for beginners though, but maybe possible to start
| it together with a beginners book in a language of choice. It
| starts with points, vectors and matrixes, but gets more advanced
| later on. It's around 250 pages and there's basically no code
| provided, just test scenarios and a bit of pseudo code.
| friend_and_foe wrote:
| Write yourself a scheme in 48 hours by Johnothan Tang is a
| fantastic book, there's also the structure and interpretation of
| computer programs.
|
| https://upload.wikimedia.org/wikipedia/commons/a/aa/Write_Yo...
|
| https://web.mit.edu/6.001/6.037/sicp.pdf
| ajoseps wrote:
| This book is still in progress but I've gone through some of the
| chapters and have enjoyed it. Rust from the Ground Up:
| https://leanpub.com/rust-from-the-ground-up
|
| I was looking for a book that had offline projects I can work on
| while on flights, and this book focuses on rebuilding linux
| utilities using rust. The other nice part is that you get a
| better understanding of linux internals.
|
| I believe the author is also responsive on the rust subreddit.
| mprovost wrote:
| Thanks for the kind words! I'm desperately polishing the next
| chapter for publication...
| ajoseps wrote:
| great to see you on HN as well! I haven't revisited the book
| in a while but I really liked the chapters I did work on. I
| have another flight coming up soon so maybe I'll try another
| chapter :)
| unrequited wrote:
| https://shop.jcoglan.com/building-git/
|
| This is an excellent resource.
| cratermoon wrote:
| _Practical Common Lisp_ by Peter Seibel
| modernerd wrote:
| For Swift:
|
| https://www.apple.com/swift/playgrounds/ (I've had more success
| introducing programming with this than with any of the links
| below; it's a very compelling intro for those who already own an
| iPad/Mac, and the core concepts are generalisable to other
| languages/environments even if it's specific to Apple's APIs and
| hardware.)
|
| ~~~
|
| For Python:
|
| https://automatetheboringstuff.com
|
| https://nostarch.com/big-book-small-python-projects
|
| ~~~
|
| For JS:
|
| https://eloquentjavascript.net (project-based and for beginners)
|
| https://javascript30.com (not for total beginners or self-study,
| would need a friend/tutor)
| bpesquet wrote:
| I beg to differ: for all its qualities, Eloquent JavaScript is
| not a very beginner-friendly book. It goes quite deep into many
| JS intricaties and contains a lot of challenging tasks for
| people just discovering programming.
|
| More beginner-focused alternatives are
| https://www.freecodecamp.org and https://thejsway.net.
|
| Disclaimer: I've been teaching programming professionally for
| 15+ years and wrote the latter.
| Sn0wCoder wrote:
| I have recommended to beginners before and most of them
| thanked me. I skimmed the page for your book but did not see
| the link to the free version. I am on mobile so maybe just
| missed it. Says read free here, but here is not a link.
| Clicking the book takes you to Amazon.
| Sn0wCoder wrote:
| Never-mind the website is the book lol
| Sn0wCoder wrote:
| I second eloquent JavaScript. Been doing this book since v1 and
| recommend to just about anyone that asks for recommendations. I
| use typescript daily and have been hoping that this book gets
| updated for TS although it would be hard since it uses lots of
| JS tricks that may or may not be best practices in TS.
| Technically just renaming the files from .js to .TS would work
| the linter would go crazy
| twawaaay wrote:
| My favourite is "Practical Common Lisp" by Peter Seibel
| (https://gigamonkeys.com/book/)
|
| Not only is the book free to read (although I would suggest to
| pay for it if you like it!) The code to parse binary files
| actually "inspired" my design of an actual production application
| which was very flexible, succinct and, most importantly, so fast
| I had to spend a lot of effort convincing people the numbers are
| actually true.
|
| It taught me some important lessons about how you can achieve
| performance with Lisp languages and the real reasons for the
| power of macros. Not too shabby for the first book on Lisp I red!
| peterhil wrote:
| I was going to suggest this. It's cool that you build a file
| based database (IIRC) and query language in the third chapter!
| twawaaay wrote:
| Also with so little actual code. This cemented my interest
| for Common Lisp at the time I was reading it.
| halkony wrote:
| I've been learning lisp this past week. I think I get the main
| idea of "code is data and data is code", but I struggle to
| understand how it's more powerful than, say, making a function
| factory in Python.
| agumonkey wrote:
| maybe a function factory is just an OO pattern for return
| closures, it's difficult to not perceive things from 'now',
| but i'll be frank i 1) never liked DP 2) couldn't spend more
| than 5 minutes reading about them as it seemed more verbose
| and redundant
| cess11 wrote:
| Not sure what you mean by "function factory", could you
| elaborate? Isn't it metaclasses and decorators that are used
| for metaprogramming in Python?
|
| In my opinion the 'everything is an expression' is the really
| tasty part of the lisps, which goes well with quoting.
| halkony wrote:
| My naive interpretation of `defmacro` is passing data into
| a function to return another function. From my python POV
| that would be the same as returning a callable from a
| function (decorators being one example).
|
| I think top comment does a good job explaining that while
| I'd get the same functional result, Python objects have
| tons of abstraction behind them that make them harder to
| work with than lisp combinations.
| kfoley wrote:
| I used to have the same issue understanding the benefit. One
| simple example that helped it clicked for me was considering
| the `when` or `unless` macro.
|
| They're just very simple macros based around the `if` special
| form. Because they're macros, they can just treat the body as
| data, i.e. it's not executed as part of argument resolution.
|
| If you wanted to make a `when` function in Python, the "body"
| would have to be a callable like a lambda or named function.
|
| I know this probably isn't the most compelling use case but I
| found it to be a really simple way to understand some of the
| benefits of macros and how they could be used elsewhere.
| halkony wrote:
| So let's say i have a lisp macro along the lines of
|
| (analyze 1 2 expensiveComputation)
|
| In python, to prevent evaluating all arguments when running
| analyze, I'd have to pass expensiveComputation as a
| callable or a function partial and remember to call it if I
| need it.
|
| Whereas in lisp, I can pass whatever expensive variable I
| want into the macro because it will only get evaluated when
| using (expensiveComputation ...) and that's baked into the
| language.
| twawaaay wrote:
| There is a number of reasons that make Lisp macros so much
| more powerful than functions in any other language.
|
| Consider you want to implement printf that is compatible with
| C printf.
|
| As the function implementor, you want something like
| printf("%d", 5+2, anExpensiveFunctionThatProducesAString())
| do the right thing and print "7" on the terminal, but you get
| many more options and mechanisms you can use when
| implementing it in Lisp vs other languages.
|
| Every other language:
|
| * every time printf is called, all of the arguments have
| already been evaluated. There is no way to avoid calling the
| expensive function when the format indicates the result is
| not needed.
|
| * every time the function runs you have to parse the format
| string. You could try and be smart and cache parsing results
| but this will quickly make it very expensive and complex and
| might cause problems when format strings are generated
| dynamically.
|
| * your function cannot make use of the fact that both the
| format string and the argument never change
|
| Lisp macro:
|
| * you can decide to only evaluate arguments when they are
| needed,
|
| * you can notice that the format string is static and output
| code _IN PLACE_ of the macro based on this information. This
| means you have the option to make parsing happen only at
| compile time if it is possible.
|
| * you can analyse the arguments further and decide to output
| code that does princ('7') _IN PLACE_ of the macro. The
| resulting code will have no operations to parse or analyse
| anything and will always execute quickly and efficiently.
|
| In general this is the way I think about Lisp macros vs
| functions in other languages:
|
| "Lisp macros allow you to run logic at compile time that can
| _create_ code dynamically that does exactly what you need it
| to do, no more, no less, based on macro arguments and /or
| unevaluated macro arguments and/or the environment."
|
| Lisp macros are ultimate in building abstractions. Where in
| other languages you have to contend with the language always
| "sticking out" of your abstractions -- there is only so much
| you can do to hide the underlying language, in Common Lisp
| you can always hide the language completely. Implementing
| your abstraction is taking a data structure (can be for
| example an XML file) and running an arbitrary logic to
| generate another data structure (a function) that is then
| outputted in place of the macro. If the XML describes your
| binary file structure, the macro can take those descriptions
| and generate _perfect_ parsing code that does exactly what is
| needed without any extra stack frames, conditionals, syntax
| artifacts, etc.
| majormunky wrote:
| I'm also learning lisp, mainly as a part of learning emacs,
| so I may not be super accurate here. In python, when you have
| a reference to a function, its a bit opaque, you can tell the
| thing is a function, but I don't think you can really go into
| the function object, and alter it lets say. You may be able
| to using the AST or something, but its not a "first-class"
| thing you can do.
|
| In lisp (and code is data, data is code), the function is
| also a list, so you would be able to use all the normal
| programming tools to iterate over the list, add new items to
| the list, etc, which can change how the function runs.
| altruios wrote:
| Such a concept could use an example to solidify that point.
|
| If I have a function Foo that adds two numbers together.
| How is that represented in lisp (as a list you say?)? How
| would one alter that function/lisp-list: to multiply
| numbers instead?
| majormunky wrote:
| I've not really encountered any situations where I've
| needed to do anything like this yet (still learning),
| but, I found this example, where there's an existing
| function, and someone alters the body of the function to
| create a new function. My guess is that there's various
| ways of doing this type of stuff:
| https://stackoverflow.com/a/1220198
|
| Edit: a macro example, which I think may be the more
| common route of doing this type of stuff? https://lisp-
| journey.gitlab.io/blog/common-lisp-macros-by-ex...
| autodev1 wrote:
| - Pick a language
|
| - Find a recent book (< 2 yrs old) on LibGen.is
|
| - OR, a Udemy.com video series (note: never pay more than $12 or
| so-- the promo rate. If you see a higher price, just create a new
| email & user account (or reset cookies?) and you'll see the promo
| price again)
|
| - Visit: Roadmap.sh to get a sense of a learning roadmap what
| knowledge to build.
|
| - Use a search engine to answer questions, such as "free learning
| resource for learning <XYZ thing>"
| nemoniac wrote:
| Nand2tetris https://www.nand2tetris.org/
| numbsafari wrote:
| "Programming BASIC Adventure Games for the TRS-80"
|
| "Assembly Language, Step by Step"
|
| Check those out.
| ThomPete wrote:
| ChatGPT is probably much better at doing that for you. You can
| start with anything you want and explore as deep as you want.
| ilyt wrote:
| It's common approach because building something that _you want_
| is good motivation.
|
| I don't think that works as well when it is some random project
| from the book. Like, sure, better than dry code, but I'm far more
| motivated to learn when I also make something for me.
| Icathian wrote:
| The challenge I, and I think many others, run into with this is
| that there's almost never anything I "want". I spend so much
| time racking my brain for what to build I never start.
|
| Having a nice curated problem put in front of me sets me off
| and it's easy from there.
| dgb23 wrote:
| I agree in regards to complete beginners.
|
| But I think for more intermediate or advanced programmers it
| is very beneficial to go about a project in a more self-
| driven, free form way. Software design, exploration,
| research, reading specs and so on are half of the work (or
| more) in programming.
|
| What I would have loved to realize when I was younger is that
| there's nothing you can't write. It might be a drastically
| simplified version compared of the real thing, but you can
| absolutely do it.
|
| An operating system, a browser, a web server ("from scratch")
| a programming language, a video game (with a custom
| engine)... It's all possible with enough effort. And even if
| you don't want to do the up-front work yourself, it is easier
| to find cool, guided projects out there if you already know
| what you want.
| anurags wrote:
| https://github.com/practical-tutorials/project-based-learnin...
| ggrothendieck wrote:
| Per Brinch Handsen, Programming a Personal Computer. Book is
| online. Interpreter, editor and OS in about 10 KLOC.
| http://pascal.hansotten.com/per-brinch-hansen/ Also
| https://news.ycombinator.com/item?id=24913959
| elias94 wrote:
| I would suggest Practical Common Lisp
|
| https://gigamonkeys.com/book/
|
| You will create a MP3 database, a web server, a spam filter, a
| HTML generator. Really practical!
| dan-g wrote:
| https://beautifulracket.com/ by Matthew Butterick - "An
| Introduction to Language-Oriented Programming Using Racket"
| gen_greyface wrote:
| check this
|
| https://news.ycombinator.com/item?id=22299180 _Ask HN: What are
| some books where the reader learns by building projects?_
| Plasmoid wrote:
| Actually, Advent of Code is pretty good. The problems are
| challenging but you have a defined end condition and lots of help
| out on the internet.
| weird_user wrote:
| For beginners, Daniel Holden's Build Your Own Lisp[1] is
| excellent material for learning C. It's a very succinct book.
|
| For intermediate programmers, Build Your Own Redis[2] is a WIP
| book I am currently writing.
|
| [1] https://buildyourownlisp.com/
|
| [2] https://build-your-own.org/
| tejohnso wrote:
| Build your own redis sounds like a good idea, but I found the
| title confusing as C and C++ are different languages and you're
| using the old "C/C++" phrasing. I immediately wondered, "well,
| which is it?"
|
| So I dug into it a bit, and from the introduction I see it's
| "mostly C with some C++ features". But if you're going to
| require C++ features/libraries and a C++ compiler, then it's
| not C. So why not just say it's C++? I guess another way to ask
| is: what makes it "mostly C"? Is it a market capture decision?
| Is there some interesting language tradeoff involved?
| robaye wrote:
| C Programming: A Modern Approach by K. N. King. I've never seen
| another book that contains as many exercises and projects as
| Kings book does.
| evandale wrote:
| How to Design Programs: https://htdp.org/2022-8-7/Book/index.html
|
| It's lots of small problems that seem like projects and I've
| found it fun to expand on the examples on your own beyond what
| the book asks.
| ljf wrote:
| The 'Arduino Projects Book' does a brilliant job if taking
| someone who knowing nothing about coding or electronics and
| setting out lessons and projects that take you from zero to
| somewhere fun.
|
| I still can't really code, but I can have a lot of fun tinkering
| because of that book.
| mesozoic wrote:
| I'd like the equivalent for electronics if anyone has any
| suggestions.
| forrestbrazeal wrote:
| My Cloud Resume Challenge project [0] and book [1] uses a set of
| small, stackable mini-projects to introduce beginners to many of
| the pragmatic skills used in cloud software engineering.
|
| [0] https://cloudresumechallenge.dev/docs/the-challenge/ [1]
| https://cloudresumechallenge.dev/book/
| feliixh wrote:
| Automate the boring stuff with Python
| FranklinMaillot wrote:
| Not a book but The Coding Train on Youtube is probably one of the
| best introduction to programming. It's fun to watch, Daniel
| Shiffman is a fantastic teacher and he doesn't take himself too
| seriously.
|
| But what sets this course apart from any other are the coding
| challenges. Following the thought process of a programmer in real
| time, watching him making mistakes and hunting for bugs is
| invaluable.
|
| He uses p5js, a javascript library for graphics. The lessons are
| geared towards generative art but cover a broad range of topics
| including machine learning.
|
| https://www.youtube.com/@TheCodingTrain
| nerpderp82 wrote:
| Coding Train is soooo good, it is like if Bob Ross had a baby
| with Donald Knuth.
| __warlord__ wrote:
| Not a book, but check [Build your own
| X](https://github.com/codecrafters-io/build-your-own-x), a
| compilation of well-written, step-by-step guides for re-creating
| our favorite technologies from scratch.
| inxode wrote:
| It was better when Daniel maintained it.
| intelVISA wrote:
| Can't believe he sold out..
| deckard1 wrote:
| Excellent resource. Never seen that before.
|
| In a similar vein, there is The Architecture of Open Source
| Applications which is great:
|
| https://aosabook.org/en/index.html
| azemetre wrote:
| While not for beginners, if you'd like to learn rust I recently
| finished "Command line Rust" [1].
|
| It was my first introduction to rust and the book was quite
| enjoyable. It starts off with teaching you the very basics of a
| command line (what it means to exit, true, or false, etc) and
| each chapter has you recreate a popular command line tool (like
| grep, cal, tail, wc) while introducing a new rust concept.
|
| The book also does TDD, test driven design, by first teaching you
| how to create these tests then in subsequent chapters having the
| tests prewritten for you.
|
| It's definitely worth a look, the author has a great writing
| style as well that isn't as monotonous as most programming books
| I've read.
|
| [1] https://www.oreilly.com/library/view/command-line-
| rust/97810...
| racl101 wrote:
| Glad we can buy the book standalone without getting a
| membership to O'Reilly.
| azemetre wrote:
| I may sound like a shill but I think paying for O'Reilly is
| worth it. You get access to many books and videos outside the
| O'Reilly publisher. Definitely worth it, I tend to read a
| tech book a month (maybe 2 if it's "light.")
|
| Many of the books being suggested in the other comments are
| available as well (will definitely start Hands-On Rust
| because it seems very cool, and Practical Common Lisp shortly
| afterwards).
|
| Out of all the "tutorial" offerings I only pay for three
| services:
|
| O'Reilly (four years so far)
|
| Educative.io (two years)
|
| Frontendmasters (eight years)
|
| Every year I test out other services (pluralsight,
| lynda/linkedin learning, egghead, etc) but outside of one or
| three core offerings they don't seem to be a good value for
| what I want.
| adolph wrote:
| Came here to mention just that book. It is excellent.
| lifewallet_dev wrote:
| Thank you! I needed this one, how fun, I did this when learning
| Haskell, now I can do it with Rust.
| dbalatero wrote:
| Just to clarify, when you say "not for beginners" do you mean
| beginners to Rust or programming in general?
|
| edit: Based on your "It was my first introduction to rust"
| comment I think maybe you meant programming beginners?
| azemetre wrote:
| Sorry, I meant that you need some programming experience. It
| will not teach the basics of if loops, making structs, etc;
| it's a good introduction to rust, prior programming
| experience required.
| tmtvl wrote:
| _Common Lisp: A Gentle Introduction to Symbolic Computation_
| (https://www.cs.cmu.edu/~dst/LispBook/) has you build a number of
| small applications, like a substitution decipher application, a
| plotting function, and more, which it calls "keyboard exercises".
| MarkusWandel wrote:
| "Software Tools" by Kernighan & Plauger, perhaps.
|
| The original was in Ratfor, which is a Fortran dialect. That
| being similar syntax but more limited than C is not a bad intro
| language.
| abecedarius wrote:
| There's a later edition _Software Tools in Pascal_ which had
| some improvements. (According to the preface iirc. I didn 't
| read that one since I found the earlier book first.)
| keepquestioning wrote:
| raytracing weekend
| basicallydan wrote:
| If they don't exist, this is a good idea for anybody looking for
| a project to write a programming book
| cameron_b wrote:
| There are many, but the field is still wide open. Anyone with a
| particular domain experience should find a market.
|
| There are lots of starting from scratch guides, and few focused
| guides.
|
| for subject in ["Finance", "Contact Management", "Service Desk
| Automation", "Web Apps from scratch", "Web Apps on someone
| else's API", "Baseball Metrics"]: for language in ["R", "Go",
| "Python3", "Rust", "Lisp"]: print(f"Examples for {subject} in
| {language} would make a good book.")
|
| edit: no idea how to smash indent-formatting into MD-for-HN
| Nzen wrote:
| Prefix each line with two spaces, per the formatdoc page [0]
|
| [0] https://news.ycombinator.com/formatdoc
| for subject in [ "Finance", "Contact
| Management", "Service Desk Automation", "Web
| Apps from scratch", "Web Apps on someone else's API",
| "Baseball Metrics" ] : for language in [ "R",
| "Go", "Python3", "Rust", "Lisp" ]
| : print(f"Examples for {subject} in {language} would make a
| good book.")
| cameron_b wrote:
| Thanks!
| samvher wrote:
| Software Foundations is a series of interactive books where you
| work through proofs in Coq, gradually increasing in complexity:
| https://softwarefoundations.cis.upenn.edu/
|
| This is a bit on the edge of the domain that you're asking about
| (not really for beginners, and proofs are perhaps a somewhat
| niche type of programming) but I learned a lot from this and many
| people don't seem to know it, so I think it belongs in the list.
| jonjacky wrote:
| The famous _Structure and Interpretation of Computer Programs_
| (SICP) does this, in the Scheme language. The whole book is
| online here, with the table of contents right at the front:
|
| https://web.mit.edu/6.001/6.037/sicp.pdf
| bosch_mind wrote:
| There's a JS edition too
| HellDunkel wrote:
| The Rust Programming Language by Steve Klabnik and Carol Nichols.
| I don't think it's a language for beginners though.
| RomanPushkin wrote:
| Shameless plug:
|
| FREE https://leanpub.com/rubyisforfun - Ruby Is For Fun, I made
| the book so you do a lot of exercise. There is around 80
| exercises in total.
|
| Rewritten as a course:
|
| https://www.educative.io/courses/handbook-ruby-developers
| tjpnz wrote:
| MUD Game Programming. Not sure how easy obtaining a copy would be
| in 2023 but it has two projects which I recall being a lot of
| fun. I never did build a successful MUD but did learn a fair
| amount about network programming.
|
| https://www.goodreads.com/en/book/show/927128.Mud_Game_Progr...
| Jemaclus wrote:
| I build MUDs whenever I learn a new language! Didn't know there
| was a BOOK for it! Wow. Very cool!
| WoodenChair wrote:
| For intermediate programmer, that's what we do in the Classic
| Computer Science Problems series (https://classicproblems.com).
| We combine learning programming with learning computer science
| problem solving techniques.
| patchorang wrote:
| Not a book and webdev focused, but I've been doing
| https://fullstackopen.com/en/ and it's been great.
|
| The chapters are structured so you are building 2 projects at
| once. One where you follow along with the chapter material with
| example code and explanations. And a second in the exercises.
|
| I really like it because it introduces the concepts in the
| context of a project, but you can't get stuck because the code is
| there too. Then you need to really apply it in the exercises on
| your own project, without the example code.
| eu wrote:
| http://tinypythonprojects.com/
| yasoob wrote:
| Hi! I would like to shamelessly plug my own book "Practical
| Python Projects". It follows project based approach. It is
| completely free to read online and has a paid EBook option if
| that is what you prefer.
|
| https://practicalpython.yasoob.me/
| boredemployee wrote:
| >> one should start with small projects to build something real
| rather than learning rules and syntax of the language only.
|
| Yes, but don't overlook the great learning that is gained, at the
| beginning of any learning, by studying from many different
| sources (aka good books). It seems that something magical happens
| when you do this: the confrontation of ideas from different
| sources can make you better absorb ideas and resolve any doubts
| that you didn't understand before.
| azhenley wrote:
| Check out my blog series, "Challenging projects every programmer
| should try". Who knows, maybe I will turn it into a book that
| shows how to implement each project :)
|
| https://austinhenley.com/blog/challengingprojects.html
| cinntaile wrote:
| I like your list. Maybe you could break the projects down into
| smaller subproblems (you sort of do that already) but I
| personally don't like seeing the implementation. It gives you a
| false sense of understanding imo.
| hlship wrote:
| Not quite a beginner book, but you should check out
| https://www.amazon.com/Mazes-Programmers-Twisty-Little-Passa....
| fedeb95 wrote:
| Parenthesis: keep in mind that while learning by doing might be a
| good way to begin, even if I wouldn't be so sure as wether one
| "should" or "could" start along such a path, at some point you'll
| be stuck without studying the "boring" stuff you've delayed. True
| programming is realising the boring stuff weren't so boring in
| the first place
| allie1 wrote:
| Manning.com also has LiveProjects which are good for Machine
| Learning projects
| tasuki wrote:
| I'm very much a fan of a project-based approach. However, I
| wouldn't recommend any book for that. I'd ask the apprentice what
| they'd like to achieve, and try to reduce scope as much as
| possible.
|
| There's a world of difference in motivation when building
| something _you want to exist_ , versus building a project because
| a book told you so.
| eatonphil wrote:
| Sort of like that, I've been slowly working on a rosetta code for
| implementations of small problems. Rosettacode.org allows you to
| use standard library functions so many (but not all) of their
| examples are useless when you actually want to see how to code
| something from hand in the language.
|
| So my rosetta code only allows you to implement the main part of
| the thing yourself. But it's not appropriate for beginners. It's
| more appropriate for teaching a new language to someone who is
| already an intermediate programmer.
|
| https://tinyprograms.org/
| hiAndrewQuinn wrote:
| God, I hope you just found Rosetta.code off limits. That's a
| fantastic name
| speakspokespok wrote:
| Thought the question was regarding specific books that teach
| programming via small projects it's worth mentioning a related
| topic here.
|
| A Common Sense Guide to Data Structures and Algorithms by Jay
| Wengrow * 2nd Edition * not only covers the theory really well
| but goes on to provide code examples in popular high level
| languages explaining when and how best to use them usefully. At
| the end of each section are prompts where you extend the lesson
| into a small project and each chapter builds on the last. The
| author has a github repo so you can compare your project solution
| to his. It made a rather dry topic extremely fun and
| approachable.
| volodarik_lemon wrote:
| All Swift by Sundell series are pretty good.
| theshrike79 wrote:
| If we're talking a complete beginner with maybe only "hello
| world" level skills I recommend the Lego BOOST set:
| https://www.lego.com/en-fi/product/boost-creative-toolbox-17...
|
| It teaches you step by step the basics of programming (loops,
| function calls etc) using a scratch-like programming language.
| oidar wrote:
| Any alternative to this? I think lego stopped making it.
| theshrike79 wrote:
| the Mindstorms Robot Inventor is a bit more advanced
| (Scratch-like vs Scratch Jr on the Boost) and twice as
| expensive: https://www.lego.com/en-us/product/robot-
| inventor-51515
| jtolds wrote:
| Python Programming for the Absolute Beginner
| (https://smile.amazon.com/Python-Programming-Absolute-Beginne...)
| has you make a game at the end of every chapter with the concepts
| you've learned so far. I've bought this book for a number of
| people, though perhaps Automate the Boring Stuff with Python:
| Practical Programming for Total Beginners
| (https://smile.amazon.com/gp/product/1593275994/) is better if
| you don't want to make games.
| tsm wrote:
| _Software Design by Example_ (https://www.routledge.com/Software-
| Design-by-Example-A-Tool-...)
|
| Available free online at https://third-bit.com/sdxjs/
| skizm wrote:
| While on the topic, how about any books or courses that teach
| building a 3D game engine from scratch? I'm language agnostic, so
| any language is fine.
| AlexeyBrin wrote:
| I think pikuma.com has a course about implementing a 3D
| rasterizer from scratch in C.
| atan2 wrote:
| The best!!!
| hurril wrote:
| This one is nothing short of brilliant:
|
| https://www.manning.com/books/haskell-in-depth
| saboot wrote:
| This was just released, I haven't picked it up yet but it's
| definitely on my wish list
|
| https://www.manning.com/books/tiny-c-projects
| velmu wrote:
| The Symfony Fast Track book takes this approach:
| https://symfony.com/doc/6.2/the-fast-track/en/index.html
| kdmitry wrote:
| I have done courses on udemy like this before for learning new
| languages and tech stacks. There are plenty of courses on there
| that you can usually get for $20 that will teach you by building
| a bunch of small apps or services that build up in complexity.
| larve wrote:
| Peter norvig's paradigms of artificial intelligence programming,
| despite its age, is a delight.
|
| https://norvig.github.io/paip-lisp/#/
| newsoul wrote:
| But is that suitable for a beginner?
| nesarkvechnep wrote:
| Yes, it is. It's not about machine learning, neural networks
| but the more approachable AI of the 80s.
| globalise83 wrote:
| Haven't tried his, but can GPT3 write code that results in
| 1980s style AI?
| larve wrote:
| It depends on what you mean by beginner, but I would say for
| someone who has been futzing with a couple of js boot camps
| or building some php websites, it's what takes you from
| hacking to software development. Completely new to
| programming, maybe, if someone has a background in maths or
| physics and has a sense of "rigor" in thinking.
|
| But, of all the books I worked through, this is the one I
| remember just having tons of fun because the examples are so
| cool and the code so... clear. I think norvigs programming
| course in python (which I only skimmed) could be a great
| modern equivalent.
| pixelmonkey wrote:
| Not a book, but CS50x is a freely available course with high
| quality videos and lecture notes. The lecture exercises are
| programming projects of sorts. It teaches programming from
| scratch with C and then Python. Plus, since a lot of students
| take it, there are lots of online resources with tips, like the
| CS50 subreddit.
|
| https://cs50.harvard.edu/x/2023/
| cehrlich wrote:
| CS50x and CS50web are fantastic. web is a bit outdated but it
| doesn't matter because the projects are so good.
| albertzeyer wrote:
| Same question, but not for beginners but for experienced
| programmers:
|
| Which book would you recommend to improve architectural design
| decisions, developing complex systems, etc? But on actual
| examples, e.g. by building a series of projects, or parts of it?
___________________________________________________________________
(page generated 2023-01-17 23:01 UTC)