Skip to main content
3 answers
3
Asked 435 views

what advice would you give to someone who is considering going into computer programming

I am a junior in high school and i really enjoy programming. I know python and I started learning c++
#computer-programming

+25 Karma if successful
From: You
To: Friend
Subject: Career question for you

3

3 answers


2
Updated
Share a link to this answer
Share a link to this answer

Fred’s Answer

Don't focus on learning a language - focus on learning good programming practices. For example:
- do you use good variable names? apart from loop indexes, variables should have names that clearly indicate what they represent. A name like myInteger is garbage.
- do you always properly indent? Python enforces indentation by the language syntax, but not all languages do.
- Is your code clean and easy to read? I'd much rather have a longer method that is easy to understand, than a short method that relies on some "trick" to do the job faster.
- Do you properly separate out your code into methods? having one monolithic method that does everything is terrible, and a maintenance nightmare. It's much easier to debug and test 30 methods that each do one small piece of the puzzle than a single, huge method.

Another tip - coding is really 90% THINKING, and only 10% TYPING. Everyone's first intuition is to start up their editor and put down lines of code. That is the worst way to code. The more time you spend up front, thinking and planning your design, the easier (and better) the code will be. As you get more skilled, the ratio might change a little, but I probably still spend 70-80% of my time planning and designing, not typing. I've been doing this 30+ years.

Start small. Try to write the LEAST amount of code possible each time before you compile and test. I try to never write more than three lines before I do a testing cycle. If I've written three lines and there's a new error, I know where to focus my attention. If I've written 200, there is just a LOT to look at to find that needle. If you followed the above advice, it's also easy to test a single method that does something simple, instead of testing your 1000 line behemoth.

Here's an example. I've seen many people try to write a password validation method. You know...it must have upper case, lower case, be at least 8 characters long...etc. They almost always want to write a single regular expression that does all the above. CAN it be done? Probably. Should it be done that way? NO. I would write many small methods. One to test the length. One to look for at least one upper case. Once to look for a symbol, etc. Then, bundle them all up in another method that calls each in turn. Why? If you have a single regex, and your requirements change, your whole regex is broken. You have to re-write the whole thing, re-test every single case. And there is no doubt you've missed some edge cases. If it's instead broken down into many small methods, you only need to change those small pieces. Maybe now your pw has to be 10 characters. Maybe you no longer require a symbol, so you can comment out the call. Maybe you write a new method that looks for the same character to not be repeated three times in a row. THAT is now easy(er) to test by itself, and add the call to it into your higher method.
2
1
Updated
Share a link to this answer
Share a link to this answer

June’s Answer

I think this field is really the future and there are many opportunities going into this field of study. As someone who hires interns focused on STEM majors, I would say similar to Fred's response, you do want to focus on good programming but an internship and university will probably provide that but what's important is also learning at least one or two programming languages as well. This helps to build a foundation and helps for you to understand the basics and as you move along in your university time and hopefully secure an awesome internship, you will be taught the proper way to program.

Also consider using sites such as CodeAcademy, etc. to do self learning projects. These will help for you to further learn and sharpen your skills. You can also put those projects you do on your resume when you start to search for summer jobs, internships, etc.

Good luck with everything!
1
0
Updated
Share a link to this answer
Share a link to this answer

Angelo’s Answer

Great answer by Fred! Just to expand a little:

What people often forget is that programmers are authors - one of the biggest reasons we write code is to communicate! Could we write a program in zeroes and ones? Probably - and depending on our skill, we could make it faster than if we used a coding language. But could I read and understand my program, if I want to make changes? What if I wanted to review it with my co-worker?

The fact is that an important part of coding is social! The best programmers write code that balances performance and understandable code (preferably the second one in most cases, because computers are getting really fast - to the point where we're starting to reach some speed limits https://applegazette.com/mac/why-arent-cpus-getting-faster/).

Not only that, but programming is most fun with others! I may have fun following a Python tutorial, but not as much fun as if I solved problems with a friend, laughed at things that didn't make sense, and celebrated the final result together. My advice is to get involved with other programmers (there are coding clubs all over the world you can join, or related clubs like Robotics teams); get used to working with them and enjoy the process 😄
0