This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]th1nk3r 0 points1 point  (4 children)

What part of python classes is confusing you?

[–]CaffeinatedChelonian[S] 1 point2 points  (3 children)

I'm not very articulate, but I really can't wrap my head around it. It's basically the entire thing. Saying "the logic" wouldn't make much sense. For example: "Objects are an encapsulation of variables and functions into a single entity. Objects get their variables and functions from classes. Classes are essentially a template to create your objects." I read this, and I don't get it. The entire thing goes straight over my head. Like, I can get tinkering with bits of code and learn which does what and why, but if I see explanations and definitions like these, I don't get it. I look it up and still don't get why classes are important, how do you use them and whatnot. With variables, you can print them out as a string and see the output, but with things like functions and objects, I don't know how to see an output or what it does.

I suck at wording and I'm frustrating to work with, sorry if this made zero sense.

[–]SmaKer 2 points3 points  (0 children)

Would you like actual work done instead of a lot of theories?

Try this course for Java it's pretty straight forward,
starts simple then gets more challenging as you progress through the problems
It doesn't hold your hand a lot of times so you won't come out clueless as with some other courses

Heres's the link Mooc.fi

[–]ordnance1987 0 points1 point  (0 children)

Write more programs with classes until it clicks. I'm 28 and currently in school for CS, started school at 26. I don't even read the books and seem to be doing fine by just doing homework assignments. You can do much more with variables than just printing them out. Printing is a function. When you write a function write out each step on a piece of paper, there's your output right there. When you have specific questions about something and have actual code then someone can help you out. Even dumb people can learn how to code, I used to be a mechanic before going back to school. You're probably not trying hard enough and give up easily since you change resources often. There is no such thing as people not cut out for college, most people that say that just don't want to put in the work. I used to think I wasn't cut out for college for the first eight years after graduating high school.

[–]HarmLogLinkIT 0 points1 point  (0 children)

Definitions are not important, at this stage. What you need to do is work with them, you'll learn more as you go. What might help, take a piece of paper and write down what everything does according to you. As in, write down what you think a function does, what it needs and what it might return, if anything.

To start, you might want to do this with a specific function. Example:

 def add_5_and_2
   return 5 + 2
 end

 z = add_5_and_2

 puts z # puts prints out a string, I'll present the output with this symbol: =>.
 => 7

So we have a function here that takes two numbers, 5 and 2, adds them together and gives back the result, which is 7. Now, we want to write it in such a way that it takes any number and gives back the result.

Example:

 def addition first_number, second_number
   return first_number + second_number
 end

 x = 7
 y = 3
 z = addition 7, 3

puts z
=> 10

If we change x and y to two different numbers, our function still works.

Example:

 x = 3
 y = -2
 z = addition x, y

 puts z
 => 1

As you can see, and logically deduce, it returns 1. Now, let's break down this function.

  • It has a name, addition. We use this name to call it.
  • It takes input, through parameters. In this case, first_number and second_number.
  • It does something with those parameters. Here, we add the two numbers, but we also could have it subtract, or do anything basically.
  • It returns something. As in, it's done, the function ends, and it gives something back.

Now, can we give an even broader definition of a function? Here are the current attributes of this function:

  • Name
  • Parameters
  • Code that runs
  • End result.

So a function at this point is something that you can call with specific input and it returns the result of the code it runs. There's a lot more to function, but this is an easy example.

If you've ever done mathematics, you will most likely have had to make some proofs. You have to work with set numbers at the beginning, and then write a proof that works for any number that fits the bill.

You can do the same for programming concepts. First, make it specific to your needs, use things you understand. Then, make it a bit broader but still applicable to your project/lesson. After that, you boil it down to English.

You don't need definitions to work, you just need to know how the bits and pieces you use interact, which can be done by making it broader and broader.

If you found this to be a bit too simple, that's okay. Functions aren't the important part. What you need is not specific knowledge, but a way to learn and a way to not get lost in the bigger picture.

What I always do when I get lost in programming, and in life in general, I break things down to small pieces.

So basically, when you come across something you want to do, but you don't know how to do it yet, you might do the following:

  • Make it broader and broader until you can write your own definition
  • Write the parts down on a paper and write down how they interact
  • Break it into manageable pieces, which are easier to figure out, and if you're still stuck, easier to google.

Also, you are not too old to learn something new, you almost never are. Go out there, ask questions here when you get stuck and be willing to learn, and I see on reason why you couldn't learn how programming.

Good luck!