Jump to content



Photo

Getting started FAQ


  • Please log in to reply
68 replies to this topic

#16 code_ninja

code_ninja

    Neowinian

  • Joined: 14-November 08

Posted 09 May 2010 - 00:12

Once you've got the basics of the language down, it's not that difficult to get something graphical up and running in C or C++ on most platforms. In that sense your post seems a little clumsy and gives off a kind of biased vibe.


Exactly.

No, you're not going to just instantly load it up and start dragging and dropping controls to make your own "browser"


But you could use something like ResEdit to design a dialog box.


#17 vetmarkjensen

markjensen

    Linux noob since Red Hat 5.1

  • Joined: 02-October 03
  • Location: Middle Tennessee
  • OS: GNU/Linux
  • Phone: Android and iPhone

Posted 09 May 2010 - 00:45

...
I made that clear when I said C and C++ go hand-to-hand with a course on computer architecture, and that a drawback of C# is that it shields you from the OS.
...

You keep saying that, as if it were a bad thing. Certainly for learning programming, and quite a few applications, there is no advantage to have to deal with things on an OS (or OS-specific) level. A higher-level language may be preferable. I think I disagree strongly to categorizing that as an absolute "negative".

Other than that, I think this is shaping out to be a good thread. (Y)

#18 Xilo

Xilo

    Neowinian Senior

  • Joined: 28-May 04
  • Location: Austin, TX

Posted 09 May 2010 - 00:45

I agree with Dr. Asik. C/C++ is absolutely the worst language to start off with.

1. When you are learning to program, you shouldn't have to worry about the intricacies of pointers/references/etc. Most people that have no knowledge in programming get really frustrated with this.
2. Lets face it, C/C++ are old and a lot of newer techniques and concepts either aren't supported or a huge cludge (classes, lots of stuff in the STL).
3. Anything beyond a console program is difficult. For reference, it takes about 100 lines of code for a basic window. Yes, there are a libraries and such out there, but the Win32 API is not the most elegant code.
4. Lots of things are difficult to do in C/C++ that are fairly easy in higher level languages. GUI, networking, graphics, sound, parsing, threads, etc are fairly difficult without outside libraries.
5. Programming should be fun. If the language is restricting you from what you want to do because of difficulty, most people will quickly become put off.

Why spend hours learning complex API's, memory management, etc when you could spend a fraction of the time to do the same thing while learning to program and have fun doing it?

I do OS programming for a job. This involves C and an extreme amount of memory management and pointers. I wouldn't want any noob to have to mess with that stuff. It's a nightmare sometimes.

#19 code_ninja

code_ninja

    Neowinian

  • Joined: 14-November 08

Posted 09 May 2010 - 01:27

I agree with Dr. Asik. C/C++ is absolutely the worst language to start off with.

For anyone under 15, maybe. C is probably the best language out there for beginners because it teaches you more about how programs run.

3. Anything beyond a console program is difficult. For reference, it takes about 100 lines of code for a basic window. Yes, there are a libraries and such out there, but the Win32 API is not the most elegant code.

res.rc
100 DIALOG 100,80,25,25
STYLE WS_POPUP|WS_VISIBLE
CAPTION "Proof"
FONT "MS Sans Serif"
BEGIN
PUSHBUTTON "How's This?",IDOK,0,0,50,14
END
main.c
#include <windows.h>
BOOL CALLBACK DlgProg ( HWND, UINT, WPARAM, LPARAM);

int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nFunsterStil)
{
DialogBox(GetModuleHandle(NULL),MAKEINTRESOURCE(100),NULL,DlgProc);
return 0;
}

BOOL CALLBACK DlgProg ( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg){
case WM_INITDIALOG:
return 0;
case WM_COMMAND:
switch(wParam){
case IDOK:
EndDialog(hwnd,0);
break;
}break;

default:
return FALSE;
}
}
32 lines. BOOYAH!

Or, just:
#include <windows.h>
int main(int argc, char argv[]){
MessagBox(0,"4 lines","of code",0);
return 0;}
Now that is a basic window. :D

5. Programming should be fun. If the language is restricting you from what you want to do because of difficulty, most people will quickly become put off.

No pain, no gain.

#20 Xilo

Xilo

    Neowinian Senior

  • Joined: 28-May 04
  • Location: Austin, TX

Posted 09 May 2010 - 01:52

For anyone under 15, maybe. C is probably the best language out there for beginners because it teaches you more about how programs run.

I disagree. There's more to programming than memory management. Memory management just gets in the way of learning concepts.

#include <windows.h>
BOOL CALLBACK DlgProg ( HWND, UINT, WPARAM, LPARAM);

int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nFunsterStil)
{
DialogBox(GetModuleHandle(NULL),MAKEINTRESOURCE(100),NULL,DlgProc);
return 0;
}

BOOL CALLBACK DlgProg ( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg){
case WM_INITDIALOG:
return 0;
case WM_COMMAND:
switch(wParam){
case IDOK:
EndDialog(hwnd,0);
break;
}break;

default:
return FALSE;
}
}
32 lines. BOOYAH!

I said a window. As in a program window. As in not a message box. That is also really bad code. No error handling?

No pain, no gain.

If you want to be a masochist and spend more time debugging and working with complex API's than anything else, well more power to you. The rest of us can be productive. :)

#21 code_ninja

code_ninja

    Neowinian

  • Joined: 14-November 08

Posted 09 May 2010 - 02:21

I disagree. There's more to programming than memory management. Memory management just gets in the way of learning concepts.

But it gives the programmer a better understanding of the machine. Which is important.

I said a window. As in a program window. As in not a message box. That is also really bad code. No error handling?

A dialog is a program window.
Bad code? I just whipped up an example.

If you want to be a masochist and spend more time debugging and working with complex API's than anything else, well more power to you. The rest of us can be productive. :)

I'm not a masochist. A masochist is someone who obtains pleasure from receiving punishment.
I meant: "One must be willing to endure some inconvenience or discomfort in order to achieve worthwhile goals."
So there. Stay on topic.

#22 Xilo

Xilo

    Neowinian Senior

  • Joined: 28-May 04
  • Location: Austin, TX

Posted 09 May 2010 - 03:11

But it gives the programmer a better understanding of the machine. Which is important.

A dialog is a program window.
Bad code? I just whipped up an example.

I'm not a masochist. A masochist is someone who obtains pleasure from receiving punishment.
I meant: "One must be willing to endure some inconvenience or discomfort in order to achieve worthwhile goals."
So there. Stay on topic.

Lol, man. The only thing I keep seeing you do on the Programming board with the whole C/C++ vs Others debate is twist people's words and shy away from things that put you in the wrong.

#23 code_ninja

code_ninja

    Neowinian

  • Joined: 14-November 08

Posted 09 May 2010 - 03:42

Lol, man. The only thing I keep seeing you do on the Programming board with the whole C/C++ vs Others debate is twist people's words and shy away from things that put you in the wrong.

What exactly puts me in the wrong?

Programmers can do whatever they like. If he/she chooses to program in a simplified language because they don't want to have to work at it, that's his/her decision.

#24 OP Andre S.

Andre S.

    Asik

  • Tech Issues Solved: 10
  • Joined: 26-October 05

Posted 09 May 2010 - 03:50

You keep saying that, as if it were a bad thing. Certainly for learning programming, and quite a few applications, there is no advantage to have to deal with things on an OS (or OS-specific) level. A higher-level language may be preferable. I think I disagree strongly to categorizing that as an absolute "negative".

I made it quite clear in the original post:

Shields you from the OS (the .NET framework act as an intermediary), a good thing in many ways except for learning how computers work


There. A NUANCED point of view. It could be in the positives or the negatives, it's not clear-cut, I chose one because I'm trying to keep things simple. If I didn't, many people would inevitably point out that you'd better learn with C/C++ because they teach you how to interface with the OS (which is why C and C++ are usually taught for CS degrees). And they would be right, except that C/C++ also have their drawbacks which must be accounted for.

In short I'm not rooting for any particular language in the post; I'm not rooting for high-level vs low-level languages; I'm comparing all approaches in as a few words and examples as possible and give beginners an idea of what to look for and what to expect before their attention span runs out. It's not an introduction to programming and it doesn't try to be that.

It would be more useful if instead of discussing semantics and the speed of .NET programs, you [people on this thread in general] provided suggestions for reference material such as how to get started on Mac (I got nothing on that) or books.

Uhm, I said that you could easily have Windows Presentation Foundation in native C++ (or even C). As in that you could implement the same thing in C++ because it has nothing to do with the programming language, not that you could call the .NET version. Reading comprehension. There's nothing inherent about the language that makes it impossible to have modern APIs.

But... I am in no way implying that it is impossible to implement modern GUIs that are callable from C++. I'm just saying you are going to have a much easier time, as a beginner, making GUIs by going with C# than with C or C++, considering the whole package, language + libraries + IDE. I make it clear when I list what you should be looking for when choosing a programming language. If someone actually gets misled into thinking WPF can't be implemented in C++, which I sincerely doubt can ever happen, the forum is there for that.

:whistle:

dramonai: For anyone under 15, maybe. C is probably the best language out there for beginners because it teaches you more about how programs run.

Xilo: I disagree. There's more to programming than memory management. Memory management just gets in the way of learning concepts.

Please notice that although the post do lean towards Python/C# more than C/C++, it compares both approaches according to their respective advantages and drawbacks and doesn't clearly take a side on the issue. C/C++ are better for teaching Computer Science, C#/Python are better for getting stuff done and having fun doing it. I am aware of this, so please keep this on topic. I am looking for suggestions to improve the OP so that this section can have a helpful "Getting started" FAQ.

Then you're saying that Visual Studio lets you do it, not C#. WPF isn't part of C# (and isn't even available on anything other than Windows.)

But Visual Studio won't let you do it in C++. And from the purpose of a non-programmer I see no purpose in trying to explain the difference between Visual C#, C# and .NET, since in 99% of cases if they take this path they will download Visual C# express and start using the three in combination. Again, if I have to be more precise, this drags on the post and makes it less useful. I link to MSDN which has excellent explanations on what is C#, what is Visual Studio etc., if the reader is interested.

The same goes for Python. Python is not an interactive shell, but 99% chances are you are going to download CPython from python.org and start messing around with the IDLE, and this is a superior learning experience compared to using a build-and-run IDE. Python makes a great learning tool precisly because of that, even though the IDLE is not a language feature. Most argumentations in favor of Python point that out, if you care to look around. (http://www.stanford....on-teaching.htm) Are they misleading? No. Same goes for C# and its related GUI design features.

I spent 2 weeks learning almost everything to do with C. After that. it took me a couple days to get my first fully-authored GUI program done using the Windows API.

I spent a day creating my first VB program, and it was a WinForms Tic-Tac-Toe which you could play against, with three levels of difficulty. You can't really argue that GUIs isn't a strong point of C# and VB, especially compared to C.

Besides I'm not saying C makes it impossible, I'm saying it makes it hard, in the context of a comparison with C# and Python.

Fact: Everything you can do in C# or VB you can do in C.

Sure. Hence I'm recommending C as an excellent first choice. Just because I list some drawbacks doesn't mean it's not a recommendation. I listed drawbacks for all languages.

ALL .NET applications are SLOW.

If startup time is your one and only concern, why not use NGEN? Besides this kind of blanket statement leads me to think you have no idea what you are talking about. .NET applications can be faster than the fastest code C++ compilers can generate in some cases due to run-time optimizations by the JIT. Besides, .NET makes it easier to write fast code. :rolleyes:

#25 Electric Jolt

Electric Jolt

    Lucid Dreamer

  • Joined: 23-July 07
  • Location: United States

Posted 09 May 2010 - 04:05

Unless you have a goal to program low-level code... C# is the way to go, has the best libraries for Windows Phone 7 development which are really sweet developer tools. :)

#26 OP Andre S.

Andre S.

    Asik

  • Tech Issues Solved: 10
  • Joined: 26-October 05

Posted 09 May 2010 - 04:39

3. Anything beyond a console program is difficult.

Even console programs are tough. The fact that people can ramble on for 7 pages about how to wait for user input at program termination is but a trivial example. :laugh:

#27 hdood

hdood

    Neowinian Senior

  • Joined: 25-February 04

Posted 09 May 2010 - 23:17

Even console programs are tough. The fact that people can ramble on for 7 pages about how to wait for user input at program termination is but a trivial example. :laugh:

We had that discussion here as well, didn't we. But then there's also this, so clearly people have problems with the simplest of concepts in all languages.

So hey, what's the .NET way of waiting for any key? Can never know too much trivia.

#28 OP Andre S.

Andre S.

    Asik

  • Tech Issues Solved: 10
  • Joined: 26-October 05

Posted 10 May 2010 - 01:47

We had that discussion here as well, didn't we. But then there's also this, so clearly people have problems with the simplest of concepts in all languages.

So hey, what's the .NET way of waiting for any key? Can never know too much trivia.

What's your point? Find me a 7 pages or more thread about how to wait for any key in a .NET console program, and you'll have made a valid comparison. The problem is not that beginners don't know how to do basic things, it's that even experienced programmers can't provide a simple working solution on which they would all agree.

#29 code_ninja

code_ninja

    Neowinian

  • Joined: 14-November 08

Posted 10 May 2010 - 04:10

The problem is not that beginners don't know how to do basic things, it's that even experienced programmers can't provide a simple working solution on which they would all agree.

Beginners don't know how to do anything anyway. And I don't think it matters how they go about it as long as the result is what they wanted. Don't you agree?

#30 OP Andre S.

Andre S.

    Asik

  • Tech Issues Solved: 10
  • Joined: 26-October 05

Posted 10 May 2010 - 05:09

Beginners don't know how to do anything anyway. And I don't think it matters how they go about it as long as the result is what they wanted. Don't you agree?

I'm not sure I understand what you mean and I don't see the connection with what you quoted. In any case I don't want to get lost in debates about which language or approach is better. I'd rather like to know if you [or anyone else] feel a particular proposition of the OP could be formulated better, if the layout is good, if you have any useful links to add, etc., and whether you think that in its current form (I've edited it heavily since I originally posted it) it is appropriate to be pinned, because the few pinned topics we currently have aren't too useful in general.



Click here to login or here to register to remove this ad, it's free!