Coding thread

Bit of a more serious thread for a change - I'm a sophomore in college looking to major in Computer Science. I went to a hackathon earlier in the year and, frankly, didn't feel too useful, as the extent of my CS knowledge is basically just intermediate Java (currently taking data structures) and bits and pieces of Python and HTML.

I'd like to find a good resource for learning Python, C, and C++ (along with others) in a more in-depth way. I've tried Codecademy, which is a good starting point but isn't very exhaustive. Veteran coders out there, what do you recommend?

I figure this is also a good thread for people to talk about CS in general, since I haven't seen one of these before.
 

Relados

fractactical genius
is a Battle Simulator Moderator Alumnus
This was pretty much my all-around resource for C++. I wouldn't call it the best, but it's good for getting started. I don't know of any resources for C itself, I just applied what I knew from C++ since there's a lot of similarities. Anything that goes over pointers and structs pretty much teaches you all you need to know.
 

alkinesthetase

<@dtc> every day with alk is a bad day
is a Smogon Discord Contributor Alumnus
the site rela mentioned is good as a standard library reference, probably the best for cpp in general, but i don't think you can learn C++ by reading STL docs. the best cpp book i know of is c++ primer 5e (lippman et al). do not confuse with the infamously shitty c++ primer plus which is a completely different and unrelated book. i learned C++ at a young age from a different book, but my experience was solidified by the 4th edition of this. the fifth edition incorporates c++0x changes which you should be aware of, particularly rvalue references (one of the hardest concepts to understand but has many practical applications)

the best C book would obviously be the c programming language by kernighan and ritchie, i recommend you learn C first, it's easier to go from C to C++ than the other way around. you can always learn inheritance-based OOP later and honestly, after working with type systems like go or haskell's, i find the inheritance paradigm to be... unappealing and brittle. anyway that's just opinion. the point is get k&r if you want to learn C or any derivative.

more advanced C++ books like the STL reference by something something josuttis? are also good to read if you stick to this language in the long term. the C++ programming language by bjarne stroustrup (creator of c++) is a good book but not approachable for a beginner.

be careful where you learn C or C++. these languages are very old and so there is a lot of BAD stuff on the internet about how to learn them. in fact, most books are also shitty. for this reason, there is almost no internet learning resource i would consider trustworthy off the top of my head. javascript, being widely learned but rarely mastered, is another example of this problem (refer: javascript the good parts, douglas crockford). because C has an authoritative master book (k&R which i mentioned earlier), you don't suffer from this problem as much if you just get k&r and read it start to finish. the problem is worse with C++.

python... not a language i speak, but i find once you understand imperative programming in general, you can pick up almost any similar language in a short time unless it requires a significant break of thinking (eg transitioning from imperatives to lisp/haskell can be challenging for a beginner). the main challenge of learning a new language is writing it idiomatically, ie using it in the way it was intended (as opposed to "using a screwdriver like a hammer"). for this, the authority on python is PEP8 http://legacy.python.org/dev/peps/pep-0008/ in any language, aim to understand it the "right" way. you can write any program in any language, given enough abuse of the language's features, but that generally results in shitty programs. a good ruby style guide: bbatsov/ruby-style-guide on github. go has the effective go paper. haskell - real world haskell is free online and well regarded. etc.



oh and don't develop on windows lol
 
Last edited:

cookie

my wish like everyone else is to be seen
is a Senior Staff Member Alumnusis a Contributor Alumnusis a Smogon Media Contributor Alumnus
udacity singlehandedly brought me from having limited programming experience to being a fully-fledged python wizard. From there it's pretty easy to google for more advanced topics to further your understanding.

python... not a language i speak, but i find once you understand imperative programming in general, you can pick up almost any similar language in a short time unless it requires a significant break of thinking (eg transitioning from imperatives to lisp/haskell can be challenging for a beginner). the main challenge of learning a new language is writing it idiomatically, ie using it in the way it was intended (as opposed to "using a screwdriver like a hammer"). for this, the authority on python is PEP8 http://legacy.python.org/dev/peps/pep-0008/ in any language, aim to understand it the "right" way. you can write any program in any language, given enough abuse of the language's features, but that generally results in shitty programs. a good ruby style guide: bbatsov/ruby-style-guide on github. go has the effective go paper. haskell - real world haskell is free online and well regarded. etc.
I think python is a good gateway language into functional programming if that's what turns you on, because I found myself employing a smattering of functional methods without realising they were more than just functions, so when I took an introductory class on the topic I realised I already had the beginnings of a functional mindset. It also helps immensely that python is very easy to pick up for a noob.
 

alkinesthetase

<@dtc> every day with alk is a bad day
is a Smogon Discord Contributor Alumnus
meh a lot of languages are picking up first class functions and closures because those features are well established to have HUGE expressive power, but i find the most important thing about functional programming is purity and statelessness (plus a proper understanding of recursion) which is best learned straight from the root (ie common lisp, scheme or haskell). failure to understand basic structural recursion on trees or lists is often a symptom of having never programmed in a pure functional language. fun recursive experiment: return the list of all permutations of a given list, recursively

that said python is well established as a first language. can't speak to why because i don't speak it, but i get the feeling scripting languages in general have this feel (see: ruby). a looser dynamic type system probably contributes to this (probably why scheme is preferred over haskell in education as well)
 
10 year ago, I was gifted the book 'C Primer Plus.' I read it front-to-back in two days, and then started from the beginning, rereading each section, one at a time, while doing the various exercises and general fiddling around. I don't doubt that because of that book, I am able to program just as well in lower level languages, such as C/C++, as the higher level ones, such as C#, Lua, Python, etc. I call it 'the big blue book' (but it's not bigger on the inside, sadly).

As far as what I've done with the knowledge, I've been developing a game framework called "Algae" in my spare time in the past few years. I'm thinking of writing a small C/C++ cross-platform game toolkit, for small projects and so on. Going to focus on the features present in the WinRT environment, so as to make it as portable as possible. WinRT seems to be more strict on the way of loading files and other things in comparison to other platforms (as per the store requirements, you've got to use asynchronous methods, the main graphics library is DirectX, so on and so forth; much different than say, Android or iOS).
 

Woodchuck

actual cannibal
is a Battle Simulator Admin Alumnusis a Forum Moderator Alumnus
As a high school student, I am moderately decent at Java, and I've found that an effective way for me to learn is (after picking up the basics) to jump into a project to force me to actually use those skills. I actually first really picked up Java for a science fair project on neural networks in middle school, and recently used it to write a novel ant colony optimization algorithm for solving the traveling salesman problem... which definitely made me a better programmer.

Also, 90% of all programming classes available to high schoolers are crap.

Once you know the basics of the language (which any competently written beginner book on it should be able to teach you) then putting yourself in a situation to actually apply those skills helps to solidify them. I recommend that any high schoolers reading this thread (especially Americans :]) to do USACO once it starts up again in the fall.
 

michael

m as in mancy
is a Battle Simulator Admin Alumnusis a Forum Moderator Alumnusis a Contributor Alumnus
btw "learn you a haskell" is like 14x better than "real world haskell" as a complete beginner's book although the latter has nice extended examples.

i personally find "structure and interpretation of computer programs" or whatever (sicp) a bit obtuse but it's well regarded as a book on how to program fairly language agnostically.
 

Relados

fractactical genius
is a Battle Simulator Moderator Alumnus
Yeah, I made the naive mistake of wasting time with a programming course in high school - everything's too remedial and slow-paced to make you any good of a coder at all, in most schools. College courses are better, but I still feel like I'm wasting time rather than learning anything useful.

(Who uses MIPS nowadays anyway?)
 

Nyktos

Custom Loser Title
I wouldn't be so down on high school programming courses. It's true that after taking two of them I didn't at all feel like I "could program" but they were fun in a way that uni courses haven't been. (Woo, I made a Battleship game and put anime music on it!) And even just the basic experience gave me a leg up in first-year uni courses that were designed to be doable for people who'd never seen an if statement in their lives.
 

alkinesthetase

<@dtc> every day with alk is a bad day
is a Smogon Discord Contributor Alumnus
hs programming classes in a nutshell http://www.trollope.org/scheme.html

tbf to mips, it is a simple architecture and therefore it's feasible to learn how to write code in it within the span of one or two terms, which is important for 1) compiler courses (which are soo much fun seriously) and 2) actually learning assembly (which is a necessary skill for understanding how hardware works even if you never write it again)
it's true though that hardly anyone gives a damn about it anymore. architectures like mips usually only appear in deeply embedded applications, and usually someone else is gonna be the kernel hacker that makes linux work on those systems so the rest of the world can write C. (unless YOU are the kernel hacker in which case hf) my instructor last term remarked to me that he wanted to teach ARM (much more relevant), but there are no textbooks for the material, so it's hard for the prof to develop a curriculum. where as MIPS, being older, has a shitton of well established books already. and ofc x86 is too large of an architecture to cover in one term, even though it is obviously the most relevant of all.
 

Users Who Are Viewing This Thread (Users: 1, Guests: 0)

Top