Ask HN: How do you improve as a self-taught programmer?

16 points by Regardsyjc ↗ HN
Earlier this year I learned to code and built a janky restocking program for my business using Python and SQL. I built it by making a blueprint with the help of my partner and then learning and progressively building each part.

However, because I built it with lots of Googling, I'm not confident in the code, and I feel like I don't know what I'm doing. It works but I feel like I built it out of scotch tape and that it will break at any moment. Because I built this for my own business, there aren't any managers I could show my code to, and the programmers that I do know aren't that interested in reviewing my bad code. Every time I've shown my code to someone they look a little horrified and then very confused.

For example, for my restocking program I needed to reverse-engineer Amazon's sales rank algorithm. It required an understanding of mathematics that I lacked. I went to a hackathon to meet more programmers but most of them were front-end and not familiar with curve fitting and the regression modeling stuff.

I want to know that I am doing the right things, following best practices, and get more confident in my coding ability.

What would be the best way to get there?

17 comments

[ 2.9 ms ] story [ 34.4 ms ] thread
Read other peoples code on eg. github. Or just write code for years and years - you will occasionally be disgusted by your own code and refactor it to be more readable/logical for yourself. Over time your style will improve greatly.
Thanks so much. Do you have any Github repos that you could recommend? Or tricks to finding good github repos?
You could start by googling "awesome <language>" to find lists with well-regarded projects in a given language.
Do some structured learning, there's lots of free quality courses/books/videos etc you can pick up. Structured helps because it fills in any gaps of knowledge that you don't know you don't know.

Aside from that just keep doing what you're doing and revisit your old code every so often, you'll be surprised by how bad it is and you'll always find ways to improve it.

Thank you. What do you think are the top 5 or 10 structured learning resources? Do you have any favorite books, courses, or YouTube channels?

There's so many resources that I get stuck in the paradox of choice. I can't try them all so I wish there was a Top 5 or 10 list like master guide to learning SQL, Javascript, master guide to programming fundamentals/building blocks, etc.

For example, if I wanted to build the front end of my program- I don't know whether I should build it in Javascript, Django, or Flask. Even when I had to figure out what sql database to use- it seemed like there were so many choices.

It gets easier with time.

For databases I recommend this book http://it-ebooks.info/book/866/ 7 databases in 7 weeks, generally though all you need is either mysql or postgres.

For front end work I would use Javascript not python. And I would suggest, and this goes for actually everything, learn the language first NOT a framework.

Too many people do it the other way round and get stuck with mental models they can't shake.

This is a good starter on Angular https://www.ng-book.com/2/ and the same style for React https://www.fullstackreact.com/

You've already taken the most important steps by building something that's useful, so don't get discouraged and just keep doing your best.

I am very new to programming myself and I very much understand your sentiment. Two years ago I learned a bit of PHP and MySQL and built some apps and websites for my own use. What I found out is that I learn best by watching videos, not reading books or articles. I used Lynda.com videos as as foundation with the occassional Youtube videos thrown in (sometimes the pace of Lynda was a bit too fast for me or it felt like the lecturer was doing too many things at once). So I recommend Lynda and/or other similar services to see if it fits your learning style.
First, congrats! You did something that others would shy away from, be proud of your accomplishment. I know a lot of educated programmers that struggle to put a system together enough to make it functional for anything other than a developers machine. You made a production system that helps your business. I am sure it is far from perfect, almost NO system is perfect regardless of who designed or built it. But if it saves you money or makes you money it is already a success.

As for learning. IME reading and experimenting is the only way to do it. Yes, structured learning will go a long way, but even than, doing is the best teacher. You'll do something and make it work than 3-4 months later look back at it and be like, OMG that is so horrible I cannot believe I did it that way. The reality is that is true for all of us when we are learning, and frankly after 20+ years I can still look at stuff I wrote say last year and be like damn, I could do better today. New grads coming out of school require a few years of experience to become proficient and honestly it isn't their education that is bad, it is just that doing is the best teacher many times. I spend a lot of time showing young devs designs and things only experience can teach you. I have also seen new grads come out and they obviously have been spending their time experimenting cause they freaking rock it from day one, so experience & experimenting is what matters.

As for selecting tools, systems etc. My advice is stick with what is proven most at this point since that will typically have the most support on places like Stack Overflow and in general forums. This will also mean you can get design ideas and assistance from books and online resources easier and faster than if you try to adopt bleeding edge tech. For databases, stay with SQL for now, postgres or mysql are both fine choices, I'd favor postgres but honestly that is personal preference. If you are in a Microsoft stack and have those tools, stick with MSSQL and Visual Studio, great tools and tons of resources. For coding, stick with common frameworks and languages, Python is totally solid. Understand too that a tool that is awesome for backend work, or computational work etc may not be the best tool for UI/Web work. For example, Python is awesome as a backend tool but I wouldn't recommend putting together Web UI's with it. You can as many teams do, but the level of effort and lack of common resources makes it harder than say using Javascript/node.js or even Ruby.

For algorithm, curve fitting, regression type stuff, don't forget to check out Khan academy, and also check out youtube there are some awesome people posting great content on there (just pay attention to recommendations here cause some youtube content is crap too).

Thank you so much for your kind words and your generous advice. Hearing that it just takes months and years of practice for everyone makes me feel better. You gain confidence by doing and I just need to do more.

I'm going to stick with Python, SQL, and learn Javascript for the front-end.

I'm really embarrassed but I searched "curve fitting" on Youtube and there were dozens of videos. The internet is amazing and I need to improve my googling skills.

I'm largely self-taught (3 courses in 50 years). I think I understand the issues. To survive in this world you must understand Structured Programming and Object-Oriented Programming. There must be a concise book on this. Find it and read it.

For me, carefully reading a language manual while thinking of a specific project was hugely successful. You must thoroughly understand the language. From your uncertainty it sounds like you should review your chosen language and master it.

Thank you. I'll work on finding the best books for Structured Programming and Object-Oriented Programming. What do you do when you struggle with the documentation? Is there a progression level of recommended documentation readings haha.
The documentation for applications and operating systems is notoriously uneven. The only thing to do there is to grit your teeth and work your way through it as you have done so far. Then, review what you have learned. For languages and theory, there is a wider range of books to choose from. Spend some time at the library, the bookstore, and on the web searching for something special. You are choosing the tools of your profession so take some time and choose carefully.
I'd recommend the following:

Clean Code: A Handbook of Agile Software Craftsmanship [0] is a great book on writing and reading code.

Similarly, Clean Architecture: A Craftsman's Guide to Software Structure and Design [1] is, no surprise, a book on organizing and architecting software.

Designing Data-Intensive Applications [2] may be overkill for your situation, but it's a good read to get an idea about how large scale applications function.

The Architecture of Open Source Applications [3] is a fantastic free resource that walks through how many applications are built. As another comment mentioned, reading code and understanding how other programs are built are great ways to build your "how to do things" repertoire.

Finally, I'd also recommend taking some classes. I started as a self-taught developer, but I've since taken classes both in-person and online that have been a tremendous help. There are many available for free online, and if in-person classes work better for you (motivation, support, resources, etc), definitely go that route. They're a fantastic way to grow.

[0]: https://www.amazon.com/Clean-Code-Handbook-Software-Craftsma...

[1]: https://www.amazon.com/Clean-Architecture-Craftsmans-Softwar...

[2]: https://www.amazon.com/Designing-Data-Intensive-Applications...

[3]: http://aosabook.org/en/index.html

Read up on code formatting/styling

Style your Python as well as your SQL

Cleanup field/variable naming

(i.e. for db fields I usually name fields: tablename_fieldname cuts a lot of ambiguity)

Check your application file structure, everything in one directory works whan starting out but as you increase your skills/apps/libraries you will want to organize your project directories more logically. Looking at some FOSS apps and how they organize things can help.

Anything you feel weird about - research look at other examples, stack overflow results usually gives you a variety of examples you can usually spot better methods from bad ones.

Help out others a little on forums, get shot down for your crazy methods, figure out why (done this a couple times, stings but it helped, some pros only respond to people posting bad answers)

And as other said, write, write, write, the more you write the more you will get a sense you are spinning your wheels on something or some part could be done better.

If you need tips on organizing your project, go read the Flask source code on github. Reading this code helped me improve my Python skills greatly.
It helps to get at least a basic level of understanding of some core computer science/engineering subjects:

- Algorithms and Data Structures

- Operating Systems

There are more but it helps to at least learn the fundamentals of these two. If you feel up to it, there are these too:

- Computer Organisation

- Compilers

There are more which you could look at depending on your interests: Computer Networks, Computer Graphics, Databases, Computer Architecture, Programming Languages, Theory of Computation, Distributed Systems

Many of these can be learnt from a good online course or a good textbook

Besides these, I found it very helpful to try and contributed to big free software projects. The standards are high and you'll get a lot of feedback on your patches. If you pick a project like something by Mozilla, you'll also have bugs/tasks specifically earmarked for people who are new contributors.

I forgot to add: Reading good code really helps. However, for this, I found that the most effective way was to try and fix a bug or add a feature which leads again to my suggestion above. This way, you have a 'purpose' with which you read code and it helps navigate a large codebase.

Good luck!

My experience differs from the rest of the comments you're getting. I've benefited most from cross-pollination with _other programmers_. Pairing, working on short projects together. You can't ask a book a question when you're stuck, and a book has nothing at stake if you don't understand it (nor do you, whereas if you write embarrassing code and you know the person who's going to review it, you have a reason to up your game.)

I know way more (maybe 10x more) tools, more approaches, and more languages, than if I'd just stuck with self-taught approaches like books and tutorials. Those have some utility, but it's a very distant second.

Plus, actual people help you get better jobs (or investors) even years after you part ways with them.

In short, best practices require practices, not theory.