I'm trying to learn c++ and I really want to do a lot of coding but I'm not sure what I can code.. Tbh, book exercises are not very interesting to me (usually because they're just too short). I like to code OS related stuff like I/O stuff..
I'm thinking of looking at linux and try mimicking some of the tools there.. is that a good idea?
Rewriting tools is a good idea - my C++ professor made us rewrite all the standard library string functions by hand before we were allowed to use them in our homework assignments so that is something that may help you as well. You could also check out Project Euler.
Here's a good task that involves I/O, has interesting algorithm, is not too simple, not too difficult, and can even have practical application:
Write a simple compressor / decompressor.
Simple ideas to start with: LZW, Huffman codes.
I write stuff I'm interested in ... games for example. Poker games or blackjack games. I also take existing libraries and see if I can make better versions of their stuff, like try and make a QuickSort that outperforms the Framework version. Some day I will write a chess game, but that will take some time. :)
Write a language! Make C# compile to Sparc V9 assembly (just kidding.) But seriously, I think, writing a small compiler that produces actual machine code is one of the greatest ways to learn a great deal about software and hardware (and operating systems, and libraries, etc. etc.) and pick up lots of useful skills along the way. Here's the The Dragon to get you started :)
You can try getting involved in some open-source projects if you are wanting to write code. If you find a project that has some use to you personally, it is going to greatly increase your interest levels and decrease the likelihood that you'll get bored with it and move on to something else. Plus you'll be able to get some feedback from other developers on the same project.
Try TopCoder. They're competition applet has hundreds of example programming problems. Some of them are sure to be more interesting than the exercises in the books, and you have the added bonus of seeing how your problem solving abilities measure up to other users.
Related
I like to go through existing software projects as a source of learning and new ideas.
doing so I discover things that I did not think were possible
in your opinion, what is the top state of the art C++ project that you have used/develop/extended? can you state reasons why you consider it state of the art and what you can learn from it.
my latest craze is boost::phoenix, http://www.boost.org/doc/libs/1_43_0/libs/spirit/phoenix/doc/html/index.html, which is very comprehensive functional programming library.
Despite its capabilities it is straightforward and easy to extend. After some tweaking I was able to write multithreaded lambda parallel loops and mathematical domain specific language, probably within 2 weeks.
What is yours? (please do not just say boost, as it is huge collection of project)
Personally, I like to look at code in Qt. I do use it everyday, but it seems like every day I use it, I find something new. In terms of total code, it is probably as big as boost. But it comes with excellent documentation and examples and complete source code and is free for LPGL & GPL versions.
For me, what I liked about Qt was that it's concepts matched the way C# works, so it was a fairly easy transition back into c++ for me. But by looking at their code, it has really given me many ways (although not as many as SO) to understand some of the complexity in C++
From what I've seen, the code-sources that I have learned the most from have been from fairly complex 3rd party software libraries. Havok is an excellent example from which I've not only learned programming practices and solutions, but also quite a few mathematical and philosophical discussions. I've also seen some other code-sources which have not been open sourced from which I've learned how to not solve things.
Game engines for AAA-titles in general tend to involve a lot of complex code that tries to push as much as possible through a piece of hardware. I guess that the recommendation goes for all software that tries to achieve something similar but I've only dived into game engines when it comes to such software. AAA-titled game engines often have good or bad solutions to study and I would generally recommend looking into those. There are some that are open source... I think Source/Valve have released theirs in different stages.
I'm a student who's learning C++ at school now. We are using Dev-C++ to make little, short exercises. Sometimes I find it hard to know where I made a mistake or what's really happing in the program. Our teacher taught us to make drawings. They can be useful when working with Linked Lists and Pointers but sometimes my drawing itself is wrong.
(example of a drawing that visualizes a linked list: nl.wikibooks.org/wiki/Bestand:GelinkteLijst.png )
Is there any software that could interpret my C++ code/program and visualize it (making the drawings for me)?
I found this: link text
other links:
cs.ru.ac.za/research/g05v0090/images/screen1.png and
cs.ru.ac.za/research/g05v0090/index.html
That looks like what I need but is not available for any download. I tried to contact that person but got no answer.
Does anybody know such software? Could be useful for other students also I guess...
Kind regards,
juFo
This is unrelated to the actual title but I'd like to make a simple suggestion concerning how to understand what's happening in the program.
I don't know if you've looked at a debugger but it's a great tool that can definitely vastly improve your understanding of what's going on. Depending on your IDE, it'll have more or less features, some of them should include:
seeing the current call stack (allows you to understand what function is calling what)
seeing the current accessible variables along with their values
allowing you to walk step by step and see how each value changes
and many, many more.
So I'd advise you to spend some time learning all about the particular debugger for your IDE, and start to use all of these features. There's sometimes a lot more stuff then simply clicking on Next. Some things may include dynamic code evaluation, going back in time, etc.
Have a look at DDD. It is a graphical front-end for debuggers.
Try debuggers in general to understand what your program is doing, they can walk you through your code step-by-step.
Doxygen has, if I recall, a basic form of this but it's really only a minor feature of a much bigger library, so that may be overkill for what you want. (Though it's a great program for documentation!)
Reverse engineering the code to some sort of diagram, will have limited benefit IMO. A better approach to understanding program flow is to step the code in the debugger. If you don't yet use a debugger, you should; it is the more appropriate tool for this particular problem.
Reverse engineering code to diagrams is useful when reusing or maintaining undocumented or poorly documented legacy code, but it seldom exposes the design intent of the code, since it lacks the abstraction that you would use if you were designing the code. You should not have to resort to such things on new code you have just written yourself! Moreover, tools that do this even moderately well are expensive.
Should you be thinking you can avoid design, and just hand in an automatically generated diagram, don't. It will be more than obvious that it is an automatically generated diagram!
Like many people here, I started my programming experience with the good ol' green screen BASIC that you get when you booted an Apple II without a disk. I taught myself C++ in my teens, and even took a class on it in college, but as soon as I discovered .NET and C#, I dropped C++ like a bad habit. Now, (many) years later, I'm interested in getting back into C++ development - thank the iPhone for that - and I have to admit, I feel a little daunted. Having to deal with pointers, ATL, macros, etc. seems a bit overwhelming at times when you've been in managed .NET land for a long time.
What are some good resources or weekend type projects I could do to ease me back into C++? I'm not interested in debating the relative merits between platforms, stacks, but I would be interested in hearing about objective comparisons between different development platforms, although keep in mind I'm a Windows guy.
If anyone wants to change the tags around, feel free - I wasn't quite sure how to tag this.
TIA!
Try Euler Project
Project Euler is a series of
challenging mathematical/computer
programming problems that will require
more than just mathematical insights
to solve. Although mathematics will
help you arrive at elegant and
efficient methods, the use of a
computer and programming skills will
be required to solve most problems.
I had this problem a while back, I chose to find a cool open source project.
I chose Chromium.
It was really interesting, and all C++
They have a vast number of small bugs which can be fun to fix, I ended up fixing about 4 in a few evenings/weekends. Check it out (pun intended)
You don't need to leave .NET to program for the iPhone, unless you want to...
http://arstechnica.com/open-source/news/2009/01/open-source-mono-framework-brings-c-to-iphone-and-wii.ars
If you're into the iPhone, grab the openGL demo for it and get modifying.
It's fun, you can show people and it's kept me busy for the last 3 months.
I'm about release my first app.
While Project Euler or related sites are cool, for me they just don't hold my attention very much. I find the best way to start using a new technology (or refreshing an old one) is to find a project that scratches an itch that I am genuinely interested in. This is the only way I can maintain interest while learning something new.
I haven't gotten around to doing this yet, but a friend of mine recommended building an ircbot. for me this doesn't really scratch an itch since I don't use IRC a whole lot and when I do I'm trying to talk to people.
I've thought about modifying his recommendation and instead building a web crawler. Though I'm not sure of the particulars of this sort of project it seems like a good one as it would teach you a lot of libraries at once, it might not exactly scratch an itch though.
How I DO currently get projects to learn a language is make a game. The game dev club at my school is small and holds periodic challenges for individuals/small groups to make a certain genre of game. This works for me, as it's somewhat competitive.
I would definitely recommend finding such a group, even if you're not going to school any more, a school dev club is always eager to have a professional around. And depending on the area you're in there are also groups that are not associated with any school.
Ok lets start off with info about myself.... that way there is no stone unturned.
I am a adult, 27 years old. so this isnt a joke or a passing fad. Im into computers, how they work and how apps and games are designed from the ground up and made.
I have ZERO programming back ground. I went to college for the wrong thing. I love video games since i was a child and should have went that route.
I just picked up a book called C++ without fear. i already have went thru the first 3 chapters and im not having an issue yet on self teaching myself this subject.... yet... lol.
I have a few game ideas written and drawn out on about 3000 pages. i took one of my games to a few website developers and the cheapest offer i received to make the game was 16k and 3 months time. Now im not now super duper genius or a brilliant mind kind of guy.... but come on... 16k? i figured... ok time to teach myself how to make these games.. and yea it might take 2 to 4 years but at least i will learn how to code myself and never ever have to pay for this kind of service.
So i asked around at what i should learn and i was told C++ was a nice starting point.... Is this correct?
2... 2 of the games i have written down and played with all the math issues are kinda in this games fashion. www.goallineblitz.com. if someone here could sign up and look that game over and let me know what tools you would need as a coder to make a game in that style... i would thank you greatly for the info.
Where else do i go from here? what would you do and plan out?
I know a have a huge mountain in front of me. and i look foward to every step, stumble, fall and bloodied knee i will endure during this venture...
=)
thanks in advance!
I wish you the best of luck, but you have to realize you're the 1238471920847th person in this exact situation, of which approximately 3 manage to figure out what they're doing. there are even previous questions like this on stackoverflow. The most useful answer is "reconsider whether you're interested in coding or game-design -- the two are not equivalent"
Also, you have to realize 16k is an unreasonable number. Not because it's high, but because it's low. Consider Braid for an example of an "indie" game that was pretty successful. It cost $200k, and the developer started off already knowing what he was doing.
There is so much to learn, you would be surprised.
What I think you should do is find a bright young web developer who's interested in investing some time into a business startup for a certain % of share of the business. You can contribute the intellectual property of the game and the creative direction. I imagine this would let you get up and running for significantly less than $5k including incorporation fees, web site costs (minimal), trademarks, etc. You could save money by doing the business stuff yourself, and by your partner doing the programming himself.
It's win-win. You get your game built, and the developer gets a lot of great experience for their resume (and a share of any profits).
I think you've got a very low estimate of how much work is involved, frankly. Going from a spec to a finished web product in 3 months sounds quite good to me, counting things like quality assurance (a very important thing here) and graphics and sound, and $16K also sounds very good for three months' work. (Seriously, this is $64K a year, as a contractor, assuming only one person. Anybody who can do this sort of thing can make more money than that.)
That being said, doing it yourself will teach you a whole lot. Just don't count it as a likely source of income.
If you're interested in web-based games, you will need to become familiar with more than C++. At a minimum, you'll need to know web design and Javascript. This strikes me as a lot to bite off at one time, so I'd suggest starting with a simple screen-based game, and learning about the web stuff when you're confident of the basic game programming. (Don't just write the game you want on the screen and then think you'll just port it to the web; write to get some familiarity with C++ game programming, learn the web stuff, and design your game based on that.)
This sounds like a good way to learn programming, but don't get your hopes up too high. That's going to be a loooong road.
Also, I agree that C++ is probably not the right language to do this. Maybe you should start to learn programming with a smaller, less ambitioned project first and use a more beginner-accessible language.
A turn-based strategy game is basically a business application with a glossy front-end.
I'd recommend SQL Server for data storage and rules engine. You're going to have to learn how to model a database. I don't want to shit on your hopes, but the other guys are right: you've got a long road ahead of you. Here's some help to get started:
An introduction to turn-based gaming and what it means
Source code for a turn-based war game you can browse and modify
The Torque 2D gaming engine
I wrote the beginnings of a turn-based space combat/strategy game in MSAccess(!) over a decade ago (ugh I just did the math and it's been almost 20 years actually) that I never finished. Here's hoping you get farther than I did. Good luck!
Java, Flash, PHP, ASP.NET, all are languages that are commonly used to implement web-based games.
You're also going to need to introduce yourself to SQL most likely, since data will have to be stored in some manner.
First, I'm gonna answer your technical question.
You will need 3 things.
1- Display things in the user's browser so that he can use your application. This means using languages best suited for programming. Most likely PHP (or its Microsoft equivalent : ASP.NET, less used, and requires more expensive tools) or maybe Flash. There are others, less used options, but that's beside the point.
2- A database, to store your data. The language here will be SQL, and you will probably start with a free open-source database. Most people choose MySQL in this case.
3- An engine to do something with the data you have in your database and the input of your user. Here, since you don't know anything about programming, the easy way is to use the same language you used for your GUI : PHP/ASP.NET. Later on, if you manage to be a code guru and need some performance improvement, you may try something more powerful like Java or C++, but then you will have to interface your PHP front-end with your C++ back-end which is gonna be tricky.
Now here is why i think you're going to fail :
All i said means that, at the very least, you need to learn basic programming concepts, 2 languages (PHP + SQL), and all the associated tools (MySQL, an IDE for PHP, ...). Moreover, you will also have to learn how to set up, configure and use a web server. That's quite a daunting task to do all this by yourself in a few months or even in two years.
Actually what worries me the most, is that you say you have no programming background. This means you don't even know whether or not you will like to do this kind of thing. Programming can be quite frustrating and many people hates it. You should start by building small apps as a hobby, and see whether this is the kind of job (because yes it's a job, that requires skills) that you would like to do. Only then you will be able to think about making this your line of business.
If you want to make web-based games C++ is probably the wrong language. You should look into PHP, SQL database programming, and Perl.
Welcome to the world of programming. It's lots of fun but takes a while to learn.
My advice: start small. Really small. There are a lot of basics you need. C++ may actually be a good way to get the basics down solidly, though you won't likely be using it for your final web product (see other answers for web language options). As you go through examples, think of small parts of your project that you could do with what you know, even if it's just choosing a name and displaying it, or adding up a score. Processing.org is a fun language-- again not what you'll need in the end, but it's aimed towards beginners and lets you get into graphics right away (which is fun, though probably won't be your main focus with this game).
Bonus advice: if you want to make money off this or become a professional game developer, don't release your best ideas on the web right away. My husband created a really innovative game in college, which became somewhat popular on a java game site. A few years later an almost exact clone was released for the Playstation. The Playstation developers weren't ripping him off directly, it turned out the idea had spread widely. While in some ways that was really cool, if you want money or credit as a game designer obviously that's not going to be what you want.
You could approach this from another direction. Instead of implementing these large designs you have in mind, aim at starting with a Facebook app instead. That way you can get some very small ideas implemented. If you try to do something large first, you'll end up in a tar pit.
Be careful of large game designs. Get good at implementing small ones first. You can always build on top of them.
C++ is a good language for learning how to program computers; however, for the specific task of programming turn based web games, C++ is probably not the tool you will want to use for that task. You may want to continue learning the C++, to get a grip on the underlying programming; it may take a while, though. You may also want to look into other programming languages for implementing your games on the web; PHP is good for scripting. C# has a lot of similarity to C++, and has good integration with Microsoft's web servers; ASP.NET is pretty easy to comprehend, as well. You should do the research into each of them concurrently with learning the C++ to figure out which one seems like it's going to give you what you need.
Others have already said this, but PHP is going to be the best starting place for you. For a turn based, web based game I would say use PHP and mySql for sure. After coding much of your game using PHP, you will have a good enough understanding to start moving to other languages if you so desire.
Setup an apache server with php support, and a mysql server (they can easily run from your own machine). Then just start playing with the code. Look at other examples, modify them, mix them, learn.
You can find lots of free tutorials on both php and sql on line.
I started learning C++ fairly recently, also with "Without Fear". The best thing you can do once you have the basics is dive into a simple project, but REALLY simple (like tic-tac-toe).
I don't think you should be learning to program just for this one idea of yours. Learn to program for the fun of it, see how you get on, see what floats your boat. A year from now, think again about your project, whether it seems feasible, whether you want to do it, how you want to do it. But don't think about it till then, because all you'll be able to think about is how you don't seem to be getting any closer to having thousands of customers lining up.
Just keep on coding, and you'll get where you want to be. Where you want to be may not be where you think you want to be now though! Good luck.
It may be of no use to you but http://archverse.sourceforge.net/ is an open source C++ turn based web game. Its not finished but all the basics are there and it actually does quite a lot (though it has no client just a server with unit tests right now). Its BSD licensed so you're welcome to do what you want with it aside from claim you wrote it from scratch.
Contrary to suggestions from others here im not a fan of RDBMS for semi real time games so I'm using BerkeleyDB as a data store it allows me to have ACID and still be massively faster since I never search on anything but a key field and everything is in process. Don't really want to start a flat file vs rdbms flame war but the non open source project this is related to used MySQL and paid for it quite painfully.
The learning curve for C++ can be tricky for beginners. If you can get through the chapters on references and pointers without severe mental damage, you'll probably be fine. Otherwise, you may want to pick up something a bit higher level to start out with. As others have stated, C++ is a great programming language for game development, but it's not particularly suited for web-based applications.
Regardless of your language of choice, there's only so much you can learn from books. Programming skill is very much dependent on experience -- program, program well, and program always.
At some point, you'll probably want to study up on object-oriented analysis and design. If your games have any significant degree of complexity to them, the ability to break them down into easily manageable chunks is invaluable.
Check out gamedev.net, they have a number of resources for game developers.
Game development involves a lot of different aspects other than the programming itself. Depending on the game, you'd also have to worry about sound, music, graphics, animation, user interface, play balancing, story, dialogue, and database design. All of which has to work on a variety of hardware and software configurations. Oh yeah, and it probably has to be fun as well.
Start small.
Good luck.
I'm just now learning to programming at age 17. It's hard for me to talk to other programmers as I'm just out of high school (which means I can't take programming courses). I know that I write terrible code, and not like Jeff Atwood terrible code, my code actually sucks. So where can I post some of my code and get real programmers to review it. I know if I had a question I could ask it on StackOverflow, but I want to post a whole class and get a review on it.
The real problem here is that I'm not going to be writing the next great piece of Software. I'm going to be writing a really useless class, which will serve no other purpose than to teach me how to program. This code will never be used, ever! EVER! How can I get an advanced (or even intermediate) programmer to look at my code?
Thanks in advance! ;-)
Look to the open source community. There are plenty of existing and new projects that would love an eager (if inexperienced) developer to offer support.
Going this route offers two advantages:
You get to see great code in action and learn from it
Any changes you submit will be reviewed by an experienced developer and they will often give you excellent suggestions as to how to improve your code before it will be accepted
Start by choosing a project in your language (there are a bunch in c++) and check out the code. You don't need to understand it all, but you must be able to understand at least a portion of it.
If the project looks way to complicated, keep looking. Younger projects tend to have less code that you need to learn.
If you can't get great programmers to look at your code, do the next best thing: look at theirs!
Look for a bunch of code snippets that do the same (simple) thing. Before you look at them too closely, write your own code to perform the same task. Compare all of the snippets with your own (and each other!) and try to figure out the reasons for the differences.
I recommend looking for code from well established projects. Code from tutorials often ignores important details for the sake of simplicity.
Why don't you try RefactorMyCode?
I would try not to write useless code, but attempt to solve some particular problem. Your learning will be more advanced if you are learning in the context of a real-world scenario. It doesn't have to be a big business domain; could even be a game or a shareware utility.
As for getting your code reviewed, the open source community is a good way to go as The Lame Duck says - in fact you're guaranteed it gets some form of review if you actually contribute to a project. Other avenues to explore: your local C++ users' group, checking out a co-op program available through a junior college, or engaging someone in a company that sponsors interns.
I haven't tried sites such as RefactorMyCode as suggested by Gilad Naor, but that seems promising. And, yes, StackOverflow is a good place for bite-sized chunks of code. If you do that, explain what you are trying to do, and why you are trying to do it that way, and ask if there's a better approach. Good luck!
I think the best way to learn is the way I learned (I may be biased): trial and error. I just wrote programs all the time, teaching myself as I went. I'd write terrible code, and I would wrestle with making it do what I wanted. Often it would make me give up on that particular project. But on the next project, I'd take a different approach, and it would work better. Repeat ad nauseam. Once you know where the rough spots are in your designs, you'll be able to ask specific questions on places like SO, or, better yet IMHO, come up with better designs yourself. I independently invented all the major design patterns just through frustration at the solutions I'd created in the past. I think this gives me a valuable perspective, since for most people design patterns are just a "best practice", but I know the pain that comes with using other designs, and I can see signs of bad designs in code very easily (it takes one to know one). This last skill is one that I often see lacking in other programmers... they can't see why their design is deficient and they should use something else.
You could always try a site like Project Euler, where there are a whole load of problems that will test your skills and a whole bunch of solutions to those problems, submitted by others. Project Euler tends to focus on algorithms rather than higher level programming constructs, but I imagine that there are others in a similar vein.
Do something fun and don't worry too much about code style yet. I started out with BASIC on Commodore 64 without even realizing that there was such a thing as clean code vs dirty code. If I had worried a lot about that then, it might have hindered me from progressing. You always learn best when doing it playfully.
Maybe a bit late, but since StackExchange has Code Review, it worth the answer:
Code Review Stack Exchange is a question and answer site for peer
programmer code reviews. It's 100% free, no registration required.
Here is the link: Code Review Stack Exchange