It is currently Thu Mar 28, 2024 5:13 pm



Reply to topic  [ 22 posts ]  Go to page 1, 2  Next
n44b question 
Author Message
Minor Diety
User avatar

Joined: Mon Mar 31, 2003 7:23 am
Posts: 14878
Location: behind a good glass of Duvel
Reply with quote
Post n44b question
In view of my ambitions to teach myself programming shit...would it be doable and/or advisable to immediately start off with C++? Or brain suicide? :P

_________________
"I find a Burger Tank in this place? I'm-a be a one-man cheeseburger apocalypse."

- Coach


Sun Jan 14, 2007 8:17 am
Profile
Emperor
User avatar

Joined: Wed Apr 16, 2003 1:25 am
Posts: 2560
Reply with quote
Post 
Whatever you do, you need to state what is your goal: what do you intend to do.

If you go for web programming, C++ will be a redundant overkill. If you want to do stuff close to kernel/OS programming or maybe solve the problems that need both efficiency and abstraction C/C++ are the right things to consider.

GUI in ISO C/C++ can be platform and compiler dependent and isn't as gentle as in .NET - in .NET you have C++ too but there you might like to try out C# or VB instead. At end, if you prefer not to be bound to Microsoft, yet to make it easier way, you will definetely like to try out Java. You will sacrifice some of performances but you will do the job easier way.

If you insist, you can start with C++, but there you will like to practice the basis characteristic for C too before you start with OOP.
And if you are still in doubt whether C++ is for you or not, you might like to see this page too.

Huh... this isn't topic for me.

_________________
++


Last edited by RB on Sun Jan 14, 2007 1:19 pm, edited 3 times in total.



Sun Jan 14, 2007 8:48 am
Profile WWW
Minor Diety
User avatar

Joined: Tue Apr 01, 2003 10:23 am
Posts: 3956
Location: Amsterdam
Reply with quote
Post 
You can teach yourself Visual Basic very easily. Even I can code that.

_________________
Melchett: As private parts to the gods are we: they play with us for their sport!


Sun Jan 14, 2007 9:43 am
Profile
Duke
User avatar

Joined: Mon Mar 31, 2003 8:59 am
Posts: 1358
Location: right behind you
Reply with quote
Post 
c++ is hardcore strict programming. I wouldn't suggest it to anyone as a first language. Besides being complex, c++ is not designed to be easy to use. Many aspects are designed around how people use them 10-20% of the time, and are a fucking pain in the ass the other 80-90%.

Visual Basic is the most retarded of languages I have ever used. I would rather give myself anal papercuts than code VB again. Coding PHP is like taking too much exlax. The shit just flows. Coding VB is like the worst constipation you have ever had. If you produce something, there's going to be some blood involved. I would avoid MS technologies at all cost. They consistently code shit to make it easier for them to build, instead of the programmers that have to use them. It's like when you are in a higher level math class, and there's always 1 or 2 students that are obviously out of their league and they have no hope of making it through the class. And years later you wonder what happened to them. I'll tell you, they went on to write programming languages for MS.

A major factor in what language you learn first, is what are you planning on doing long term? Are you planning on writing desktop applications for windows? Are you planning on writing software for the web? If you are planning on working with the web, then there's no point in learning C++, other than as an exercise. PHP is the best web programming language, IMO, in terms of how easy it is to pickup, how easy it is for to use, and the robustness of the language. In some mis-informed circles, PHP has a bad rep because a lot of bad code has been written in it. This is not because the language is bad, but because it is so easy to learn, that newbs end up jumping right in without understanding how to code securely, etc.

If you are planning on building desktops apps, I would go with Java over C++. Java is not a particularly easy language, but it's better than C++ (IMO), and has some really cool features that will make life easier as you get more advanced.


Sun Jan 14, 2007 1:30 pm
Profile YIM WWW
Felix Rex
User avatar

Joined: Fri Mar 28, 2003 6:01 pm
Posts: 16646
Location: On a slope
Reply with quote
Post 
to be redundant (mainly), what language to learn is dependent on your goal. Learning a language just to learn a language is unrealistic, especially for a first language. There's alot to learn and you'll just give up if you have no reason to continue.

To be more specific, I think c++ is a bad idea to start with. That's a hard ass language. Not so much because the syntax is that screwed up, but because of how extremely strong-typed it is and the lack of good resources.

If you're looking at web programming, PHP all the way. That makes a great starting language because you don't have to jump right into OO and shit. There's no real typing to worry about, the online resources are excellent (php.net rocks), and you have Pig, Gfree and myself to ask questions to. A major selling point to me is the fact you can write code without having to learn OO or even how to write your own functions... so you can just write crap code until you get a good grasp of the basics, then move to functions, and then the jump from functions to OO isn't really all that hard.

If you're looking at desktop programming for Windows, I'd probably recommend getting Visual Studio and programming in c#. With VS you have to worry less about code...all the basic crap is done for you. And even though it's all OO, you don't necessarily have to understand OO to make something useful with it.

I'll agree with Pig, though...stay away from VB. I'm rewriting my company's support website, and that thing is written entirely in VB. Every once in awhile I'll have to either fix something on the production site or figure out how it was done so I can recode it into c#...and omg...VB is such a piece of shit. Just don't screw yourself up with it...stay away.

_________________
They who can give up essential liberty to obtain a little temporary safety, deserve neither liberty nor safety.


Sun Jan 14, 2007 2:38 pm
Profile WWW
Emperor
User avatar

Joined: Wed Apr 16, 2003 1:25 am
Posts: 2560
Reply with quote
Post 
Pig and Satis give you good points.

Yet -
Satis wrote:
C++ ... extremely strong-typed

Come on, C++ is one of rare exemplars where you can write
Code:
int sgn(double x)
{ return x<0?-1:!!x;}

And get what you expect. ;) Not to mention
Code:
  operator double() const
  { //...

which means absolute control on what "implicitly" happens.

Although I agree C++ may be not for someone who does not know why he is learning it, I cannot but note that Java is so much much more strict and clumsy than C++ about types and types conversions. (but therewith more secure and predictable as well)

Personally I prefer C++ over Java for many comforts of free expression and abstraction it has to offer; But as well I agree that someone who starts from scratch would find himself so damn much more comfortable with Java or C#. :)

_________________
++


Sun Jan 14, 2007 3:03 pm
Profile WWW
Minor Diety
User avatar

Joined: Tue Apr 01, 2003 10:23 am
Posts: 3956
Location: Amsterdam
Reply with quote
Post 
Off course I'm not a programmer, but form an end-user's view I can say Java sucks. Every Java program I've ever used eats memory for breakfast and lunch.

_________________
Melchett: As private parts to the gods are we: they play with us for their sport!


Sun Jan 14, 2007 3:40 pm
Profile
Felix Rex
User avatar

Joined: Fri Mar 28, 2003 6:01 pm
Posts: 16646
Location: On a slope
Reply with quote
Post 
Java has some issues, I'll give you that. Some problems are inherent...the language is cross-platform compatible...basically you kinda precompile the thing, then distribute it...when a user wants to run it, the final compile runs on their machine, whcih converst it into something useable by their platform. That's how a Java applet works just as well on Solaris, Red Hat, Windows and Mac.

However, the negative effect is every time you run a java applet, you're basically compiling it (sorta) which makes loading times retarded. So you give up quick loading for cross platform compatibility.

Some other issues I've seen with Java are things like memory usage (which is supposed to be handled automatically, AFAIK) and what seems like some crashingness. Having never really programmed in it, though, I can't say whether some of the negatives I've noticed are due just to bad programming. I mean, I've seen some REALLY bad PHP, but that doesn't make PHP bad.

As for C++...let's just say that when I was trying to learn it, I would spend hours/days trying to figure out easy crap. Like using one of the built-in functions (or part of the standard library, whatever) that expects a char input and I'm trying to push in a string... and it took me forever to figure out to just use .tochar() (or something like that, I forget again).

Why? Why not just overload the standard library function to allow string input? It's not hard. I do overloading of methods regularly in c# as just part of my web development...it's really not that hard. But it's little simple crap like that which really annoys me.

Some other stuff... memory allocation. I hate having to specify the size of a memory buffer every time I create a variable. c# still has that problem when it comes to arrays.

Let's say I'm trying to stuff a sql query result set into an array. In php, I would run the query, then read it (probably using foreach() and just push it into the array. Boom, done, very few lines of code.

[php]
<?
$select = 'SELECT one, two three FROM table';
$result = $this->doquery($select);
/*
I usually put the actually query execution in a separate method...
makes switching DBs / DB Types alot easier
*/
foreach($result as $row){ //exact syntax is a bit different, I forget
$array[]['one'] = $row['one'];
$array[]['two'] = $row['two'];
$array[]['three'] = $row['three'];
}
print_r($array);
?>
[/php]

however, in c# you can't do that. I don't have my IDE here, so the following is pseudo-c#

[php]<%
string select = 'SELECT count(*) FROM table'; //get the number of results
doquery(select);
/*
I use oledbdatareader objects to pull the data and store the result set to a class property
*/
dr.Read();
int numrows = Convert.ToInt16(dr.GetValue(0))
string[,] myarray = new array[numrows,3];
select = 'SELECT one, two three FROM table'; //get the actual results
doquery(select);
dr.Read();
for(int i=0; i<numrows; i++){
myarray[i,0] = Convert.ToString(dr.GetValue(0));
myarray[i,1] = Convert.ToString(dr.GetValue(1));
myarray[i,2] = Convert.ToString(dr.GetValue(2));
dr.Read();
}
foreach(string row in myarray){
Response.Write(row[0]) + "<br>";
Response.Write(row[1]) + "<br>";
Response.Write(row[2]) + "<br>";
}
%>[/php]

Now, I may not be doing this as well as I could be, but the point is that c# is significantly more taxing on the programmer than PHP is. PHP automatically figures out the type of the array (and allows mixing of types), which in c# you have to specify it...and woe unto he who tries to stuff the wrong type into the array. PHP also allows you to dynamically size the array as needed...in c# you have to specify it manually. And finally, in PHP you can get a num_rows easily from a query. In c#, you can't get the number of rows returned from an OleDBDataReader object. Though you can get the number of fields returned. :)

Bleh...anyway, maybe I'm spoiled.

_________________
They who can give up essential liberty to obtain a little temporary safety, deserve neither liberty nor safety.


Sun Jan 14, 2007 6:05 pm
Profile WWW
Emperor
User avatar

Joined: Wed Apr 16, 2003 1:25 am
Posts: 2560
Reply with quote
Post 
Dammit I hate that PHP-tag issue.

Satis wrote:
Some other stuff... memory allocation. I hate having to specify the size of a memory buffer every time I create a variable.

Have you heard for vector template and stuff? I bet in C++ you can make environment that will be equally pleasant to you as PHP, from the coding side. There you can make PHP at all...

I didn't get the story about PHP. There is provided ability of indexing value by some object instead by the number in C++ and Java (assuming in C# too), and if something looks redundant to you, you can put it into a new function and therewith make it as short as it is in PHP or even shorter.

And YES. Applet does not compile. It interprets on your computer, using Java VM for your platform. Basically applet is written in one language BUT each platform has its interpreter for it. You cannot use JRE for MS on MAC.

One thing that C and C++ have, and most of other languages not, are functions which have ability to take non-constant number of any sort arguments. This is achieved by so called ellipses (...). They make function accept as many arguments as we would like to send, and these arguments can be of type we want them to be. That is the way well known printf and scanf work.
Code:
void f(int n,...);
void f1(const char*,...);

Still with us, Rinox?

-----------------------------
Now, let me look over your code, Sat, without discussing its validity.
Code:
dr.Read();
int numrows = Convert.ToInt16(dr.GetValue(0));
string[,] myarray = new array[numrows,3];
doquery(select = 'SELECT one, two three FROM table');
for(int i=0; i<numrows; i++){
  dr.Read();
  for(int j=0;j<3;j++)
    myarray[i,j] = Convert.ToString(dr.GetValue(j));
}

-----------------------------

_________________
++


Mon Jan 15, 2007 12:27 am
Profile WWW
Felix Rex
User avatar

Joined: Fri Mar 28, 2003 6:01 pm
Posts: 16646
Location: On a slope
Reply with quote
Post 
ok, good point, your code is cleaner. A few things....

As far as I can tell, in c# you can only use index numbers to reference values in an array. ie, it's all array[0], array[1], etc, not array['myfavorite'] like you can do in PHP...which really really sucks. I may be wrong, but if you can do it I certainly haven't figured out how.

Similarly, with oledbdatareader objects, you can't reference a field in your result set by name. Same deal...dr.GetValue(0), dr.GetValue(1), etc...that also really sucks. It means I really have to pay close attention to my select statements and if I make a change to the number or order of queried fields, I have to change all references accordingly. That's not necessary in PHP.

A strength, as you mentioned, is that I can always make little helper functions. Plus, to be honest, the numbers of functions available to c# is incredible. C# is only Windows compatible (I think...maybe there's an apache mod by now), but its file functions kick the crap out of PHP.

Anyway...I was just kinda griping about the crap I hate about C#. There's also crap I hate about PHP. And Javascript. And I reverse-engineered a Perl script and, even though I only had to figure out about 20 lines of code, there's definetely some crap I don't like about it, either. :)

_________________
They who can give up essential liberty to obtain a little temporary safety, deserve neither liberty nor safety.


Mon Jan 15, 2007 7:42 am
Profile WWW
Emperor
User avatar

Joined: Wed Apr 16, 2003 1:25 am
Posts: 2560
Reply with quote
Post 
If C# supports generics (and supports them as far as I know) there should be some template that allows you to index elements by other objects. In Java is one HashMap, in C++ is one map. Of course they can't do that with pure arrays but there are other data-structures made for that.

Whatever... if it does not have it, you can make it.

_________________
++


Last edited by RB on Mon Jan 15, 2007 10:09 am, edited 1 time in total.



Mon Jan 15, 2007 8:53 am
Profile WWW
Felix Rex
User avatar

Joined: Fri Mar 28, 2003 6:01 pm
Posts: 16646
Location: On a slope
Reply with quote
Post 
hmmm...perhaps my lack of any formal programming courses is hindering me in some ways. But perhaps not. I've seen some of the stuff the programmers at my work have put out... we had a web-based product written in ASP that was total and absolute crap. They actually passed user authentication information in GET variables... so anyone with the slightest bit of knowledge could easily hack their way to administrative level access. And that's just the most obvious example of poor coding.

Anyway, bleh, I'm honestly not trying to slam c# or c++... they're just alot more strict then PHP or javascript are, imo.

_________________
They who can give up essential liberty to obtain a little temporary safety, deserve neither liberty nor safety.


Mon Jan 15, 2007 10:08 am
Profile WWW
Minor Diety
User avatar

Joined: Mon Mar 31, 2003 7:23 am
Posts: 14878
Location: behind a good glass of Duvel
Reply with quote
Post 
Let me interrupt your little programming spat by saying 'thank you' for the input to all of you crackheads. I guess I'll be hitting PHP then for now. :)

My goals aren't really well-defined, I just want to get a language in my fingers to start with. So I guess that I'd be busy with 'building' (a big word for a n00b like me :P ) web applications to start with, so C++ is very probably totally redundant. :P

Thanks again. If I get around to it, which I will, just not sure when, I'll be sure to harass you guys.

_________________
"I find a Burger Tank in this place? I'm-a be a one-man cheeseburger apocalypse."

- Coach


Tue Jan 16, 2007 5:17 pm
Profile
Felix Rex
User avatar

Joined: Fri Mar 28, 2003 6:01 pm
Posts: 16646
Location: On a slope
Reply with quote
Post 
I have a tutorial on how to set up a PHP/MySQL development environment on Windows. Check it out....the installation process can be very...frustrating... if you don't know what you're doing.

http://clankiller.com/technical/programming/PHP/

_________________
They who can give up essential liberty to obtain a little temporary safety, deserve neither liberty nor safety.


Wed Jan 17, 2007 7:19 am
Profile WWW
Duke
User avatar

Joined: Mon Mar 31, 2003 8:59 am
Posts: 1358
Location: right behind you
Reply with quote
Post 
Or for the ultra n00b, there's WAMP


Wed Jan 17, 2007 9:57 am
Profile YIM WWW
Display posts from previous:  Sort by  
Reply to topic   [ 22 posts ]  Go to page 1, 2  Next

Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware.