How can I improve my programming skills?

In summary: Shaan Aragorn, you are not well conditioned yet and have not learned enough how to think critically and analytically. You are in the process of getting this conditioning right now. In your daily life as student and maybe as a worker if you have a job, use Shaan Aragorn's suggestion, and actually look for programs to create which are not simply assignments for your programming course.
  • #1
shaan_aragorn
43
0
I am studying computer science and i have just finished my first year. We had a little bit of C language. Now i can grasp the theory part of the language like the syntax and the components of the language, but i can't seem to be ale to write programs. I mean i can't form the correct algorithm or the strategy to solve a problem.
Any suggestions, on how i can write a real program?
Thanks.
 
Technology news on Phys.org
  • #2
Try. Make mistakes and learn from them.
 
  • #3
Any suggestions, on how i can write a real program?

Maybe you won't like this, but try studying more Math.

The original programmers were all Mathematicians, and the same logical step-by-step process is what is useful for programming.

I mean i can't form the correct algorithm or the strategy to solve a problem.

Let say you are starting from A, trying to get to B. A good way to think is to find some Z, such that "if I had Z, I could get to B". Then declare all the variables you need for Z, and try to get from A to Z.

Declaring variables helps me as a first step.
 
  • #4
In programming, start with design and then implementation.

The design phase doesn't have to be concerned with programming at all. You approach the problem as if it had come up in your daily life.

Naturally, the process of sorting an array of n numbers for instance, is equivalent to the process of sorting a collection of n books by author. Once you have an approach that enables you to sort the n books you can use the same process to implement an algorithm that sorts an array of n numbers.

The better you can visualize and relate to a problem the easier it will be to solve.
 
Last edited:
  • #5
Crosson said:
Maybe you won't like this, but try studying more Math.
Whant kind of mathematics? Discrete mathematics?
 
  • #6
Thanks a lot, i will keep all the suggestions in mind and think over them. I must admit, i am a little scred by my career decision, will i be able to meet what is demanded from me?
 
  • #7
Crosson's suggestion is useful but by itself may not be enough. Shaan Aragorn, you are not well conditioned yet and have not learned enough how to think critically and analytically. You are in the process of getting this conditioning right now. In your daily life as student and maybe as a worker if you have a job, use "-job-"s suggestion, and actually look for programs to create which are not simply assignments for your programming course.

Always try to make flow charts to straighten your thinking about how to manage a solution to a programming exercise; carefully study the algorithms and flowcharts shown in your textbook, too. Remember, if your flow chart is good, then you translate the flow chart directly into code (unless C works too differently than other languages).

Even if you barely pull a C grade in your course, you may relearn programming later and be able to create a very helpful little program later for your own use or for someone else's use.
 
  • #8
shaan_aragorn said:
I am studying computer science and i have just finished my first year. We had a little bit of C language. Now i can grasp the theory part of the language like the syntax and the components of the language, but i can't seem to be ale to write programs. I mean i can't form the correct algorithm or the strategy to solve a problem.
Any suggestions, on how i can write a real program?
Thanks.
Is the main problem in making abstractions (e.g. object orientation, functional decomposition) or in algorithm development?
 
  • #9
MeJennifer said:
Is the main problem in making abstractions (e.g. object orientation, functional decomposition) or in algorithm development?

I do not get by what you mean abstractions, forgive my ignorance.
But algorithm development is a major problem for me.
 
  • #10
Maybe you could have told us what you are studying. Many years ago, beginning programming students did not study that object oriented stuff. They focused on flowcharting, defining variables, developing algorithms, and learning one or two particular languages, which would likely had been BASIC, FORTRAN, or PASCAL. A first programming course was very difficult for some students.

For you, shaan aragorn, STRUGGLE with it; you may need to repeat your course, but (1) keep your textbook and study on your own after the current term ends, and (2) the effort will be worthwhile; you may find programming skill to be very useful in the next several months, even if you did not master all of the material in your current programming course.

I struggled with an older form of BASIC, barely passing, and then used the language a couple of years later in another course. I only used as much of the language as necessary for this later course. More recently, I have improved in my BASIC programming skill (and have no worries about learning BASIC for a grade anymore).
 
  • #11
symbolipoint said:
Maybe you could have told us what you are studying.

I have just completed my first year in computer science. In it, among other subjects like

math we had one paper based on the C language. But i think i am going to fail in that

subject. So i have to get strong in it before my next attept which is approx 4 months away.

Also, this sem i'll be having data structures based on C and the C++ language the next sem

to that.
The main thing i cannot understand is problem solving. That includes algorithms.
 
  • #12
Whenever something is a super struggle, I look for for other possible causes of the difficulty.

For example I was trying really hard for over a month to keep my ankle aligned perfectly while running, but I wasn't making any progress. Then I stretched at a specific muscle in my lower leg and my ankle went straight automatically, from then on. I had talked to many personal trainers that would repeat the useless "try to keep your ankle straight" but what I really needed was to work on something indirectly related.

If programming is that much of a struggle, I am sure the problem is coming from indirect areas. You say your problem is algorithm development, so the traditional approach would be to read books of algorithms an practice lots of problems. We already know that this would be more of the same struggle, and along the lines of my ankle story it could add up to very little improvement.

Now discrete math is too much related to algorithms, we already know that is something that you struggle with. Do something totally different that still builds up the analytical logical part of your mind, like mind puzzles or geometry or symbolic logic or anything else where you enjoy using the analytical-logical part of your brain. The key is that you are having fun while doing it.

To be honest, your plan for next year is overly ambitious. The data structures class will be very difficult without a good understanding of the first year material. I am sure it is very important to you to continue on in your studies, so my suggestion is to find a good tutor, unless you are an ace at self-study.
 
  • #13
thanks

Thanks Crosson.
I feel you are very true about discrete math and puzzles. I struggled a lot in those areas too. I realize that I never really stick with a problem or a puzzle long enough to solve it. I'll have to change that. So how much time do you think I'll require to write a perfectly good program?
Also private tutors here are very expensive. Altough I may be able to manage a tutor who teaches 20 to 30 students at a time.
 
  • #14
Shaan Aragorn,

Do you mean that you are just studying a computer science course, or are you using computer science as a major field of study? If you mean that c.s. is your major, then you should change your major field. Your efforts at studying your current programming course would not have been a waste; some of the skills and concepts may be slowly creeping into your general proficiencies.
 
  • #16
The great thing about computers is that they do exactly what you tell them to do.
The worst thing about computers is that they do exactly what you tell them to do.


One thing that will help is that when you write a line of code, to try and understand exactly what you are telling the computer to do.
 
  • #17
hurkyl: shouldn't the word "tell" be replaced with "{code,program}" hehe.
 
  • #18
My experience with many real life programs has been that developing algorithms is a small part of programming, and most of the time is spent simply breaking up a known algorithm into the small steps supported by the programming language involved. Sometimes peformance is important and optimizing the code and/or algorithm is involved.

Maybe it would help to be given a simple algorithm, implement it in C, and then think about ways to improve it.

For example, input a line of text (or just delcare it in the program), then count the number of vowels in the text (the sum of all the a, e, i, o, and u that occur in the text). Once the number of vowels is known, is there a quick way to determine the number of non-vowels?
 
  • #19
Hi shaan_aragorn
I am doing C++ for almost two and a half years, though I am still at school.
The problem you are facing is very common, and students have to tackle it on their own. One can learn all the aspects of a programing language in no time, but the real problem is- algorithm development. I am nobody to advise you, but the way I did it was to read the maximum number of examples given in the course book. Read each example, and each line of code in it carefully and ask yourself: What is this code supposed to do?
There may be instances where the code is a compact one and difficult to understand. Try to break it into simpler codes.
After you have completely grasped the algorithm of the program, close the book and try to write it yourself without peeking into the book.
No doubt it will take time, and sometimes it gives you hell of a frustration. But once you have understood these examples, you feel a little more confident. Now try to attempt the exercise questions yourself. Here also, attempt each and every question.
A major thing to remember here is to try the maximum number of programs on your computer. After you have written a code in the compiler/interpreter debug it line by line, and insert codes which can help you understand how the computer solves the problem.
For example:
C++

for(int i=0;i<10;i++)
{
if(i%2==0) cout<<"even";
else cout<<"odd";
}

The computer will run the code written in braces 10 times, each time increasing the value of i by 1 by the computer. If i's value is divisible by 2, your monitor will display "even", otherwise it will display "odd".


Doing things in this way will lay down a firm foundation for you to build on. The programs given in introductory chapters are such that you have got to grasp them completely. After that, though the subsequent chapters have new concepts, but they are not so difficult if you have done your homework the right way.

Regarding the type of problems, there are 1) Mathematical problems: e.g. categorizing numbers as prime or composite, finding the factorial of a number etc.
2) Non-mathematical problems ( though there is some basic mathematics involved here.): converting lower-case characters to upper-case, finding out vowels and consonants, or whitespaces etc.

Both types of problems need practice. However, mathematical problems are comparatively easier: you have already got formulae for them. (Here again, the difficult part is making the system understand those formulae by suitable coding.)

It all depends on how much time you can devote, and how much time you are left with. But beware! Never try to start the next chapter without completing the previous one ( It will just make the situation more desperate for you). And yes, hard work pays greatly in programing: the harder you strive, the better you become. I am sure you will soon overcome this problem.

I hope my post was helpful in some way.

regards
Mr V
 
Last edited:
  • Like
Likes Mr Real
  • #20
Well, to tell the truth, i am not a very good programmer. But i am able to program well. I do a lot of errors and so on. But the thing that helps me survive is trial and error. I experiment a lot and see that are the differences. I try to write something one way or the other and save the good pieces of codes that are somewhat long which could be useful later and use that code again when needed.
 

1. What are some common programming difficulties?

Some common programming difficulties include syntax errors, logic errors, debugging, and understanding complex algorithms.

2. How can I overcome programming difficulties?

To overcome programming difficulties, it is important to practice regularly, read and understand documentation, seek help from others, and break down complex problems into smaller, manageable tasks.

3. Why do I encounter programming difficulties?

Programming difficulties can arise due to a variety of reasons, such as lack of understanding of the programming language, overlooking small details, or attempting to solve a problem in a complex way instead of simplifying it.

4. How can I improve my problem-solving skills in programming?

To improve problem-solving skills in programming, it is important to understand the fundamentals of programming, practice regularly, and seek feedback from others. Additionally, learning different problem-solving techniques and strategies can also be helpful.

5. What are some resources that can help with programming difficulties?

There are many resources available to help with programming difficulties, such as online tutorials, forums, coding communities, and books. Additionally, seeking help from experienced programmers or mentors can also be beneficial.

Similar threads

  • Programming and Computer Science
Replies
16
Views
1K
  • Programming and Computer Science
Replies
8
Views
832
  • Programming and Computer Science
Replies
1
Views
705
  • Programming and Computer Science
Replies
11
Views
1K
  • Programming and Computer Science
Replies
9
Views
1K
  • Programming and Computer Science
Replies
15
Views
2K
  • Programming and Computer Science
Replies
8
Views
971
  • Programming and Computer Science
Replies
5
Views
581
  • Programming and Computer Science
Replies
2
Views
1K
  • Sticky
  • Programming and Computer Science
Replies
13
Views
4K
Back
Top