Where should a programmer with NO static/compiled language exp start learning Go? - static

I'm an experienced software developer, but I've only worked in dynamic languages (primarily Python, PHP in the past, JavaScript, and a little Ruby). Last night, I found myself reading through the tour on the Go website's tour when I realized that the language (syntax, libraries, etc.) would probably be fairly easy to learn, but my lack of knowledge about static/compiled languages would bar me from easy entry. It's not that I don't understand the core concepts of a static language, namely that function argument/variable/return types are static and that a program must be compiled before use. It's more that I don't know where to begin after writing a program. For instance, if I wrote a web application using the Revel framework, it would handle these steps for me (according to the website). Is that pretty typical of frameworks for static languages. Am I worrying too much about a small part of the process that will be quick to learn, or are the (as I call them) formalities of using a static language pretty cumbersome?

As other suggested, any tutorial on Go would work, and you probably worry too much about the dynamic -> static switch. Statically typed languages can be a bit cumbersome sometimes if you come from dynamic typing world, but you'll quickly get used to your compiler yelling at you when types are not correct, and quickly fix it. Eventually, you'll start double guessing it and write (mostly) type-correct code.
Rob Pike noticed that people coming to Go where coming mainly from dynamic languages, which means this cannot be all that hard to do the switch.
There are a lot of tutorials all over the internet titled "Go for ", such as "Go for Rubyists", "Go for Pythonistas" which can help you map your existing knowledge to Go concepts. But as other underlined, the best (only ?) way of properly learning go is to take a tutorial and dive in ! For the books, the standard Effective Go or the very good Programming in Go are very good reads, no matter your background.

Well obviously practice makes perfect, and reading through the extensive documentation. I also find this book really nice Go-lang book, it has some exercises at the end of the chapters which is nice.

Just get a basic tutorial for the language you want and follow it. You will soon pick up how to structure the program. You can then apply your current knowledge of programming to make it do what you want.

Related

NLP libraries for simple POS tagging

I'm a student who's working on a summer project in NLP. I'm fairly new to the field, so I apologize if there's a really obvious solution. The project is in C, both due to my familiarity with it, and the computationally intensive nature of the project (my corpus is a plaintext dump of wikipedia).
I'm working on an approach to relationship extraction, exploiting the consistency principle to try to learn (to within some error threshold) a set of rules dictating which clusters of grammar objects imply a connection between those objects.
One of the first steps in the algorithm involves finding the set of all possible grammar objects a given word can refer to (POS disambiguation is done implicitly by the algorithm at a later step). I've looked at several parsers, but they all seem to do the disambiguation step themselves, which (from my end) is counterproductive. I'm looking for something off the shelf that (ideally) gives me a one-command way to turn up this information.
Does such a thing exist? If not, is there an existent dictionary containing this information that's trivially machine parseable?
Thank you for your help.
Look at CMU Sphinx. An open source NLP project. I think its in C++ but you can integrate it or at least get the idea of how to go about things.
What about calling an external POS tagger as a shell script or wrapping it in an http service if you feel frisky?
Java and Python have the vast majority of NLP libraries so it makes sense to take advantage of that. If you can use NLTK in a script to tag stuff, call this script from C, that makes it much easier.

Making a simplistic video game

I'm thinking about creating a simplistic video game. I'm not talking about anything fancy, but about a game like this:
Since I want to learn, I would prefer not to use libraries but roll as much as I can on my own. I'd need to know how to render the car and the track, deal with collision with other cars, etc. I'm targeting Linux, Mac OS X and iOS. I fear that using a library like OpenGL makes things "too simple".
Are there any good resources out there that discuss this? Most of the tutorials / papers I have found are based around popular libraries & engines.
" I fear that using a library like OpenGL makes things "too simple" "
Don't worry, you still have plenty of work left.
In the REAL world, programmers use as many libraries as they can, that is the only way to produce a applications that focus on how things should work and not spend years on every little feature.
Start out programming above libraries, then, if you want to divide down into details, implement your own library and replace the one you used with it.
Dividing your application into self contained parts is a good practice, makes changing it without breaking everything possible.
Also, I would recommend you learn C++ first. Being able to model your problem domain with Object Oriented methodologies will help you break down the problems into solvable units.
Sounds like you're interested in learning from the level of Simple DirectMedia Layer.
If so, this might be a good place to start: http://gamedevgeek.com/tutorials/moving-sprites-with-sdl/
Probably followed by: http://www.gpwiki.org/index.php/SDL#Creating_a_Complete_2D_Engine
Also, for that particular rendering style, see:
http://en.wikipedia.org/wiki/Parallax_scrolling#The_raster_method
http://en.wikipedia.org/wiki/Mode_7
Edit:
This information about the original Doom engine may be useful:
http://fabiensanglard.net/doomIphone/doomClassicRenderer.php
Also, Chocolate Doom is a port of the original Doom source into SDL, so you'll probably learn some useful patterns studying the source for it:
http://www.chocolate-doom.org
It will be more or less impossible to develop a game without using any library. I guess you would have to go back to good old C64 days to do that. If you are interested in learning, I would look for a more low level library, which provides access to graphics, sound, ... But it should leave the logic to you.
I would propose to have a look at http://www.pygame.org/. It makes working with graphics, sprites, ... easy, is still relativly low level and Python is a great language to get started with.

Interesting examples of Domain Specific Languages

I'm considering doing something with Domain Specific Languages for my undergraduate project. My one problem is I can't really find any interesting examples that I can root around in. Does anyone have any good examples of DSELs (preferably open source)?
Also, one area I would love to look at is solving/addressing concurrency problems (coroutines etc) with DSEL's. Are there any good examples that anyone uses of this in DSELs? If this is a stupid application of DSELs please explain why...
Another potential area to explore would database programming. Again is this a stupid area to explore with DSEL's. For example, would adding some crazy database manipulation syntax to C# say be a good project to undertake?
EDIT: General languages I would be looking at implementing in would be Java, Python, Scala, C# etc. Probably not C++ or C.
Linda implementations can be considered as eDSLs. STM implementations like CL-STM are certainly eDSLs.
Unrelated to concurrency, but extremely useful are embedded Prolog implementations, there are plenty of them for Scheme, Lisp and Clojure. Parsing eDSLs had been mentioned already - and their patriarch Parsec definitely worth digging into.
EDIT: with your list of implementation languages you're missing the most interesting eDSL opportunities. The most powerful and flexible eDSLs are made with metaprogramming. Scala-style (or even Haskell-style) eDSLs are based on high order functions, i.e., on mini-interpreters. They're more complicated in design, much less flexible and limited to the syntax of your host language.
boost::spirit if you're after C++ is an interesting example. Quote:
Spirit is a set of C++ libraries for
parsing and output generation
implemented as Domain Specific
Embedded Languages (DSEL)...
(I have no idea what you mean by "solving concurrency" though. I don't see how you can solve "concurrency problems" in general, or how a DSEL could help.)

What are some practical projects to consider in trying to learn C?

I've seen a lot of questions and answers on SO about why I should learn C. I know that it's low level, it'll give me an understanding of how things work at that level, and it'll make me a better programmer. I know some good books to be reading to help me learn C.
What I don't feel like I know are some practical projects I can work on to help me learn how the language is used. There's a lot of examples in the books I'm reading, and they're absolutely useful as far as reinforcing knowledge gained about the language itself. But I don't feel as if I'm gaining any insight into "real life" examples of what I can do with C.
My background: I'm a recent college grad who's doing application programming in C#. I'm enjoying doing programming exercises in C -- but I just feel like they're exercises. I know obviously I'm not going to become an expert right away and start doing amazing things. I just want some ideas for things I can do to help me become better but that feel like more than just exercises. (I want to clarify that I'm not opposed to doing these kinds of tasks to help me learn about the language. I just think I'd get more excited about learning if I was doing something that seemed more practical in nature.)
If this is "not a real question," I truly do apologize, and I know questions about learning C are all over SO. I'm not trying to be repetitive. I'm sold on the idea that I should learn the language, I just want to be able to have some real ideas of how I can start applying the knowledge.
See Also
What is a good first C app to build, besides “Hello World”
Here's some ideas for you to try:
Store a file containing hashes of every file in your music directory, and report on changes.
Solve a Sudoku in the shortest possible time.
Send a file using TCP to another computer. (Write both server and client).
A program that broadcasts a list of public files (configured in a text file) over UDP, and then accepts TCP connections to download them.
A command line POP3 client.
Write a memory allocator, and hook into malloc.
Congratulations on deciding to learn C. It is the most powerful language on Earth, and will give you the foundation you need to kick some programming butt.
The way to learn C would be to try out POSIX compliant samples from any operating system book.
My seven step guide to finding something code wise to do :)
find something you like or enjoy(preferably IT related)
find a problem with it, or some way to improve it, else goto Step 1
split the problem into logical parts, these will represent functions and structures, use a piece of paper if it helps you visualize the problem(this is what I some times do)
devise your plan of attack, ie: how will you implement what you came up with in Step 3
Code, Learn, Test, Learn, Debug, Learn, Improve, Learn and Code & Learn some more
Done, but not really, this is when you review what you've made, marvel in all its glory, and learn from all its mistakes and problems. see what parts you enjoyed, what parts you hated and what parts you can still learn more from.
goto Step 1, using the knowledge gained from Step 6 (and all the other steps along the way)
If you run out of things to do and want to be productive in a commercial sense, see if you can talk to people who work with computers/IT systems/etc as a daily occurrence in their job and see what happens them and try develop ideas that could improve their productivity and/or the ease with which they can perform their task(s), who knows, you may end up with some extra knowledge and some extra cash
See what are the things you enjoy doing in real life and try to use them in an application. For example if you like games, try to make a game or if you need an idea, remake a classic. If you like accounting, try to make an accounting application with a proper interface. If you are not passionate about the idea, then you'll probably get tired after a while and throw it away.
BTW, I think you're on a good path and I like the decisions you have made so far.
Write a compiler for a subset-of-C.
There are some Artificial Intelligence competitions that are both practical and fun. These will help you learn the language, encourage your understanding of any sample code, basic debugging and implementation of common algorithms.
Most importantly it's fun, so it keep will keep you motivated to keep learning.
For instance a few months ago I enjoyed the Google AI challenge: http://csclub.uwaterloo.ca/contest/
Good luck and enjoy :)

How have your ideas about C programming practices changed in the last ten years?

Object-Oriented programmers seem to have all the fun. Not only are they treated to major framework revisions every two years, and new and Improved languages every five, they also get to deal with design practices tailor-made to their programming style. From test-driven development to design patterns, Object-Oriented programmers have a lot to keep up with.
By contrast, the C programming world seems far more sedate. The last major revision to the language was in 1999, and the next one is likely to be far less impressive. K&R 2nd edition is still held up as a good introductory text by many, despite being twenty years old now.
If we, as C programmers, have developed and improved our skills and practices (and I think we probably have), we don't seem to be very good at communicating them. We don't sell books about them, post about them on blogs, or organise workshops around them. Not in the way the rest of the software development world seems to.
So, let's share.
What are your preferred 'modern' C programming practices?
Do you use `template' libraries of long, involved preprocessor macros to squeeze the last inch of performence out of hardware in the same way C++ programmers can? Do you use a allocation library like halloc to minimize the time you spend on managing memory, or do you use a full-blown automatic garbage collector?
Of course, if you've been using these things since 1987, feel free to chime in as well; the point of this question is to share practices that are out of the ordinary but might benefit others.
What are your preferred 'modern' C software design practices?
Design considerations are at least as important, of course. Do you adapt design practices from the Object-Oriented world? Do you use UML? Or you opt to iron out specifications in a language-neutral style (flowcharts, Z, weakest precondition calculus, anything)?
I try to use ready-made libraries for basic functionality when possible. I find glib (part of the GTK+ GUI framework) absolutely brilliant when it comes to general data structures and such. No more writing your own hash table, linked list, dynamic array or whatever.
I also think the object-oriented ideas in the GTK+ toolkit are great, and often structure my code the same. There's nothing stopping you from adopting paradigms in C, it's flexible enough to express many things that are just made "first-class" in other languages, even if doing so often involves a certain ... verbosity, of course.
Not really a C programming practice, because I'm one of those newfangled object-oriented programmers working in C++, but this:
Object Oriented Programming is not a silver bullet
I wish my company had more pure C programmers to teach the juniors that there is life beyond Object Orientation.
To be honest, my answer would be that I finally gave in to C++ after fighting it for a long time. I've come to really enjoy its advantages.
I like being able to let the compiler take care of the OO plumbing, being able to use exceptions and RAII instead of littering return codes and resource releases all over, not reimplementing a linked list or an automatically expanding vector or a smarter string library for the umpteenth time, operator overloading instead of vector_add() everywhere, etc. Granted, there are libraries for much of this in C, but it seems like such things are rather fragmented between competing solutions. It's nice having such amenities standardized in C++.
The nice thing is that I'm still free to drop down and do all the stuff I might have done in C if I feel like that's what suits the program best. There's no OO straight-jacket like in Java.
1999: Use C, it is fast, low-level, efficient
2009: Use Python, it is fast-enough, productive, multi-platform, popular and fun

Resources