Hello
I’ve been learning programming for quite a while now but at a slow pace, lately learned a lot about C# by reading the Yellow Book ( someone recommended that book to me from this subreddit ), I’ve also read Head

First: Design Patterns as well as the first 4 Chapters from C# in a Nutshell ( the forth chapter being “Advanced C#” which talks about delegates, lamda .. etc), I’ve also worked on a few small projects of mine.

The thing is, although I can somewhat tell what code is better than what, I still don’t feel confident when making these decisions, basically I cannot tell if I’ve written the correct code in terms of efficiency, readability or even convention.

Can anybody recommend a book that can help me with this problem?
also if you’re a self taught programmer, do you think I can start making money at this level? if not then what am I missing ? I’d love to hear your advice and please point me in the right direction if you know it.
Thanks.

These are the kinds of things you learn best through practice. Pick a larger project and work on it. Once you get it to a working state, then think about how you can make it better. Find the parts where performance is unacceptable or the code is disgusting or fragile, and work out how to improve them.

Definitely this. In fact, this is a big part of coding in general. Your code will always be changing as new features get added.

For example:
Code you wrote in version 1 now times out in version 7. After some analysis, you realize that a function with a complexity of O(n2) is timing out because it’s processing a lot more data than before. So you figure out a way to optimize the old code to run at O(n), thus speeding up the processing time.

This a common scenario you’d come across and really only gets embedded into your brain by practice.
“correct” code can be subjective, and the most readable code isn’t necessarily the most efficient. Focus on creating clean, readable code then go back and optimize parts of your code that need to be more efficient. I don’t think there is a ‘right’ answer so much as a sufficient development strategy. It’s a process.

To gain confidence, you really want experience. Let people review your code with you and give you suggestions. Get some projects under your belt.

also if you’re a self taught programmer, do you think I can start making money at this level?

If you don’t have any significant projects, probably not. It’s not impossible to get a job as a self taught programmer, but it’s going to be an uphill battle. It’s going to be difficult to come off as more than just a guy that reads a programming tutorial and thinks they’re a developer. My suggestion would entering a company in a different position, making friends with 1 or more developers, doing some projects with them outside of work, then applying to a developer position using them as a reference. Put yourself in the shoes of an employer. If they need to decide between you and someone with a degree, why would they pick you? The other guy has a degree.

One thing I feel I need to mention is that employers are looking for developers/engineers, not just people that can program. There is more to software development than just understanding programs and programming. People that set out to learn programming often don’t learn things like the SDLC, Git, agile (SCRUM), databases, TDD, etc. You might look at job listings in your area to get a rough idea of what employers are wanting from you.

To leave you with some advice, you might want to consider getting a degree. Financial aid and Scholarships are available. Your employer may offer tuition reimbursement. It’s not like you can’t. Additionally, degree programs at places like WGU might suit you pretty well. You can use the knowledge you currently have to speed through coursework you already know, and the faster you work through the program, the less expensive it is.

Everybody writes bad code. You read up, try new things. There are so many ways to do something, and a lot of approaches are dependent on the context, technology, environment, limitations. Good decisions often come from making not-so-good decisions, and learning along the way. A lot of time you will rewrite your code several times before you get it in the state you want. And along the way, you’ll develop your own style you are comfortable with, or pick up other styles and integrate them into yours, which will help you rewrite less.

If you can make a website that can read/write data to a database and display it, and manage all the UI interactions, then yes you could say you can make money. There are people making money from mediocre coding skills, because the truth is the clients don’t care about code quality and unit tests (until it bites them in the butt). They care about time to market.

It depends a lot on what sort of industry you are going into. A lot of backend code will be the same, but sometimes the presentation layer will be different. There maybe different challenges in each industry. Some are very data-oriented, a small subset are probably really into optimization and performance. The most important thing a dev must know is how the business works, and how their skills/knowledge can help drive the business goals.

I cannot tell if I’ve written the correct code
As if “correct” is some objective measure? Ask 5 programmers what’s the right way to do something and you’ll get 15 opinions.
You’re overthinking this, just keep coding. Try new things. Don’t be afraid to refactor. Don’t be afraid to revert the refactoring if you realize it’s not improving anything.

Stop reading start coding. You can learn how much theory you want. But its when building things you actually learn and find your way of solving problems.

I recommend u to do the following:
1 do not stop reading, but keep it under control and read constantly. e.g. read every day 4-7 pages of a book. do not miss a single day.
2 start creating ur own project. start working on something which is interesting 4 u. e.g. if u know C# I would recommend trying to make a web app with ASP.NET Core or a game with Unity. here also be consistent and keep urself under control to avoid burning out. e.g. u can work on ur pet project for 20-40 minutes per day. use timer even if seems like u can finish in time. it is better to work three days for 20 minutes than one day for an hour.

3 actively look for a job. I would recommend u to look for a web developer position. it is always the easiest to get, it is well paid and u can get a few offers at once. so, create a CV and start sending it out, also start going to interviews. u will never know that u r ready for a job untill u will get hired.
3.1 from what I can tell – right now most web developer positions require front-end skills too. so, try to spend some time on it. learn about HTML, CSS, JS. pick up some frameworks like React, Angular, Vue. don’t be afraid, it will be easier than it seems.

4 determine 4 urself what is important 4 u. 4 sure it is payment, career growth, skills improvement, etc. continue dreaming about progress and prove with each day to urself that u r the kind of person who deserves all the dreams u have. don’t be a motivated person, be a happy person. try to feel the joy of doing what makes u excited at ur job. try to do a self review at the end of each day by asking urself questions like “was today a good day? have I being doing what a person who deserves my dreams should be doing? etc.”. use answers to these quetions to direct u in ur actions.
The thing is, although I can somewhat tell what code is better than what, I still don’t feel confident when making these decisions, basically I cannot tell if I’ve written the correct code in terms of efficiency, readability or even convention.

I’m a senior developer and sometimes I’m also in doubt about what the best approach is. In those cases, I try to make it work, even if it is everything in a single method, and revisit it before committing.
Sometimes I make a proof of concept in a separate project, and refactor the code while copying it to the main project.

But ultimately, remember that non-programmers don’t care about code quality, only that it works. Focus on delivery first. Then you can look back and think about how you can improve what you have done. Keep studying, and your code quality will improve with knowledge and experience.
From my own experience, the best way to improve code quality is by introducing unit tests. By making a piece of code easier to test, you also makes it easier to read and reason about. Two books I can recommend to improve code quality are The Art of Unit Testing by Roy Osherove and Refactoring by Martin Fowler.

also if you’re a self taught programmer, do you think I can start making money at this level? if not then what am I missing ?
That depends. Can you deliver something that works? Even if it’s not the best?

I’m a self taught programmer. But I did some internship after learning on my own. And only then I started to take some freelancing. I can’t say if I’d be able to deliver a piece of working software before some internship time, maybe I would.

Be upfront with your contractor that you’re starting off. Tackle some low risk project, so you don’t cause a serious problem if the delivery date slips.
And remember that your value to a business is in what you deliver, not how beautiful your code looks.

And most importantly, do not, under any circumstance, take a non paying job. Not even to your family. If it’s a business, they can pay you.

source