It is currently Mon Oct 23, 2017 1:11 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 58 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
PostPosted: Mon Jun 05, 2017 7:12 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19116
Location: NE Indiana, USA (NTSC)
Marscaleb wrote:
I was at a bookstore and I started looking through big textbooks on C++, and you know what they teach you in the first chapter? The "Hello World" supersize, output through cout.
A book on C++ that was printed this year, and the first thing they try to teach you is how to output to the console.

The tutorials use standard output because using Win32 will fail if you're using the book in any environment other than Microsoft Windows. There will be no windows.h at compile time, and even if you copy windows.h from MinGW, there will be linker errors at link time. To see what a Windows tutorial in (say) Xcode would feel like, try running through a Cocoa tutorial in your copy of Visual Studio.

Marscaleb wrote:
You know, that thing that hasn't been part of the operating system for the last TWENTY F***ING YEARS, and they are STILL trying to start off with that.

Which PC operating system, other than Windows 10 S, lacks a command prompt?


Top
 Profile  
 
PostPosted: Mon Jun 05, 2017 10:11 am 
Offline
User avatar

Joined: Wed Sep 21, 2016 8:55 am
Posts: 54
Location: Calgary.Alberta,Canada
dougeff wrote:
I've been using Visual Studio lately, and you can write and run command prompt programs INSIDE the IDE. That is to say, I don't have to open a terminal and navigate. I suspect you can with other IDEs as well.


I was going to mention this also as I use Visual Studio.


Top
 Profile  
 
PostPosted: Mon Jun 05, 2017 11:09 am 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5734
Location: Canada
Marscaleb wrote:
A book on C++ that was printed this year, and the first thing they try to teach you is how to output to the console.

The reason they do that is that the console is one of the few input/output method that's actually part of the C++ standard.

If they try to do anything GUI, it'll get platform specific, or require specific libraries and understanding how to set that up, etc. That's like 10 extra lessons all at once, maybe not desirable for a "Hello World"?

As others mentioned, if you actually build and run that code in a C++ IDE it will probably open a command window for you to see. Though, I don't personally think C++ IDEs are a very good learning environment. Aside from learning the language itself, understanding compilers and how the code gets built is a whole layer of complicated stuff on top. You might be okay just trying the default templates IDEs usually offer, but it'll probably take a while before you feel like you know all the parts involved in just building the code.


Actually, something like C# or maybe Visual Basic might be a good place to start for learning GUI stuff. Very Windows specific, but it has pretty good tools and IDE for it, and especially with C# many of the Windows interfaces are analogous to something similar in C++.


For learning programming in general, I think the Python environment is pretty good. It comes with a very simple "IDE" that is very command-line centric, but there's no complicated build process, you just write your file and run it, or even just type immediate-mode code into the console and see it run.


Top
 Profile  
 
PostPosted: Mon Jun 05, 2017 11:12 am 
Offline
User avatar

Joined: Fri Nov 19, 2004 7:35 pm
Posts: 3944
Unfortunately it seems like Javascript + DOM is the new qbasic. Such a horrible language and ill-designed API.

_________________
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!


Top
 Profile  
 
PostPosted: Mon Jun 05, 2017 11:33 am 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10067
Location: Rio de Janeiro - Brazil
Dwedit wrote:
Unfortunately it seems like Javascript + DOM is the new qbasic. Such a horrible language and ill-designed API.

You can't argue with how easy it is to setup a JavaScript development environment... Everyone already has a web browser and a text editor, even if they've never written a line of code in their lives. I personally like JavaScript, and a lot of my development tools are written in that language.


Top
 Profile  
 
PostPosted: Mon Jun 05, 2017 12:28 pm 
Offline
User avatar

Joined: Thu Mar 31, 2016 11:15 am
Posts: 200
If you're new to C++ just use one of the online IDEs. I prefer coliru: http://coliru.stacked-crooked.com/


Top
 Profile  
 
PostPosted: Mon Jun 05, 2017 12:40 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19116
Location: NE Indiana, USA (NTSC)
tokumaru wrote:
You can't argue with how easy it is to setup a JavaScript development environment... Everyone already has a web browser and a text editor

An iPad with a keyboard cover has the Safari web browser, but does it have a text editor whose output can be displayed in Safari?

tokumaru wrote:
I personally like JavaScript

I have discovered that a lot of people on a well-known tech forum disagree with you. Many who replied to the story "Chrome To Deprecate PNaCl, Embrace New WebAssembly Standard" are anti-JavaScript hardliners. They don't want to automatically download and run others' unvetted computer programs and thereby expose an attack surface associated with a potentially exploitably defective JavaScript interpreter. They believe HTML documents ought to be no more interactive than CSS hover/checkbox-hack menus and form submission, and rich applications ought to be native, written with a cross-platform GUI library such as Qt, and distributed as source code under a free software license so that the end user can recompile the program on his own computer on which he has installed the needed compiler and libraries.


Top
 Profile  
 
PostPosted: Mon Jun 05, 2017 6:59 pm 
Offline
User avatar

Joined: Fri Sep 11, 2015 10:39 am
Posts: 106
Okay, I phrased it wrong.
Yes, it's a console, which does "exist" in the Windows OS, and in that sense it "is a part of" modern operating systems, but it still is something in the back-end, something that relatively few people even know about, and even those of us who do know about it, don't use it. Oh sure, I use it when I'm debugging my network or something like that, but it still remains as something almost never used. The whole operating system is built around using a different set of interfaces.

And yes, I personally know how to use the command prompt. I grew up using DOS. And I know how to actually write code. But it still pisses me off that instructions that claim to be for "beginners" are in no way for beginners, that half of the instructions out there are ones that I can only follow because I already know this stuff. Nearly every programming tutorial and lesson out there is badly designed.

Several of you mentioned things about using other operating systems, like Linux. That still doesn't hold water. If someone was really and honestly starting with programming, from a true beginner or layman perspective, do you honestly believe they will be running a Linux system?
I'd like to remind you that most of the people contributing to this conversation know how to program in assembly. You really do not represent people who are "new to programming."

You could make the argument about MacOS, yes. And that would bring the total list of operating systems people might reasonably be trying to use to a grand total of: two.

rainwarrior wrote:
The reason they do that is that the console is one of the few input/output method that's actually part of the C++ standard.

If they try to do anything GUI, it'll get platform specific, or require specific libraries and understanding how to set that up, etc. That's like 10 extra lessons all at once, maybe not desirable for a "Hello World"?


I strongly disagree with that.
If we are talking about someone who is absolutely new to programming, I would say the first thing they need to produce is something they can recognize, something that is familiar to them so that they can actually so something they have done and feel like it really had an effect. And more to the core of things, something that looks like what they want to create.
New programmers in the year 2017 don't want to create DOS applications. They want to create programs for the system they are actually using. And let's be honest, that's going to be Windows.

A far more effective "Hello World" example would be a program that just pops up a small dialogue box that says "Hello world" (and then they can close the box.) Yes, it would require adding in a little extra code that the student won't understand right away, but it would produce something that honestly feels like it has value. Right away they can say "hey, look at this thing I made!" And it is not buried in some forgotten part of the operating system they never knew existed. It isn't running inside an additional program. It is an actual windows program that just barely starts to look like the very kind of program they want to create.

And then in the next step you can go back and show them what these various parts of their program do. You can show them that they can change the size of the window by changing these numbers, you can make the window be re-sizable by doing this, and so forth.
And it is situations like that that are going to fill the beginners with amazement as they see what they created actually has an effect in the very form and world that they are familiar with, as their efforts manifest in the very world they wanted to create within.

And THAT is what has been missing from programming lessons for the last twenty years. That is why people think "I want to make video games!" and then give up and drop out of their first class. These students don't get to build anything that they feel has meaning. They are taught how to do things they don't feel have purpose. And when right off the bat, you are trying to teach these kids to make programs that interface with a text-based console they probably didn't even know existed, then yes, you are failing in your teaching.


Top
 Profile  
 
PostPosted: Mon Jun 05, 2017 7:23 pm 
Offline
User avatar

Joined: Fri Sep 11, 2015 10:39 am
Posts: 106
Imagine trying to learn carpentry, and all the schools just spend the first year having you never do more than nail two pieces of wood together. Never actually build something, like a birdhouse whatnot, just spend all your time learning the various ways to nail wood together, only teaching the fundamental tools of how to nail wood pieces. Certainly teaching you the difference between nailing pieces of these different sizes or angles and whatnot, and what nails you need to use for these different sizes and for different ways to connect two pieces of wood. But never actually have you build something you recognize.

Imagine all the books on carpentry do nothing but tell you how to use a hammer. Imagine trying to build a house using such books. None of these books tell you how lay out a foundation, what sort of framing methods you need for your walls, how to run electrical wire or how to mud and sand your gypsum board. They just teach you how to use a hammer.

All the classes I paid money to attend never taught me how to create something useful or recognizable.
Nearly every single book on programming doesn't actually tell you how to actually make a program, just how to write the code. Chapters on end about the different types of variables and loops and functions, but nothing much about how you would actually want to use them.


Top
 Profile  
 
PostPosted: Mon Jun 05, 2017 7:38 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19116
Location: NE Indiana, USA (NTSC)
Marscaleb wrote:
You could make the argument about MacOS, yes. And that would bring the total list of operating systems people might reasonably be trying to use to a grand total of: two.

I still don't find it reasonable to expect the owner of a MacBook or iMac to buy a Windows license to run in a VM, along with buying a few extra GB per month of Internet data transfer allowance from the ISP to keep it updated, just to follow a tutorial.

Marscaleb wrote:
Imagine trying to learn carpentry, and all the schools just spend the first year having you never do more than nail two pieces of wood together.

Imagine trying to learn carpentry, and all the tutorials are for one company's proprietary set of tools.


Top
 Profile  
 
PostPosted: Mon Jun 05, 2017 8:27 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5734
Location: Canada
Marscaleb wrote:
rainwarrior wrote:
The reason they do that is that the console is one of the few input/output method that's actually part of the C++ standard.

I strongly disagree with that.
(list of complaints, etc.)

I was merely offering an explanation as to why a book on C++ doesn't start with "how to program Windows". C++ doesn't come with a GUI API. Quite frankly, the user interface method that you use for learning is an almost trivial thing compared to everything else involved in learning C++. If you really want to know how to program Windows GUI that is a specialized topic of its own, and it's not really limited to C++ either.

If your complaint is that the "beginner C++" book you found is not a "beginner C++ for windows" book, well, look for the latter, or write a letter to the author that you think they've written the wrong book, I suppose.

You could also try Microsoft's own tutorial on that topic: Learn to Program for Windows in C++

I also suggested two other platforms besides C++ (C# and Visual Basic) which are much better suited for learning Windows GUI programming, IMO. Others have suggested Javascript, and there's also things like Unity where the baseline environment is already immersed in a game framework, and that's a pretty good place to learn too, especially if that's what you want to make.

There's also plenty of books on game programming in C++, too, if it's specifically the C++ language you want to learn.

Marscaleb wrote:
Yes, it's a console, which does "exist" in the Windows OS, and in that sense it "is a part of" modern operating systems, but it still is something in the back-end, something that relatively few people even know about, and even those of us who do know about it, don't use it.

Most people don't write C++ code either. I don't know why you think that a programmer's set of tools should be the same as the end-user's experience, but it's really not. Most people who write C++ code also use consoles and command lines. These things are ubiquitously part of a modern professional programmer's tools, and an education in programming really does require it, sooner or later. Maybe you want to get right into building windows, and that's fine, but the console really is a fine teaching area for programming fundamentals, and it's very relevant to more advanced programming work as well.


Top
 Profile  
 
PostPosted: Mon Jun 05, 2017 8:33 pm 
Offline
User avatar

Joined: Mon Apr 04, 2011 11:49 am
Posts: 1905
Location: WhereverIparkIt, USA
I knew nothing about programming until I was ~20 years of age. First learned from an online class that equated to just following along in a very basic text book for C without any real interaction with an instructor. I do recall it being a significant pain to get a free C compiler up and running that I had to find myself. But getting a hello world up and running on the command prompt of windows (XP at that time), was far from a challenge though. I worked through the entire class/book with the command prompt. I had an aversion to the command prompt until I that time. But now I strongly prefer it and still always start programs from the command prompt. I would be of the camp that the command prompt/terminal is a good place to start learning vs a GUI.

Everyone's different, and what might not be your idea of the best way to learn or start may not be for someone else. That doesn't mean ways that work well for other people, but not you are as terrible as you're making them out to be.

Quote:
Nearly every single book on programming doesn't actually tell you how to actually make a program, just how to write the code.
Starter books sure, you have to learn to read and write in english before you can write a novel in english. The first stories you write as a child when first learning to read and write won't compare to one you would write with years of experience of writing. IMO programming is very similar to writing in this sense, you're not just going to find some book that tells you how to write great novels. It's something that you work up to with experience on lesser works. When you're struggling with a specific problem, you go research that specific issue perhaps using books/articles/tutorials targeted to that topic.

_________________
If you're gonna play the Game Boy, you gotta learn to play it right. -Kenny Rogers


Top
 Profile  
 
PostPosted: Mon Jun 05, 2017 8:44 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5734
Location: Canada
Maybe to answer the original question as well, the best online forum for learning programming skills is probably Top Coder:
https://www.topcoder.com/

I used to use this while I was in school. It's not really a "beginner C++ tutorial" kind of place, but more of a practice ground where they give interesting but small problems and you can try to write programs to solve them, and also importantly, you can view others' solutions to the problem and learn by example.

Writing small programs is good practice, but reading others' code is a very effective way to learn too. I recommend doing both. Top Coder competitions are a nice way to do that, but really you can take any small-scale program you're interested in that happens to be open source and crack it open, learn to build it, try to modify it, figure out how it works.

That's part of why I make a lot of my programs open source. For example, here's a mario paint music editor I wrote a while back. It's only a few thousand lines of code and might be approachable by a beginner or intermediate code reader:
http://rainwarrior.ca/projects/nes/mariopants.html


Top
 Profile  
 
PostPosted: Mon Jun 05, 2017 9:59 pm 
Offline
User avatar

Joined: Wed Sep 21, 2016 8:55 am
Posts: 54
Location: Calgary.Alberta,Canada
I agree with rainwarrior,studying other programmers source code will increase your knowledge/understanding a great deal.The only problem is when your a beginner you have no idea if the code is good or not.Another programmer wrote"below"and I agree with him.


Beginner Code - Easy to read/understand,doesn't understand how to accomplish most tasks
Intermediate Code - Difficult to follow,massive amount of code to accomplish a simple task,overly complicates everything and confuses the sh** out of everyone trying to explain it.
Advanced Code - Easy to read/understand,compact coding,minimal code to accomplish a simple task,able to simplify and explain in detail


Top
 Profile  
 
PostPosted: Tue Jun 06, 2017 12:03 am 
Offline
User avatar

Joined: Thu Sep 15, 2016 6:29 am
Posts: 253
Location: Denmark (PAL)
Marscaleb wrote:
Imagine trying to learn carpentry, and all the schools just spend the first year having you never do more than nail two pieces of wood together. Never actually build something, like a birdhouse whatnot, just spend all your time learning the various ways to nail wood together, only teaching the fundamental tools of how to nail wood pieces. Certainly teaching you the difference between nailing pieces of these different sizes or angles and whatnot, and what nails you need to use for these different sizes and for different ways to connect two pieces of wood. But never actually have you build something you recognize.


Imagine trying to learn carpentry and they just immediately wanted you to build a house but you had no idea how to nail two pieces of wood together. Building a house isn't just about getting enough wood, you need an architect to actually design your house.
You want programming exercises for "beginners", but you want guides on how to make something advanced, it's an oxymoron.

Here's the lowdown on programming though - NO ONE knows how to build YOUR program. If they did, there would be no need for you to do it. You learn how to nail enough different pieces of wood together until you feel like you can build the thing you want.

If you want an example of how to build a complete program, there are -plenty- of great tutorials out there for any kind of programming language or framework you want.
The thing is, once you're dealing with graphical user interfaces, it's not just a tutorial for that programming language anymore, but will need to involve some sort of framework, or most likely a bunch of them.

First: Learn to nail wood pieces together (for example: C# or C++)
Then: Choose a framework and follow some tutorials for building your "house" (for example: MonoGame or SFML)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 58 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 10 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

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group