Hey everyone. I do a bit of programming in my spare time, and I've been on hiatus for a while due to taking up a second language. Now that I am taking computer science classes, I'm back into programming. Admittedly, they're far too easy for me, and I find myself overdoing everything and addressing possible sources of error. It is however, thanks to the classes that I was introduced to a few useful tools and visual basic with it's ease of creating GUIs (I know C++ and a few other languages, but haven't found one which leaves me only the back-end to worry about). While brainstorming for a program I'd like to make, I realized why I rarely do programming on my own.
I don't know how to create files. More particularly, I am only into storing information of a larger complexity than a simple variable, so I find the simpler ways to save files inadequate. For example, I often consider programs that serve the function of associating data and organizing it into classes for fast reference. One such example I have considered is a crafting recipe organizer with links to constituent parts, in-game info, and images for each recipe and a search option. Another more recent one is a language parser. I imagine these to such a depth that I understand the parts, but the data far exceeds my knowledge of higher level programming functions and tools. I need the capability to save classes and associations, rather than simple one-to-one associated variables.
My skill at the moment is quite good as far as procedural programming goes, especially for logic games and input-output. The problem is, I think dynamically and find simple programs far too easily understood. A question I have held in particular about files and databases is whether they hold raw data, or raw executable code. Moreover, I do not know of many languages that make GUIs easy to program (preferably to make visually). Ruby and C++ are my two favourite languages, but I could not get ogre to run for C++ and creating GUIs in windows is a nightmare full of code that distracts from the data I wish to display. Ruby seems the easier path, but I do not know how to use it to make anything more than a console application (though I know the syntax well and can make any number of text-based programs).
What I essentially need in order to improve are two distinct things. One, I need a simple way of rendering a GUI with minimal headache. Two, I need a way to save data as classes and objects and a way to search through this. In particular, I am interested in programming programs capable of compiling their own data and maintaining it (given a procedure to do so and input data to interpret), for which I need an easy way to manipulate these databases the AI will need. I excel at making simple applications, but I really need to have better, higher-level tools if I'm to have an easier time improving my dynamic programming. If it were not for struggling with filetypes and GUIs (and the errors that arise from inadequate knowledge of the forementioned topics), I would already be capable of such programs.
Thanks in advance, and I hope you understand the necessity of having the right tools if I intend to improve my code-crafting.
One, I need a simple way of rendering a GUI with minimal headache.
If portability isn't an issue, the .net Visual Studio family is very good at quick GUI programming without having to see all the GUI creation code, basically it's drag, drop, resize. It includes the tools necessary for Database, Web, Classes, etc. The File IO capabilites are very easy to use. You also have the option of a C-like language in C#, that might shorten your learning curve. I find the Intellisense very helpful. This gives you a small pop-up of the properties and methods available for the class your using.
Two, I need a way to save data as classes and objects and a way to search through this.
resx file format allows you to save whole structures within the file. The classes needed to use these files is part of .net, and can be used by any language supported by .net. You also have the option of using data bound controls that are desinged to interact with databases, to create, read and update your information.
Try Microsoft Visual Studio. The tools are free and there are plenty of examples on the things you are trying to do such as creating GUIs and file access.
One, I need a simple way of rendering a GUI with minimal headache.
I highly recommend Qt. It is in C++ (so, familiar territory for you, and no need to have an elaborate front-end / back-end design), and it is cross-platform (works anywhere, include mobiles). It is pretty much as easy as it can get for GUI programming (drag-drop designer, simple build method, feature-rich components, etc.). When I first learned to use it, within about an hour I was finished with what I had to do, it was a very simple GUI, but still, I never expected it to be that easy to pick up.
As you mentioned Ogre, I'll also mention that Qt integrates very well with OpenGL, and with Coin3D (aka Open Inventor) through SoQt. You can get a 3D scene up and running in no time, integrated inside a Qt GUI.
Two, I need a way to save data as classes and objects and a way to search through this
For file formats, the most popular ones are XML (or XML-like files), Google's Protobuf (used by Google for everything), and JSON (more typically used for web-content). All of these also come along with a method to specify to what data fields a particular class of objects maps to, this is called a Schema (like XML Schema).
As for serialization libraries, well, it obviously depends on the language. In C++, a pretty representative library is Boost.Serialization. This is a pretty typical implementation. As a user, you need to provide a "serialize()" function for each custom class that you created (because no serialization library can "guess" that), and within it, you basically dump all the data members into the "archiver" object that is passed to the function in a similar way as you would print things out (e.g., with the
<< operator). The archivers are polymorphic, of course, so it could, in theory, produce just about any kind of output (i.e., file format, or network packets). This design is pretty much the way all serialization libraries are written (this is also how I wrote mine years ago, it's really easy to do and extremely useful). All other high-level languages have something similar to Boost.Serialization (in the way it works), some are part of the standard, others are just popular libraries / add-ons. The only notable outlyer is .NET (C#) which has an annoyingly ill-designed serialization support, IMHO.
I think you are on the right track on this. Recently, someone asked me what should be the first item on the list (coding-wise) when starting a library or large software collection, and my answer was "picking or writing a good serialization library". This is because this (along with RTTI for dynamic object manipulation) is something that you cannot easily fix or incorporate once you got a lot of code already, and this is something you cannot live without.
I've been using the visual studio programs, so that's one thing to check off. Qt definitely sounds like I'll have to take a peek at it. Having OpenGL support is a nice plus if I decide to start distributing any of my projects. I'll look into resx to see if it fits my needs.
Serialization seems like it'll be exactly what I need except that it does not support references. I'm quite interested in AI and robotics programming, so some of my (later) projects will have data which makes extensive use of references to create associational databases. Nonetheless, it does sound like it will be useful for me.
Right now, my skill is enough to make a smaller text RPG/application and some basic 2D/3D graphics, but I have little experience with bigger projects so I'd probably run into a few problems with maintenance. Considering that I'm interested in programming as a career, I have to get started somewhere. Regrettably it seems the majority of tutorials are not about honing skills. Most of them give basic theory and leave me without the experience necessary to accomplish larger projects. It is quite apparent that I'll need those experiences to find employment as a programmer--After all, who wants to hire someone who still isn't skilled enough for large undertakings--so the only option that seems open is to dabble on my own time with larger projects.
Thank you for the advice; It will certainly make it easy for me to focus on the programming I enjoy.
It seems that you might want to consider a college level course. While you may have doubts on the practical uses such a course wil be to you, having that piece of paper that says what you know, as well as well programmed projects, go a long way towards having your skills respected.
but I have little experience with bigger projects so I'd probably run into a few problems with maintenance. Considering that I'm interested in programming as a career, I have to get started somewhere. Regrettably it seems the majority of tutorials are not about honing skills. Most of them give basic theory and leave me without the experience necessary to accomplish larger projects.
It's a good thing to think ahead and anticipate what problems you might have and what things you will need to have / to learn. But don't be overly cautious either. What doesn't kill you makes you stronger. Like many programmers, my formative years in programming were a long sequence of failures. I did some cool things that were fun and with some success, but most of my projects ended up at a dead-end because my code was getting unmaintainable, or because of architectural flaws that just couldn't be resolved without a full re-write. But every new project was a huge improvement over the previous one. For some things, there just aren't any good substitutes for learning by trial-and-error. You can read books or attend lectures on software engineering, coding practices, software development methodology, and such, but without experience (and failures) they will, at best, get you to think about it a little bit, but you're unlikely to remember much of it when you're coding. But with experience, those same lectures / books will make you jump from your seat going "Ahh! That's why I had so much trouble with that!" or "Oh man, if I had known that, it would have made things so much easier when I tried to ... ". And as a result, you learn a lot more, and often can't wait to put things in practice, until your next failures, and it keeps revolving like that.
The point is, you have to dive in. Tutorials are not about honing skills or even really learning at all. Most are just instructions for particular techniques or libraries. No amount of Ikea furniture construction using the given instructions can make you an expert in cabinetry or industrial design. At some point, you have to think of a project that would be cool and challenging (and doesn't come with instructions!), and just start doing it. If you fail, just start fresh, or start something else.
However.. some tutorials are pretty useful.. cough, cough.