• Picking up a programming language
    33 replies, posted
  • Avatar of Tautika
  • Ok so I have a question for you guys. Next year I'll be attending university and following Computer Science. I'm really excited, even more since I started lurking this forum (specifically WAYWO, it's awesome) so I wanted to start doing programming stuff already. They will be teaching Java next year (at least the first semesters, later on also Pascal and C and some other stuff) So I thought I'd find some nice tutorials and just go with it and get started. (are these any good [url]http://eclipsetutorial.sourceforge.n...beginner.html?[/url] Also found 'thenewboston' on youtube, how are those tutorials?) Anyway, suddenly I found out about Udacity, so I thought, Awesome! and enrolled right away. But they teach you Python which seems a lot different. So my question is, what would be a smart choice? Go with Udacity, follow the Java tutorials or do something completely different? I don't really have any previous programming experience, except for some HTML/CSS and Javascript knowledge.
  • Avatar of 12voltsdc
  • I always found Youtube tutorials hard to follow, And hard to keep concentrated when there is so much going on. Try out educator.com, Great website for a small fee, The only downside is they only do a small variety of Languages.
  • Avatar of pkt
  • I've not much experience but I tried javascript a few time and after messing with python a bit it made more sense. I think it's because I understood more of how to put things together. I'd say for any language look up it's documentation along with tutorials and get familiar with the words that get thrown around and it's syntax and start small and build up from there.
  • Avatar of flayne
  • I agree, C or C++ is a good language to start. Personally, I would recommend getting a book like C++ for dummies all in one (that is what I read and it worked out really well).
  • Avatar of SiPlus
  • [QUOTE=flayne;35626734]I agree, C or C++ is a good language to start. Personally, I would recommend getting a book like C++ for dummies all in one (that is what I read and it worked out really well).[/QUOTE] C++ is very hard thing. Don't even try.
  • You'll start with Java and then move to pascal? That's bound to kill peoples will to program.
  • Avatar of sim642
  • [QUOTE=SiPlus;35632391]C++ is very hard thing. Don't even try.[/QUOTE] I'd consider C harder than C++, because even though C has less features, but it requires much more code to do tasks that C++'s STL already has. In C you can't get around pointers, but in C++ you don't need them most of the time as references are usually enough.
  • Avatar of PvtCupcakes
  • C++ is a steam piling of garbage. The only good thing it does is Strings, and that it (more or less) does C. If your'e just going to use C++ to write C, then use the real C. If you want something with more features then use Python.
  • Avatar of Tautika
  • Ok I decided to go along with the Udacity courses, it seems like a good starting point. And I enjoy their way of teaching. So C++ seems like a sensible choice to begin with afterwards? But wouldn't it be more difficult to switch to Java later on when I start university, or is their syntax similar? [QUOTE=Darwin226;35632636]You'll start with Java and then move to pascal? That's bound to kill peoples will to program.[/QUOTE] O wait I messed up, they will teach scala, not pascal They will use Scala, JavaScript and C in the 3rd and 4th semester to teach more advanced concepts (or something like that), Java in the first 2. anyway, thanks for all the feedback.
  • [QUOTE=PvtCupcakes;35634851]C++ is a steam piling of garbage. The only good thing it does is Strings, and that it (more or less) does C. If your'e just going to use C++ to write C, then use the real C. If you want something with more features then use Python.[/QUOTE] I wouldn't say C++ does strings well. It's marginally better than C, but that's only because C is absolute shit for any sort of string manipulation. For compiled, statically-typed languages, I think Go is the only one that handles strings well.
  • Avatar of T3hGamerDK
  • [QUOTE=ROBO_DONUT;35635401]I wouldn't say C++ does strings well. It's marginally better than C, but that's only because C is absolute shit for any sort of string manipulation. For compiled, statically-typed languages, I think Go is the only one that handles strings well.[/QUOTE] I agree with this. So much, in fact, that I decided to write my own string class instead, utilizing only parts of <cstring>
  • Avatar of Eudoxia
  • D is also a pretty good language. C++, I think, is not much more than syntactic abstraction over some common C things. Polymorphism and type polymorphism are basically "Hold this in memory, and whenever it's called, write a new function, replacing these template placeholders for the actual types". But when I need to pick between C and C++, I generally go for C++, but for no real reason other than "strings are marginally easier" and what not.
  • Avatar of pkt
  • This may sound a bit dumb or a more understated thing here but it all kinda depends on a lot of factors. I mean there's like libraries to do just about everything in just about any general programming language from accessing the net to making binary files. You could write in C or something like it if you needed to make drivers and such but for most tasks the language choice isn't always the biggest factor. I code in python and javascript and a little C and C++ but for me it's all like pretty similar at this point. Look up the documentation, learn the syntax, plan out logic, write the code, test for errors and such like that...
  • [QUOTE=Eudoxia;35642502]D is also a pretty good language. C++, I think, is not much more than syntactic abstraction over some common C things. Polymorphism and type polymorphism are basically "Hold this in memory, and whenever it's called, write a new function, replacing these template placeholders for the actual types". But when I need to pick between C and C++, I generally go for C++, but for no real reason other than "strings are marginally easier" and what not.[/QUOTE] I smell a troll, or your post is filled with the most wonderful stupidity i've seen in a while
  • Avatar of evil-tedoz
  • [QUOTE=Icedshot;35667001]I smell a troll, or your post is filled with the most wonderful stupidity i've seen in a while[/QUOTE] What's up with the random name calling ? Would you explain why you think what he said is stupid ?
  • [QUOTE=evil-tedoz;35667904]What's up with the random name calling ? Would you explain why you think what he said is stupid ?[/QUOTE] People tend to say C++ is C with classes to annoy other people. I've seen this person around the programming forums occasionally now, and i find it unlikely that he genuinely thinks that C++ is C with strings. It seems like something deliberately said to incite anger I apologise if i'm wrong, but that's my personal take on the situation at the moment
  • Avatar of Eudoxia
  • Classes are not a trivial feature to add, I didn't mention them in the other post because, well, I forgot. Then again, classes could be added to C if it had syntactic abstraction capabilities. I mentioned polymorphism being not much more than a syntactic abstraction because, well, it is. Consider. [CPP]template <typename T> T from_string(string datum) { stringstream stream(datum); T out; stream >> out; return out; }[/CPP] The template function is held in memory until this happens: [CPP] //code double tmp = from_string<double>("5.6e-5"); //some more code [/CPP] And so the compiler does this: [CPP] double from_string__d(string datum) { stringstream stream(datum); double out; stream >> out; return out; } //code double tmp = from_string__d("5.6e-5"); //some more code [/CPP] C++ also has a lot of incredibly useful features (The STL, basically) that on C would have to be implemented using unsafe void pointers and what not. Really, though, my opinion is not that C++ is "just" C with classes, but that these languages are too limited by their syntax. If they'd been designed with extensibility in mind, you'd have a more powerful macro system, or the possibility of writing specialized "source transformation functions" that the compiler would compile first then load into memory to transform the rest of the source code -- Basically Lisp macros, making the language as extensible as Lisp. Then it would be trivial to write macros for object orientation, polymorphism, etc. since entirely new programming paradigms would be just another library to load. If C had had those features, or if someone had designed a compiler that supported them, then it would not have taken ten years to go from C to C++; C++ would be a library of these "source transformation functions" that could be imported into a program and would do, for example, what I showed above with polymorphism.
  • Avatar of T3hGamerDK
  • What you mentioned, Eudoxia, is actually QUITE a good idea for a programming language. If such a language does not already exist?
  • Avatar of Eudoxia
  • [QUOTE=T3hGamerDK;35674251]What you mentioned, Eudoxia, is actually QUITE a good idea for a programming language. If such a language does not already exist?[/QUOTE] The language I'm working on would support those, but other than that I don't know. Besides the Common Lisp implementations I don't know of any other JIT compiled language that does this. [editline]23rd April 2012[/editline] [QUOTE=ROBO_DONUT;35674613]Are you guys talking about metaprogramming? Doesn't D have this?[/QUOTE] Metaprogramming is kind of a vague term. Different languages support metaprogramming to different degrees.
  • Avatar of zzzz
  • Is it possible to do a figure it out as you go along sort of thing with a language? Because reading books about all of the different terms and things used in programming without any [I]exercises[/I] wherein programs are [I]actually made[/I] annoys me a lot. I just want to figure out the language by making things, similar to how you can learn a spoken language by actually going to a country and being around people that speak the language instead of just reading a texbook about grammar
  • Avatar of robmaister12
  • [QUOTE=zzzz;35679319]Is it possible to do a figure it out as you go along sort of thing with a language? Because reading books about all of the different terms and things used in programming without any [I]exercises[/I] wherein programs are [I]actually made[/I] annoys me a lot. I just want to figure out the language by making things, similar to how you can learn a spoken language by actually going to a country and being around people that speak the language instead of just reading a texbook about grammar[/QUOTE] "Today I want to make a tic-tac-toe game" It'll be a lot harder and you'll probably be relying on Google A LOT at the beginning, but if you have enough determination you'll be able to finish these small projects and start new ones. Part of learning this stuff is knowing that it's okay to fail multiple times before you arrive at the right answer. You'll be learning either way as long as you analyze your failures to see how and where you messed up.
  • Avatar of robmaister12
  • [QUOTE=zzzz;35681410]I just literally have no idea where to start[/QUOTE] Start by splitting up a large task into smaller tasks that are easier to achieve. Eventually you'll get to a point where you can turn those tasks into code. Going off the tic-tac-toe example: You can turn "I need to make a tic-tac-toe game" into: -I need a way to store the tiles. -I need a way to display the tiles. -I need a way for the user to place an X or an O. -I need some AI to play against. -I need a way to check if someone has won or if it's a tie. From there you can break it down into concrete steps needed to make the game: -I will store the tiles as a 2d array of ints. -I will draw the tiles to the console after every turn -I will ask the user for a number 1-9 to place their next turn. -I will randomly select an unused tile as AI. -I will check all the ways to win after each round. From there you should be able to start coding your tic-tac-toe game. And remember that you won't be able to write it all in one go, so you should work in iterations, making sure everything works before you move on to the next iteration. Maybe you'll first start by storing the tiles and letting the user place Xs and Os in any unused tile. Then you might choose to draw the tiles after each round. Then you could add in the AI to replace you playing as both players. After that you can figure out when the game is over.
  • Avatar of Gmod4ever
  • [QUOTE=zzzz;35681410]I just literally have no idea where to start[/QUOTE] Well, going with the "tic-tac-toe" example, the first thing you should always do when going to make something is plan out what you need. In the case of a tic-tac-toe game, you first need some way of keeping track of the individual tiles. You could use a two-dimension, 3x3 array for it, or you can use a one-dimension, 1x9 array, and just keep in mind that 1-3 = first row, 4-6 = second row, 7-9 = third row. Either way works. Once you have that array down, you then need to develop a system for putting a cross in a tile, putting a naught in a tile, and then making sure that a cross or naught can't be placed in a tile already occupied. Then you need to consider a system for "turn-taking" between two players in some way. Once you have all that done, you just need to plan out how you intend to do the graphical user-interface. Once you've got it all planned out, you know exactly (read: roughly) what you need to do, and then you can get your nose down in the documentation / tutorials / Google to see what you need to know to get started. That's how I would recommend going about it, anyways. [editline]23rd April 2012[/editline] [QUOTE=robmaister12;35681543]Start by splitting up a large task into smaller tasks that are easier to achieve. Eventually you'll get to a point where you can turn those tasks into code. Going off the tic-tac-toe example: You can turn "I need to make a tic-tac-toe game" into: -I need a way to store the tiles. -I need a way to display the tiles. -I need a way for the user to place an X or an O. -I need some AI to play against. -I need a way to check if someone has won or if it's a tie. From there you can break it down into concrete steps needed to make the game: -I will store the tiles as a 2d array of ints. -I will draw the tiles to the console after every turn -I will ask the user for a number 1-9 to place their next turn. -I will randomly select an unused tile as AI. -I will check all the ways to win after each round. From there you should be able to start coding your tic-tac-toe game. And remember that you won't be able to write it all in one go, so you should work in iterations, making sure everything works before you move on to the next iteration. Maybe you'll first start by storing the tiles and letting the user place Xs and Os in any unused tile. Then you might choose to draw the tiles after each round. Then you could add in the AI to replace you playing as both players. After that you can figure out when the game is over.[/QUOTE] Rated your post funny because I find it humorous that you and I posted almost exactly the same thing, at the same time.
  • Avatar of zzzz
  • I've been trying to figure this whole array thing out and I just have no idea how to do it [editline]23rd April 2012[/editline] I just don't know what to do, and with absolutely no (memorable) experience whatsoever in this subject, I find it much too difficult to create this tic tac toe game without somebody helping me out Even when googling for help, all of the pages are so convoluted and rely on so much other knowledge that I lack, that even using those pages for help is extremely difficult.
  • [QUOTE=zzzz;35690298]I've been trying to figure this whole array thing out and I just have no idea how to do it [editline]23rd April 2012[/editline] I just don't know what to do, and with absolutely no (memorable) experience whatsoever in this subject, I find it much too difficult to create this tic tac toe game without somebody helping me out Even when googling for help, all of the pages are so convoluted and rely on so much other knowledge that I lack, that even using those pages for help is extremely difficult.[/QUOTE] If you don't know what an array is or what the point of one is, you're at a level where you're trying to learn a language without knowing its alphabet. A variable in programming is like a variable in algebra, except that you typically give them names that are more descriptive than a single character. An array is like a variable with a subscript, or a linear series of variables with one name and an index that ranges from 0 to the element at n-1, where n is total size of the array you've declared. For tic-tac-toe, you could declare 9 different variables to represent the 9 cells of the board, or you could declare a single array with 9 elements to do the same. Because there are only 3 possibilities for a cell, you could have 0 represent empty, 1 could represent X, and -1 could represent O. At the start of a game you would initialize all the values of your to start empty. In C/C++, that would look like this: int cell[9] for (int i=0; i<9; i++) { cell[i] = 0; } The first line declares an integer array named 'cell' with 9 elements The second line is a 'for' statement. This creates a loop that will run nine times, with integer variable 'i' starting at 0 and increasing by 1 until it reaches 8. The next line is a curly bracket which marks the beginning of the loop. The fourth line sets one element the array cell to 0. The last line marks the end of our loop.
  • Avatar of zzzz
  • Well how do I specify what the program needs to do, then, if a single element of an array is changed? What if I need to specify that if something happens to element 5, for example, that the program is to do something in response (add an x over that element for example)? [editline]24th April 2012[/editline] And you're right, I do not know the alphabet. I was going in here hoping someone would recommend me a book for beginners to a language (particularly c#) that would, instead of having lengthy explanations of every aspect of the language, give examples of code and explain each part. That way, instead of memorizing each fact in a detestably boring manner, I would be 'figuring out' the language.