Thread: Programming!
View Single Post
Old March 4th, 2013 (4:39 PM).
twocows's Avatar
twocows twocows is offline
Pretentious Intellectual Jerk
Gold Tier
Join Date: Mar 2009
Location: Michigan
Age: 25
Gender: Male
Nature: Lax
Posts: 4,097
Quote originally posted by Archenoth:
Aye. No worries.

Also, I suppose that is where we differ. As an abstractions guy who likes the functional paradigm, I like context-sensitive code. While I'll admit it can be terrifying in the hands of an inexperienced programmer, if you utilize it well, you can make some stupid-powerful abstractions.

For example, I implemented an entire AJAX REST API using a single larger context-sensitive function, and a bunch of smaller functions calling it in various ways in JavaScript. I just committed it into a Github repo so you can see what I am talking about. (Hopefully this code wont give you an aneurysm, since it is by no stretch of the imagination in your style.)

(This abstraction is incomplete currently, and yes I am using jQuery as a crutch currently.)
This is the large dynamic function...

This is where all of the public smaller functions are...

Every one of those functions can be called with a callback function to call with data after the function is complete, they all provide the correct type of requests to add, edit, remove, update, and view things from the database. (With some further abstraction to combine functions to just store JavaScript objects in general if you are unsure of its status.) You can set a number of flags that modify how the function works by passing different data types, including how the function responds. You can do everything from:

Code:{"name":"Archenoth"}, function(data){
}); add a user and echo out what it looks like in the database to:
Code:{"name":"Archenoth"}, 1); update the user with the first ID with an awesome name to:
Code: add the user if it doesn't already exist but to update it if it does.

It all depends how you call it and that's not even scratching the surface of what it can do.

As you can see, you can squeeze out a lot of functionality by overloading things and by making context-sensitive code. The fact that I don't have to write a lot of code to get crazy amounts of functionality is something that I love.

The fact that I write like this makes me not care much about overloaded operators in languages, because I deal with similar risks all the time.

The thing about Python is that it is a very solid language. (From what I understand anyway, please correct me if I'm wrong.) There is usually one right way to do things, which makes the code into something that is relatively easy to read regardless of the author. Then there are languages like Perl (Yes, the code above is JavaScript, but it is written with Perl-like argument parsing for the request function.) that utilize the whole TIMTOWTDI ideology, which means I have the ability to make some really cool things, but also really really horrible code if I misuse it.
As long as your code's maintainable. If I have to go through a bunch of hoops to understand what you're doing, that's not good.

Quote originally posted by Archenoth:
I'd say go C first... The things you pick up when learning C can be translated to C++ relatively easily. Also C is a really small language. It will make you work with pointers, with memory allocation, and quite a few low-level functions. It is also really portable if you avoid using system calls.

As for between Java and Python...

I recommend Java because Java is a lot more popular, and a lot more ubiquitous... (Your C# knowledge would come in handy when learning it too.) It has a lot more real-world usage currently (I mean job-wise.) so knowing it would be an asset if you were to become a professional developer. But you could choose Python too if you want, but I can't really speak for Python since I don't know it.
Java's a dying language. Python's more popular now. The only real remaining uses for Java are Android and companies already stuck with Java.
Doctors Without Borders: one of the few charity groups you can rely on to actually do real good in the world.

"The trouble with fighting for human freedom is that one spends most of one's time defending scoundrels. For it is against scoundrels that oppressive laws are first aimed, and oppression must be stopped at the beginning if it is to be stopped at all." - H. L. Mencken, unsourced

"There is a cult of ignorance in the United States, and there always has been. The strain of anti-intellectualism has been a constant thread winding its way through our political and cultural life, nurtured by the false notion that democracy means that 'my ignorance is just as good as your knowledge.'"- Isaac Asimov, Column in Newsweek (21 January 1980) [source]
Reply With Quote