Confused Beginner

Started by
7 comments, last by Telastyn 12 years, 4 months ago
Hey. I am a beginner with little experience in C++ and a few other languages. I've started reading a book (C++ Primer Plus 5th ed.), and hopefully I am done with it soon enough, since I am very eager to learn GUI/API-programming. But I am very confused about which resource would be the most helpful for this kind of programming. I've looked into books, but as far as I've understood, the most popular book by Charles Petzold, Programming Windows, is written with C in mind? Is this a major drawback when I got no experience with C and only C++?

And would such a book as Programming WIndows be wise to read before starting anything like Direct3D or OpenGL-programming?

A bit off-topic, but we are soon to write a program for our examination. Would an huffman-coder be anywhere near possible at a beginner's level? I'm thinking of something that could code/compress data and reconstruct it later on, not necessarily GUI-based.

Maybe I'm overthinking, but would be nice to have a plan to follow to keep the motivation up ;)

Regards,
Boooke
Advertisement
> But I am very confused about which resource would be the most helpful for this kind of programming

You first need to decide on a GUI toolkit. Often you'll just rely on online available documentation and samples to figure out how to work with that toolkit.

> I've looked into books, but as far as I've understood, the most popular book by Charles Petzold, Programming Windows

Most popular only for using the Windows API to create a GUI.

> is written with C in mind?

The Windows API is a C API. In any case, you shouldn't be too particularly concerned about whether it's in C or C++. If you're experienced enough to tackle programming a GUI, you're experienced enough to handle any C idioms...and you certainly shouldn't be struggling with the language.

> And would such a book as Programming WIndows be wise to read before starting anything like Direct3D or OpenGL-programming?

You need to figure out how you're going to get a window open, handle events, etc. Direct3D and OpenGL handle the rendering pipeline. And that's it. So you need to be able to create a GUI, handle input events, and so on. Whether you use the Windows API itself is up to you. I think if you're end objective is to render on screen as quickly as possible, the Windows API is a poor choice for a beginner. Too much plumbing work for no reason.

> Would an huffman-coder be anywhere near possible at a beginner's level?

Depends on what beginner means. If beginner means you just read the book and haven't been writing any programs, that's too much. On the other hand, if you can write programs of some complexity already, this shouldn't be too hard given some time.

A quick test is to take the problem and just break it down into what you need to do. Huffman coding is already rather well explained, so you shouldn't have any trouble decomposing the work into chunks. If you're having trouble seeing how you would even approach constructing the program, that's a problem.

Hey. I am a beginner with little experience in C++ and a few other languages. I've started reading a book (C++ Primer Plus 5th ed.), and hopefully I am done with it soon enough, since I am very eager to learn GUI/API-programming. But I am very confused about which resource would be the most helpful for this kind of programming. I've looked into books, but as far as I've understood, the most popular book by Charles Petzold, Programming Windows, is written with C in mind? Is this a major drawback when I got no experience with C and only C++?

And would such a book as Programming WIndows be wise to read before starting anything like Direct3D or OpenGL-programming?

A bit off-topic, but we are soon to write a program for our examination. Would an huffman-coder be anywhere near possible at a beginner's level? I'm thinking of something that could code/compress data and reconstruct it later on, not necessarily GUI-based.

Maybe I'm overthinking, but would be nice to have a plan to follow to keep the motivation up ;)

Regards,
Boooke


Personally i would avoid the Win32 API , it is pretty darn horrible, (The only OS GUI API i can think of that is as bad or worse to work with is the one for X11(Fortunatly noone uses that anymore, Linux is all about QT or GTK these days while Windows has moved to WPF and Windows Forms)), Either switch to a .Net language (such as C#) and use WPF or Windows Forms or grab a GUI toolkit such as QT. (QT is also cross platform allowing you to use the same API for Windows, Mac, Linux and Symbian and is my personal favourite for normal C++ GUI applications)

If you are making games Win32 becomes a bit less painful as you only really need it to create a Window, handle input and timers (But something like SFML or SDL would be a better option there imo).

Huffman is definitly something you can implement with fairly little programming knowledge (It is pretty straightforward)
[size="1"]I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!
Hey again, and thank you both for the answers. I've heard that Win32 can be a slow learning-process for beginners. Right now, C# isn't my choice because I've been stalling my progress in C++ for so long, and now I'd really like to get somewhere with it. I'm still not very sure which API would be the choice. I'd learn C++ for the "end result", meaning I'd rather learn something I could use later on, over something that will be useless if joining another team of programmers one day. But then again, that's only the end of a still long road. I think I will look into more than just Win32 now, since there are so many choices; mainly through web resources and samples and eventually something more in-depth (I like in-depth :-D ) than just samples.

Concerning the huffman-coding, the actual problem, I guess, is how to do the real compression? I could think of finding and replacing the different symbols with an smaller/larger ASCII-value (defined by an probability analysis first), but I wouldn't know if this is effective.


Regards,
Boooke

Hey again, and thank you both for the answers. I've heard that Win32 can be a slow learning-process for beginners. Right now, C# isn't my choice because I've been stalling my progress in C++ for so long, and now I'd really like to get somewhere with it. I'm still not very sure which API would be the choice. I'd learn C++ for the "end result", meaning I'd rather learn something I could use later on, over something that will be useless if joining another team of programmers one day. But then again, that's only the end of a still long road. I think I will look into more than just Win32 now, since there are so many choices; mainly through web resources and samples and eventually something more in-depth (I like in-depth :-D ) than just samples.

Concerning the huffman-coding, the actual problem, I guess, is how to do the real compression? I could think of finding and replacing the different symbols with an smaller/larger ASCII-value (defined by an probability analysis first), but I wouldn't know if this is effective.


Regards,
Boooke


Huffman encoding is essentially about reducing the number of bits per symbol, to do this you first build a binary tree with the most frequently occuring symbols at the top and the least frequent at the bottom, a basic algorithm to create the tree using a priority queue is:

  1. Create a leaf node for each symbol and add it to the priority queue.
  2. While there is more than one node in the queue:
    1. Remove the two nodes of highest priority (lowest probability) from the queue
    2. Create a new internal node with these two nodes as children and with probability equal to the sum of the two nodes' probabilities.
    3. Add the new node to the queue.

To encode the data you then replace for example every 'A' in the file with the path to the 'A' in your tree (0 for left, 1 for right) (This has to be done using binary, if you write the symbols '0' and '1' the file will become huge instead), This basically lets you use one or two bits instead of 8 or 16 for the most common symbols at the expense of having to use 20-30 or even more bits for the less frequent ones. (As most data contains patterns and lots of possible symbols are entierly unused the file will still shrink significantly unless you are trying to compress truly random data)


As for languages other than C++ being useless i think you're severly misinformed, the vast majority of todays games are not written in C++ and never will be, the language is good to know and is the least horrible choice in some fields (console game engines for example) but there are plenty of platforms where you simply cannot use it, (WP7) where using it requires you to write 8+ versions of your game(The Web) or where it cannot be your only language (Android and iOS).

I'd go as far as saying that as an indie game developer today it is far more important to know ActionScript, JavaScript, C#, Java and Objective-C than it is to know C++ since the first 5 languages are more or less required to cover the major platforms available to indie developers. (C++ was the third language i learned, i've been pretty much forced to learn another 10 since then since C++ just wasn't suitable for the tasks at hand). I'm not saying don't learn C++ , Go ahead and learn it (It is very useful to know), but don't think for a second that it will be your last language or that other languages are inferior.
[size="1"]I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!
Hey again. Well, I guess C# is well worth the time. I don't think other programming languages are useless at all, sorry if it sounded so. I just thought that some basic C++ knowledge would be a good standpoint to progress from. And I really enjoy the Primer Plus book - I haven't seen a book explaining so much in-depth before. But what you are saying is, that game-developing is much less about C++ contrary to, for instance, C#? I am not concerned on cross-platform developing right now, since it is only a hobby at the moment.

But that really makes me wonder, what would you use C++ for in a program (A game, for instance)? I was an "intern" at a small developer which used the Torque Engine. I don't remember much of it, but a lot of it seemed to be C++. But I understand that scripting is usually done in high-level languages.

The huffman coding process is not a problem itself, but how the actually alter the bitlenght is what I don't grasp. Maybe it is over my head at the moment, but it would an interesting project when I understand it. I haven't found out much about the topic (With C++ in mind) on the web, though.

I thought of an process where every ASCII-symbol is contained in a "refference"-container ('a' would be one element, for instance) with an "probability" for all elements. Then the input text will be analyzed. Here the unused symbols will be noted and removed for the coding-process. The probability of every symbol should be defined and then the huffman-tree should be made. Next the coding should begin, and it will leave the data compressed in a new file. The remaining task should be the reconstruction of the data, which I guess depends on which data I want to reconstruct. Two different files might contain different elements (symbols) with different probabilities (And therefore a different bit length). So some kind of refference/header should be made in the compressed datafile for the reconstructor to read.

I haven't thought much about the process yet, as I think I should really just get going with learning the basic syntax of C++. But I will get there..!

Regards,
Boooke

But what you are saying is, that game-developing is much less about C++ contrary to, for instance, C#?
[/quote]

Programming in general has very little to do with the language used. Learning how to solve problems, how to design programs, how to avoid and correct errors are all vastly more important. With that in mind, the forums here tend to recommend not using C++ because it has a lot of pitfalls that beginners spend time dealing with instead of learning those important things.
Ah, I understand then. The real reason for my motivation was my school. I have the subject 'programming', where the examination (Writing a few lines of code) is mandatory. In this subject we only use C++, and therefore I cannot really rely on any other languages, and C++ would be the safest language to progress until that subject has been completed. I think studying C# (As an example) and C++ at the same time would be exhaustive and not very rewarding for me - "To do two things at once is to do neither" . . . ;-)

Regards,
Boooke

In this subject we only use C++, and therefore I cannot really rely on any other languages, and C++ would be the safest language to progress until that subject has been completed.


Ah, yes. That would be best then.

This topic is closed to new replies.

Advertisement