7 ms·
Ask HN: What projects are perfect for learning a new language?
I get that the best way of learning is to try to build something but is there a list of projects that accentuate a language's purpose/paradigm in a way that building said project has the best time to learning ratio?
- bbcbasic 10y agoThe list will depend on the language, platform and your interests. Build something that interests you and challenges you a little but isn't too overwhelming.
- devnonymous 10y agoWhat parent says, but to add to it here is a list I stumbled across which you may use for inspiration: https://github.com/karan/Projects https://github.com/karan/Projects
- sfifs 10y agoA personal project that's been frustrating you and could be solved better in the new language/framework. This gives (a) motivation to do something in the new language (b) gratification from the new language/framework's new features (c) low risk since it's not work. Almost everything I have picked up by myself over past few years has been this way. Golang (frustration with concurrency in Python), JavaScript/React/Redux (frustration with "native" GUI frameworks), Android SDK (Speed, sensors pre-html5-webview), GraphViz (frustration with "project management") etc.
- girzel 10y agoI vote for a little webby something. Get the lowest-level web framework you can find for the language, and then make a hello world. You're bound to learn strings, functions, processes and types, at the very minimum, and a web-based something is also a very easy platform from which to expand incrementally into new territory.
- ssantic 10y agoI like Hogan's book "Exercises for Programmers". Also, some lists of ideas I've recently been looking at: https://docs.google.com/document/d/1TyqD2_oDtiQIh_Y55J5RfeA91JJECc97xYIKM112H9I/edit?pref=2&pli=1 https://docs.google.com/document/d/1TyqD2_oDtiQIh_Y55J5RfeA9... https://github.com/karan/Projects https://github.com/karan/Projects http://www.dreamincode.net/forums/topic/78802-martyr2s-mega-project-ideas-list/ http://www.dreamincode.net/forums/topic/78802-martyr2s-mega-...
- hacker42 10y agoI think that depends on the language. A couple of ideas: Copycat standard unix tools such as grep, ls, dd. Implement an economy simulator. Implement a simple neural network (you can find the formulas for backprop online). A tennis tournament planner. A Sudoku solver using SAT constraint propagation. Invent a simple layout language and implement an interpreter/renderer which renders text and images in a pdf file.
- iso-8859-1 10y agoWhat do you mean by economic simulator? Something like https://en.wikipedia.org/wiki/Minsky_(economic_simulator) https://en.wikipedia.org/wiki/Minsky_(economic_simulator) ?
- endgame 10y agoI would extend "standard unix tools" to (old) "standard unix services". I learned a lot from the final project in "Haskell Programming from First Principles", which was to implement a server for the finger protocol.
- jasim 10y agoA game of Snake, a simple database, a little web server, a small compiler.
- nowprovision 10y agoFor golang kubernetes is pretty good, i learnt a lot of tricks just reading code, but you quickly learn it was the wrong language on so many fronts.
- farresito 10y agoYou mean it was a mistake for kubernetes to be written in go? If so, I would love to hear a bit about it.
- nowprovision 10y agoI think so. The lack of parametric types leads to an explosion of types for each concept, and where they don't do this a load of casting from runtime.Object and interface{}. The lack of exhaustive pattern matching is responsible for many bugs, oh we forgot to add a case for runtime.InternalEvent etc... However our project will be using Kubenetes library and thus we're also doing it in Go. MetaAccessor another eye sore. It's all a trade-off I guess..
- nowprovision 10y agoFor go kubernetes is pretty good, but you quickly learn it was the wrong language.
- ValleyOfTheMtns 10y agoI have a friend who likes to write fractal generators when he starts looking at a new language because it gives him a sense of what it can do and how it does it in terms of loops/recursion, data structures, math, and visualisation.
- MarcosDione 10y agoAny project that you want to do right now and that you think the language can handle properly. The most important part is motivation, and a project-at-the-gates is one of the best drivers. This not only works for languages, but also frameworks and tools.
- lalwanivikas 10y agoI am not sure if this will be considered as self-promotion, but if you are trying to learn something related to web, feel free to borrow from my list of projects: http://vikaslalwani.com/projects/ http://vikaslalwani.com/projects/ All the source is available on GitHub and I am sure you will have lot of fun creating these :) Feel free to contact me if you need any help.
- huuu 10y agoI always start out with a simple raytracer / path tracer (spheres only). It's always nice to see visuals appear (in a file or on screen). It's like a compliment for the work done. And you will learn a lot of basic stuff like loops, scope, types, and so on.
- max_ 10y agoI recommend you to build a content management system for a desktop environment.
- feiss 10y agoFor a desktop environment? What do you mean by that?
- sanqui 10y agoAn IRC bot is always fun to write.
- vshan 10y agoDon't want to hijack this thread, however, it is mildly related: What projects are perfect for learning Erlang (which might involve both the functional and concurrent aspects of the language)?
- levi_n 10y agoIf you like math at all, www.projecteuler.net/problems is worth a look. They pose math related problems that are intended to be solved programmatically. Once you've solved a problem correctly you are given link to the problem's forum page, where others people have posted their solutions. Whats truly great is that you are forced to solve the problem on your own, and then you can see how others did it, both in your chosen language(assuming it's a somewhat common language), but also a myriad of other languages.
- k__ 10y agoFor getting into new web-dev frameworks/languages I often do these three steps: 1. hello world (simply getting something on the screen) 2. todo list (display a simple data-set and interact with it) 3. blog (display a relational data-set and interact with it, maybe some auth stuff) But I would like to know how these steps would look for embedded stuff.
- Cyph0n 10y agoIf you mean embedded systems, this is what I would do when working with a new microcontroller: 1. Make a LED blink - the Hello World of embedded. 2. Output a PWM signal from a pin to control a motor or to a speaker output. 3. Read an analog signal using the onboard ADC. A temperature or luminosity sensor is a good start. 4. Write a light OS that can execute multiple tasks simultaneously - take user input, read analog sensor values, perform a calculation, keep track of time, etc. This will need all of the above + interrupt handling.
- k__ 10y agoNice thanks :D I already imagined that the hello world of embedded is a blinking LED , haha. So these things (PWM, ADC) are "standard" to all embedded systems?
- raverbashing 10y ago> So these things (PWM, ADC) are "standard" to all embedded systems? Not really. PWM is more common (and "can" be done in SW or using other tricks if needed)
- Cyph0n 10y agoThe well-known microcontrollers do have both built-in - Arduino and MSP430 are two of the popular ones.
- iheartmemcache 10y agoI am of the firm belief that Arduino's are great to get those who aren't already motivated into learning EE/CE. Seeing a responsive blinking LED or whatnot is great to get people to the 'oh man, how does this work?! I want to learn more!!'. You're already at that phase. You presumably have a baseline of CS knowledge. Do it the 'right' way, and use a PIC or an AVR. (I don't care which, no holy wars, avr fans ;)) This[1] is a great place to start. I keep on meaning to write a 'hardware for CS guys' guide, that'll suffice for now. [1] http://umassamherstm5.org/tech-tutorials/pic32-tutorials/pic32mx220-tutorials http://umassamherstm5.org/tech-tutorials/pic32-tutorials/pic...
- baccheion 10y agoImplement the common search and sort algorithms, solve a few Project Euler challenges, and build a full-fledged todo-list or photo sharing application.
- deskamess 10y agoI will second the first part of this - algorithms and data structures. You have to hit the middle ground for those as the language may provide some. So try implementing binary search trees or splay trees and some graph algorithms. You should not pick too many - perhaps 2 from each genre. At some point you will put these behind you, use pre-written libraries and graduate to an application.
- kaffeinecoma 10y agoI like to build something that I've programmed before in another language. Maybe this seems redundant. But if you have the problem fresh in your mind, it leads to asking the kinds of (Googleable) questions that get you very quickly to a base-level understanding of the new language. It also sheds light on the areas where the language is better/worse at specific things than the lang you are used to working with.
- rprospero 10y agoI used to use this method, but I've started to back away from it, because I often find that it encourages my own Blub programmer nature. Re-implementing an old project immediately shows me the ways in which the new language is worse, but often obscures the benefits. As a personally embarrassing example, I once returned to Python after three years of heavy Scheme usage. I spent a week porting an almost trivial application and it felt like Python was fighting me every step of the way. Had I not had past pleasant practice with Python, I would have abandoned the language as useless. Finally, at the end of the week. I realised that I was trying to write Scheme in Python, which work about as well as writing Python in Scheme. Python has for loop and I should be using them. About twenty minutes later, the app was ported. It wasn't my finest hour.
- blacksmythe 10y agoI sometimes see the opposite. We took an app written and maintained for the last 10 years in language A, and re-wrote it from scratch in language B. The new codebase is smaller, more maintainable, and runs faster!!!
- GavinMcG 10y agoOne answer to that question, which I have bookmarked: http://blog.fogus.me/2009/05/29/pet-projects/ http://blog.fogus.me/2009/05/29/pet-projects/ · Lisp interpreter · Lexer generator · Knuth's Pac-Land · Linear Algebra library · Workflow engine · m-ary tree · Now Do This app · Project Scaffolding generator · Gap buffer
- moron4hire 10y agoI always end up rewriting Tetris and a basic MUD in whatever language I'm learning.
- sklogic 10y agoIMHO the best way to learn any language is to build its compiler.
- deleted 10y ago[deleted]
- stenius 10y agoWould you clarify what you mean? Are you saying to compile the source of the compiler, or write a compiler for that language (in that language)
- sklogic 10y agoI mean, write a compiler for a reasonable subset of a language you're learning. You can use the language itself to do so, yet most languages are not necessarily designed for writing compilers, so it's ok to use something else instead. This way you'll quickly understand the semantics of the language and will get an early exposure to its dark corners.
- alekratz 10y agoI always like writing a small calculator (takes stuff like 1 + 1.5 and outputs 2.5) using a top-down parser. They're relatively easy to make if you're comfortable with top down parsers. It makes for an nice couple-hours project to wet your beak with the language.
- MichaelBurge 10y agoFor interpreted languages like Perl, Ruby, R, Python, etc., I usually write a C extension. Usually C extensions have to communicate with the runtime using their internal data structures, and those data structures determine how everything else works. That and glancing at the AST if the language is open source.
- adnanh 10y agoSide projects.
- wlievens 10y agoI used to learn by writing asteroids clones. Fun and you get to try out the language features.
- shash7 10y agoIf you're interested in python, go, ruby, js(serverside), php then do this: - Make a simple website. This will teach you how to handle routes, serve files, using best practices and other http 101 stuff - Make a more advanced server with database connectivity[1]. This will show you how different languages handle database connectivity, database design, sessions, ORM and other webserver stuff. - Now make the same website using a framework. Eg: express for nodejs, flask for python and so on. I don't recommend using bigger frameworks like RoR or Django at this point. This will teach you what makes the language's ecosystem tick[2]. It will also show you how frameworks help you build websites faster. - The last step will be to use a CMS on the language of your choice. This will teach you how to deploy apps on the cloud, webserver, etc. At this point you know the internals of how (almost)everything under the CMS is working and you should be pretty confident in building a custom website all by yourself. Notes: [1] You ideally should be database agnostic but use whatever database the programming environment imposes upon you. For example, use mongodb when programming in nodejs. Once you work out the kinks of using a database, you can use other databases like rethinkdb, mysql, etc. [2] Large frameworks are opinionated and impose their own ORM, app wrappers, terminology, etc. Use a small easy to learn framework like flask for python, slim for php, etc and then move on to the bigger frameworks.
- biztos 10y agoThis is good advice, and I would just add four things: First, if you are building a web site you might want to really have in the world, then as a bonus you have it! (Think portfolio, or a blog that actually belongs to you...) Second, if you do this for more than one language you will have a basis of comparison, and this will be valuable to you in and of itself. It might even be valuable to other people! And maybe a topic for the web site.... Third, if you don't want to deal with the inevitable combination of HTML, CSS and Javascript (and various templates, frameworks, etc) that go into making a real website, then consider making an HTTP API instead. You'll still learn a lot, but it'll be more focused. Finally, you might find you have a particular thing you want to do differently than you see it commonly done. Web sites, web frameworks, and API's are great places to scratch that itch. However, be wary of rabbit holes. I'm currently in the middle of writing the web thing I wanted to have "just so," in its second form in Go, having already built it twice in Perl and once in NodeJS, and I think I'm on the right track right now but at this point who knows. (I've learned a lot of Go this way, but this is not an efficient way to actually create software.)
- ciroduran 10y agoThere is a good collection of simple games that you can clone in the Invent with Python website http://inventwithpython.com/blog/2012/02/20/i-need-practice-programming-49-ideas-for-game-clones-to-code/ http://inventwithpython.com/blog/2012/02/20/i-need-practice-... I guess what you're looking is the general skill of being able to model things with a programming paradigm.
- iheartmemcache 10y agoI'm writing a longer response to this targeted as a resource (e.g. "I know this, I want to do this- how do I approach the problem?"), but without knowing what background you come from we really can't answer this question. E.g. what languages/paradigms you're familiar with already, if any, and what you want to accomplish? I.e. why do you want to build project $foo or learn paradigm $bar? To make web apps? To get great at Project Euler and Code Jam? To expand your mind from a theoretical POV? To get hired at in finance to trade securities? CS hasn't gotten has large as other fields but it's pretty expansive. A little more concrete information as to what you desire your endpoint to be will help us a lot. Otherwise, one might ramble on for half a thousand words on compiler theory when you really want to target FPGAs. Edit: Dr Matt Might just blogged about PL's[1]; pretty relevant to you, OP. Post-read, definitely the information you're looking for. Scheme and Haskell (or really, any H-M type inference based language... you don't need to commit to typeclasses and pure functional idiomatic lenses over, say, OCaml's modules and semi-purity to 'reach enlightenment'...though perhaps them be fightin' words around here ;) ) If you liked pre-relativistic mechanics, SICM is a funner text than SICP (contentious remark #2 ! I'm just lookin' for a nerd fight now!). Both are well-written texts accessible to most anyone (i.e., don't be scared, the furthest they go into is perturbation theory) If, on the other hand, you're interested in enlightenment, academic research or a start-up, the criterion by which you should choose your next language is not employability, but expressiveness...Here you'll find descriptions of four good languages to learn--Haskell, Scala, ML and Scheme--with a list of my favorite features for each, and pointers on where to learn more. [1] http://matt.might.net/articles/best-programming-languages/ http://matt.might.net/articles/best-programming-languages/ I'll forgive him for this URL slug since the caliber of his content is significantly above average.
- superuser2 10y agoBreak the Vigenere cipher [0]. It's not very web-specific, but it'll at least get you up to speed on strings, collections, control structures, file I/O, modules, etc. [0]https://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher https://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher
- unixhero 10y agoI a doing a large webscraping project as a first in Ruby now. Learning heaps.
- collyw 10y agoDifferent languages are better suited to different tasks. Web development is generally best done in a higher level scripting language (Python, PHP, Ruby). If you need something where the language is likely to be a bottleneck for speed look more towards C,C++, Java. R is popular for stats and pretty graphs. So really it depends what you want to build or what language you want to learn.
- antoaravinth 10y agoFor learning programming languages, I would definitely go and write algorithms and data structures with them. Like quick sort, stack, queue etc. It's some how teaches you the language primitives really well. Currently learning Haskell and doing the same.
- probinso 10y agoYou should definitely Reimplement prolog. It doesn't matter what language you using.
- znebby 10y agoI'm interested in the subset of such projects that are not only good for learning but also useful to others released as open source. Anyone care to give ideas?
- mikelevins 10y agoI like to use a simple name generator, used to generate names for game characters. It's virtues are that it's simple enough to write in less than an hour, complex enough to give you a sense of how the language and its standard library work, it uses standard I/O streams and reads files, it uses random numbers, and it involves some manipulation of strings and sequences. The basic idea is: 1. read a file containing a list of sample names, one name per line 2 convert each name into a sequence of triplets; as an example, 'Fred' becomes the list ['Fre', 'red'] 3 choose a random starting triplet 4. choose a random non-starting triplet that matches the start. A triplet matches the previous choice when the last two letters of the previous one are the same as the first two of the next. Repeat with the new triplet as the start. 5. When you reach and end triplet or the length exceeds some limit, stop and merge the triplet. Merging the sequence means merging them two at a time left-to-right. Merging two triplets means dropping the first two letters of the one on the right and tacking the remaining letter onto the one on the left. Besides being easy and kind of useful for learning languages, it's also kind of fun. With the right input lists the names generated can be pretty funny. 'Corichadwinardo' 'Tadforgio'
- rashkov 10y agoThat's really neat. I like that it's solving a language problem and coming up with something intelligible and fun. It is also right in the sweet spot for complexity. A nice "hello programming language" exercise indeed
- ci5er 10y agoIt isn't a web-centric project, but a ray tracer is a very simple (at its heart), yet almost infinitely upgradeable project. Given how computationally heavy it is, that may knock out using that idea for PHP, Ruby, Python, Perl, etc...
- anotherevan 10y agoOne of my little go to exercises for just getting a handle on a new language is building a Sudoku solver. Usually just console output, with a command line flag to output timings. Found that as a pretty good little first step.