Jump to content

Learn to think like a programmer???

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
16 replies to this topic

#1
Coldhearth

Coldhearth

    Learning Programmer

  • Members
  • PipPipPip
  • 88 posts
Hi,

I have been learning some programming on my own for the last 2 years but I still haven't accomplished much.
I think the problem isn't the syntax of the languages I learn but rather that I still am not able to think like a programmer should be.

Most of the books (I dare say almost all of them) out there about programming focus so much on syntax but not on logical thinking like a programmer should do.

After reading a bit on google I found out that you first have to learn how to think like a programmer.
Can you guys help me out here?

I'm focusing on Java (school purposses) for GUI programming and on PHP (in my free time) for web development.
(I'd like to do both of them in OOP)

#2
Natrobius

Natrobius

    Programmer

  • Members
  • PipPipPipPip
  • 166 posts
Assume that you are talking to a retarded individual with no common sense and is very naive and you'll be getting close to how we think about computers... Here's a breakdown.

1. Retarded: They only know what you tell them.
2. No Common Sense: You have to tell them how to do everything
3. Naive: They take you very, very literally, no matter what you say.

That's a good place to start. But I imagine you're looking for more than that. The biggest thing is to start thinking linearly. Learning how to think "what steps to get me from here to there" is the biggest key. Remember the basic cycle of programs.... Input, Processing, Output.... Processing is the getting here to there.
The Natrobius
http://natrobius.info
CodeCall User

#3
Coldhearth

Coldhearth

    Learning Programmer

  • Members
  • PipPipPip
  • 88 posts
Thx for your comment :) I'll keep those rules in mind...
You say start thinking linearly... but what about object orieneted programming.
I really find it hard to learn to think this way to write programs in an OO language :(
Any more tips on this? :)

#4
Sinipull

Sinipull

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 386 posts

Quote

1. Retarded: They only know what you tell them.
2. No Common Sense: You have to tell them how to do everything
3. Naive: They take you very, very literally, no matter what you say.

Hahah, this is the best and most accurate description for a computer i've ever heard!

#5
Guest

Guest

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 3,414 posts
Programming is a lot of problem solving. It is also a process.
I usually go like this:
1. I have a problem.
2. I get a good idea of how I would implement a solution.
3. I start making functions to automate tasks the program will do.
4. I write the program, thinking about the design goals.
5. I make sure to include comments to remind me later.
6. I test it out.
7. I fix any bugs I find.
8. I test my bug fixes.
9. I may add more features.

Maybe you should pick up books on programming methodology, theory etc. I have also heard that learning lisp may improve your overall programming skill.
Root Beer == System Administrator's Beer
Download the new operating system programming kit! (some assembly required)

#6
Coldhearth

Coldhearth

    Learning Programmer

  • Members
  • PipPipPip
  • 88 posts
Oh okay :) and does anyone have some good books about programming methodology that make you help learning how to think to create OO programs?

#7
Sinipull

Sinipull

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 386 posts
If you are focusing on java, you should try "Object-oriented programming and Java (Second edition)" by Danny Poo, Derek Kiong, Swarnalatha Ashok. It starts with setting the right mindset.

#8
Natrobius

Natrobius

    Programmer

  • Members
  • PipPipPipPip
  • 166 posts
You simply have to think of objects as just that.... Objects.... For instance, a car object might contain variables such as engine size, tire size, gas tank level, and it might contain functions such as StartEngine() and HonkHorn()....

For instance, a "form" object, (the name of windows, in windows. ;) ) has a string for it's title, integers for it's x/y position, it's size, etc..... Objects are used to group functions and variables together that belong together.

Another thing that's nice about objects is, once you define the object, you can declare as many of them as you like. For instance, the car object we talked about above... I can define it with those items, then use that definition to declare a car object named "WifesCar" and "MyCar" and "NeighborsCar".

Really to a large extent objects are similar to structures in C, except with objects you can place function code inside the definition.
The Natrobius
http://natrobius.info
CodeCall User

#9
Coldhearth

Coldhearth

    Learning Programmer

  • Members
  • PipPipPip
  • 88 posts
Hmmm thx for the response :)
I think my problem is that the "click" just hasn't come for me yet.
I have a friend that had programming in school and he said you have to have a click in you head and that you then start to understand how to think and solve a problem in an OO way...
Is it a good idea to read about java and make as much exercises as possible gradually increase the difficulty of the exercises?

#10
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,298 posts
It is always good to practice a lot and gradually increase difficulty.
I've bee procedural programmer for many many years, and is right now taking my first java course, having cheated a little by starting to understand OOP in PHP first, but it is absolutely a different mindset.

I would say that the procedural way, you think on what needs to be done.
but in OOP way, you think what am I working with, and what can be done to it?
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall

#11
Natrobius

Natrobius

    Programmer

  • Members
  • PipPipPipPip
  • 166 posts
That's probably the best way I've heard that explained..
The Natrobius
http://natrobius.info
CodeCall User

#12
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Usually, people use very simplistic (ie: useless) examples of objects, like cat, dog, animal, etc. Ultimately, it comes down to a different way of organizing your code.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog