ClanKiller.com https://forums.clankiller.com/ |
|
n44b question https://forums.clankiller.com/viewtopic.php?f=24&t=2162 |
Page 1 of 2 |
Author: | Rinox [ Sun Jan 14, 2007 8:17 am ] |
Post subject: | n44b question |
Author: | RB [ Sun Jan 14, 2007 8:48 am ] |
Post subject: | |
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. 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 . And if you are still in doubt whether C++ is for you or not, you might like to see too. Huh... this isn't topic for me. |
Author: | Arathorn [ Sun Jan 14, 2007 9:43 am ] |
Post subject: | |
You can teach yourself Visual Basic very easily. Even I can code that. |
Author: | Pig [ Sun Jan 14, 2007 1:30 pm ] |
Post subject: | |
Author: | Satis [ Sun Jan 14, 2007 2:38 pm ] |
Post subject: | |
Author: | RB [ Sun Jan 14, 2007 3:03 pm ] |
Post subject: | |
Author: | Arathorn [ Sun Jan 14, 2007 3:40 pm ] |
Post subject: | |
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. |
Author: | Satis [ Sun Jan 14, 2007 6:05 pm ] |
Post subject: | |
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. |
Author: | RB [ Mon Jan 15, 2007 12:27 am ] |
Post subject: | |
Author: | Satis [ Mon Jan 15, 2007 7:42 am ] |
Post subject: | |
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. |
Author: | RB [ Mon Jan 15, 2007 8:53 am ] |
Post subject: | |
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. |
Author: | Satis [ Mon Jan 15, 2007 10:08 am ] |
Post subject: | |
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. |
Author: | Rinox [ Tue Jan 16, 2007 5:17 pm ] |
Post subject: | |
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 ) web applications to start with, so C++ is very probably totally redundant. Thanks again. If I get around to it, which I will, just not sure when, I'll be sure to harass you guys. |
Author: | Satis [ Wed Jan 17, 2007 7:19 am ] |
Post subject: | |
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/ |
Author: | Pig [ Wed Jan 17, 2007 9:57 am ] |
Post subject: | |
Or for the ultra n00b, there's |
Page 1 of 2 | All times are UTC - 6 hours |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |