• Forum
  • Lounge
  • What's the chance of me becoming a progr

 
What's the chance of me becoming a programmer?

Pages: 12
Hello,

I am posting this because I'm preety upset, my code doesn't compile and I think I suck at programming in general.
I'm 28, I worked as a servie engineer at different companies since I graduated automation college and now I want to be a programmer.
I'm learning C++ since roughly last december and I switched my job to software testing. I was thinking it should take no less than a year until I would be able to write a simple window application, but I'm bogged down in my own mess understanding classes.

Do you know any people that have succeeded to be hired as programmers with similar background? (unrelated work experience and age)
What are your thoughts/advices for me?

Please be honest, bleak realism is a great incentive for me. :) (but then again, utopian optimism too)
Well dear friend, sometimes it's hard to get into. However keep going. I promise you'll get it, if you keep at it. Some things are difficult to grasp because you have no fundamentals for them.
Classes/structs are just manufacturers. Like real life objects, the objects that they make can do things and store information.
Atleast, your code doesn't compile.
Some people have code that compiles and End up with LOGIC error's. PAIN.

Think of C++ classes as real life objects. Consider a Vehicle. In the C++ code, the engine will be a class, the spark plug will also be a class, the 'atom'(consisting of protons.....)is also a class.

Now, figure out how to put them together (ask a mechanic) and you got a Vehicle.

Do the same for your code.
Find the Classes, then try Composition (used in the above car example-HAS A), then try Inheritance (A Hatchback IS A vehicle and a Bike IS also A vehicle).

Consider reading "Thinking in C++".
Last edited on
@dams a class can be considered a real-life object. If you're using static methods. However if you aren't it's really not the object itself. The instances are the objects in question ... =]
Thank you all for your replyes,

However, I'm going to understand it in the end... Right now I'm doing something derived of a chess game, and I have the pieces classes and the board class. The catch is that the pieces need to interogate the board to see where they can move (cyclic dependency). This is a good problem, because in the end I'll be using almost everything explained in this website's tutorial.
I got the move function for the rook that i've written in haste, having every conffidence it will work, and now I have to sort out the mess.
I've learned pascal since in high school; C and a bit of C++ in college but I got more interested in control theory and automation (whitch is also about drawing boxes, but the lines are not variables but usually wires). So it can't be said that I don't have the education; it can be said that I didn't learn in school.
I can find and fix a fault in a plant with 5 control panels larger than my clothes closet and I was preety good at it. But it takes me two days to figure out that I was comparing a signed char to const 254. I'm not stupid, i'm just horrified by my progress.

Thank you for the advice, but I'm interrested if you, or someone you know fits my profile: 5 years working more with the multimeter than a PC (or some other field) and then switching to programming. Did it work for them?
Have you, or anybody you know opt for this sort of carreer change at this age? (~30)
closed account (z05DSL3A)
I spent a time working in a QA Lab and as a luthier before I retrained as a programmer. I had an interest in computers from a young age though. If you have a passion for programming then there should be no problem in a carreer change, if not only time will tell.

Just to give you a soothing with C++: it simply is not the best designed language (in fact, it is an *evolved* language, and carries some unpleasant artifacts from its evolution).

This should crash miserably:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <iostream>
class A
{
public:
  int* x;
  A& operator=(const A& other)
  { *this->x=*other.x;
    return *this;
  }
  A()
  { this->x = new int;
  }
  ~A()
  { delete this->x;
  }
};

int main ()
{ A object1;
  *object1.x=1;
  A object2;
  object2=object1; //this is perfectly good and does exactly what it should.
  A object3=object1; //This is terribly bad! Comment this line out and the code will run just as intended, without crashing.
  return 0;
}


Why? Is this code badly written? No, in fact if C++ were a better language, this would run just fine. But it doesn't due to the fact that default copy constructor does not respect operator= overloading. Is this a reasonable language feature? No.

Sometimes it is not your fault, but C++'s fault, don't forget that and chin up!
Last edited on
Right on, tition. C++ has a C heritage. It's not a brand new language, it started as an improved C.
Hence it "evolved" to where it is now.
By evolving it became more complex: meaning two things 1) you need a C++ encyclopedia like cplusplus.com to be able to use it correctly and 2) it's hard to use it correctly.

So don't lose hope, invest more time. C++ requires more time than other languages, in my personal experience.
But it doesn't due to the fact that default copy constructor does not respect operator= overloading.

This: A object3=object1; is just an alternative syntax for: A object3(object1);
There's no operator= involved, nor should it be. What is supposed to happen anyway, according to you? Call the default constructor and then operator=? Oops, what if there is no default constructor? I don't think you thought this through.
C++ has some unwanted C heritage, but this has nothing to do with it.
I could bash Cantonese for being a bad language because I'm not good at using it, but all I would probably get are some blank stares from passers by and a few idiot-callings. So why is it that when someone tries to bash a computer language it's taken seriously?

-Albatross
This: A object3=object1; is just an alternative syntax for: A object3(object1);


I think it is clear from my post that I understand very well that A object3=object1; is just an alternative syntax for: A object3(object1);.

This was precisely my point: the C++ feature that A object3; object3=object1; is not equivalent to A object3=object1; is semantically inconsistent, and could be avoided in multiple ways. The reason it is *not* avoided, is, I bet a beer on it, backwards compatibility (i.e. the "evolution aspect") of C++.

[Edit:]
@Albatross
C++ is the only programming language besides javascript and python that I take seriously. I am pretty good at arguing that C++ is a horrible language, but I am also pretty good at arguing why C++ also happens to be the best programming language (no, there is no contradiction in the last statement). Also your post seems to imply that I am not good in C++ - I am not saying that such a suggestion is wrong, however if made by a person other than myself, it would need some back-up.
Last edited on
I could bash Cantonese for being a bad language because I'm not good at using it, but all I would probably get are some blank stares from passers by and a few idiot-callings.


I put something in bold for you. That.
Not only are you suggesting that a spoken language (between two people) is "used" like a programming language (between man and machine), but you also think that being "good at using" a programming language magically corrects its design flaws.
Okay, not the reaction I was hoping for.

@tition
I'm sorry, I did not intend to imply that *you* were bad at C++. However, I do theorize that most of the people who bash a language do so due to their difficulties with it resulting from their own limitations, [EDIT] or after witnessing others' difficulties and inferring something from them.

@Catfish
First, are they not at their core both languages, expressible to some degree in the "words" of the other?

Second, I do not think that "being 'good at using' a programming language magically corrects its design flaws". I just think that many of the so-called design flaws are to some degree scapegoats. ;)

-Albatross
Last edited on
is semantically inconsistent, and could be avoided in multiple ways.

Do tell! Although I hope you're not suggesting it to be actually implemented as A object3; object3=object1;

I bet a beer on it

Does that include shipping the beer?
I can say with all confidence that I have made every bonehead mistake you can in this language and more then half the time simply reading the errors from your IDE tells you exactly what's wrong (this took me forever to learn). You should get into this habit as it helps you learn a lot of the terminology as well. I taught myself C++ and started much earlier then I should have, we weren't even covering the kind of logic you need in school yet and this slowed me down quite a bit but I still forced myself to learn it, it is possible.

Does everything in this language make logical sence? No. A prime example is the Reference Operator '&' which in english means "and". Pause so that people can laugh, "Harhar Computergeek01 doesn't know how to use pointers!" but that's not it at all. I did after years of bashing my head into walls, learn what this is for and who ever chose this symbol needs to be punched in the face. The tutorial describes it as
literally translated as "address of"
and I think that's pretty accurate. However, a synonym of "address of" can be "at" now if there was only a symbol on the keyboard, encountered in everyday usage, not currently being used by C or C++ for ANYTHING else that means "at" you would think that would be a better choice then a symbol that means "and". So there are some quarks to get used to but you can eventually do it.

EDIT: I thought that might be enough complaining about pointers since they are what make this such a powerful language but I can't leave out the '*'. This means Multiply, Create A Reference To, Dereference Of and in addition to all of that can also be overloaded.
Last edited on

I bet a beer on it
Does that include shipping the beer?

Nope 'cause I am not sure whether that is actually correct...


Do tell! Although I hope you're not suggesting it to be actually implemented as A object3; object3=object1;

That is exactly what I had in mind: putting the virtual forum boxing gloves aside, what do you have against that suggestion?

[Edit:] Another possible solution would be to overall merge the copy constructor and the operator= (for example: you can't have both defined, and if you have one of them defined, the other is automatically defined for you).
Last edited on
First, are they not at their core both languages, expressible to some degree in the "words" of the other?

I knew you'd go that route. You could go one step further and say "everything is an exchange of information". And then everything is comparable to a programming language.
Programming languages are one-way. You don't converse with the computer, you tell it what to do and sometimes how to do it.

Second, I do not think that "being 'good at using' a programming language magically corrects its design flaws". I just think that many of the so-called design flaws are to some degree scapegoats. ;)

Scapegoats, as in helping those who don't know how to use a programming language criticize it?
Last edited on
Hello,

Thank you all for your comments! These are all good reality checks.
I came to mark the thread solved, but I'll leave it on because I can learn something from every post.
I also want to add that I know pointers. There are many things to learn, but I sort of know the grammar of the language. I also read about UML diagrams and my trouble is not really about writing code. My problem is to write code that is not over complicated -- this would get better with experience.

People that went through the same path, please tell me your stories.

I can't begin to thank you enough; it's so conforting to know that it can be done.
closed account (3hM2Nwbp)
nand wrote:
to write code that is not over complicated


You'll have to learn from your mistakes with that one :P

I've been doing C++ for roughly 4-5 years (the last 2 of which have been freelancing off and on) and I still sometimes find myself writing over-complicated messes. I can almost guarantee that you (or I) won't make the same mistake more than a few times...but the problem is that there are so many different mistakes to make!

The chance of you being a programmer, I'd say 99.9% (The 0.1% being that you lose interest at some point and give up, but I don't think that's going to happen.)

blankly stares at Albatross
Programming languages are one-way.

That's a fair point, but it is not sufficient to change my beliefs, owing to my definition of "language". I'm not asking you to agree with them.

I knew you'd go that route.

No you didn't. C'mon. You don't know me *nearly* well enough to know exactly what I'd do given a situation. ;)

Scapegoats, as in helping those who don't know how to use a programming language criticize it?

For example.

blankly stares at Albatross

...but... I didn't bash Cantonese! *sniff*

-Albatross
Last edited on
Pages: 12