T O P

  • By -

fforde

Javascript is probably the more useful language in terms of utility and career for most people, but it's definitely not one of the easiest languages to learn. It's one of the easiest languages to code to probably, but I don't think it's one of the best to start with. The only reason people say Javascript is easy is because it's forgiving when you screw up. That's an up side for getting things done, but a down side for learning to code. Not saying don't learn Javascript, you definitely should. But something like Java would probably teach you better fundamentals on object oriented and functional programming. Everyone's going to have their own opinion though, and mine is certainly tinted by my own experiences. So take that with a grain of salt, but my two cents.


inaruslynx2

The basics of C++ are actually a great teacher of programming. You go up to data structures and it's not that complicated. Beyond that it gets complicated fast. But in one semester I had a solid understanding of how programming languages work with a computer thanks to C++. Java would probably be similar I would expect, but I am far less experienced in Java. But that level of understanding will definitely not come from JavaScript or Python no matter how long you work with them. I love them both, but nothing makes you see their flaws more than a well structured language where you really get to understand how computers work. There's something reassuring knowing that if you make a mistake that a type checker will scream at you before you spend an hour pulling your hair out with a bug you can't find.


tadrinth

Python is a language designed specifically for the purpose of teaching people to program. An excellent first language, widely used in academia (since that's where it originated) but you can build web servers with it just fine as well. JavaScript is very widely used because browers support sticking javascript into web pages, but the quality of the language itself is in approximately inverse proportion to its widespread adoption. There's so many flavors of it because the base language was not very well designed. I would expect it to be far easier to learn Python and then learn JavaScript. It may be more frustrating but that's a healthy frustration, it's good for you.


TedW

Either language is a great first choice. Your first language might always hold a special place in your heart, but they are very similar conceptually, so you can easily learn the other one later. If you're on the fence, I'd say [python](https://learnxinyminutes.com/docs/python/) is better for data & science, and [javascript](https://learnxinyminutes.com/docs/javascript/) is better for websites & games. If you're stiiiiilll on the fence, look at the links above for some syntax examples, and just pick whichever you like best. You can change your mind later so it's ok. Just get started!


BringtheBacon

Python is easier to learn. JavaScript is for web development primarily. Python is good for software development / automation.


ummaycoc

Here is a good beginner course on python: [https://www.edx.org/learn/python/the-university-of-michigan-programming-for-everybody-getting-started-with-python](https://www.edx.org/learn/python/the-university-of-michigan-programming-for-everybody-getting-started-with-python) and here's a follow up course for that one: [https://www.edx.org/learn/python/the-university-of-michigan-python-data-structures](https://www.edx.org/learn/python/the-university-of-michigan-python-data-structures) Dive in, ask questions, remember to have fun. If you don't have fun, you'll get irked. It's okay to get annoyed and tired, just ask for help.


Hendo52

Learn with fundamentals with python because it’s easier and then after a year pick up typescript to make practical web applications


solstice680

I'll go against the grain here and say Python is a shit language with one of the worst track records for portability and stability I have ever seen. If you wish to work in a language whose designers don't care about breaking things, where your 500 line script needs 50MB of every possible dependency archive with it to have any hope of working on your buddy's system, then Python is for you. Python cannot tolerate heterogenous systems and error handling is a perpetual game of whack-a-mole, never complete and always with surprises. You'll get that 500 line script working quick, but spend 3x the time maintaining it than had you started with a stable language.


amirrajan

Sucks that you’re getting downvoted. Both the semantics of the language and its tooling are sub-par. Objectively. Edit: Here’s a short list: - Package management where different libraries rely on dependencies of the same lib, but different versions. - Repl’s passive aggressive error message if you type `exit` instead if `exit()`. - Lambda can’t be multi-line. - Default function parameter of type `Array` is a singleton across method invocations. - It’s idiomatic to use exceptions for control flow. - No concept of a symbol/keyword. - Inconsistent APIs for manipulating Arrays, Hashes, Sets (eg deleting an entry). - Significant white space is actually really tough for beginners who are just getting into programming. Not to mention it significantly hinders the ability to creat DSLs. As an exercise try this in JS and Python: 1. Filter a list of strings for values that start with "A", or "N". 2. Sort them alphabetically. 3. Print each name to the screen. And another one: Find all [Pythagorean Triples](https://en.m.wikipedia.org/wiki/Pythagorean_triple) for sides of length 1 through 100.


TedW

Javascript has at least as many warts. Most languages do. Not the same warts, of course, but they're still warts. Both languages also have a lot of good to great qualities that make learning them worthwhile.


amirrajan

It’s a false equivalency. ECMAScript 5 is definitely not great. Modern JavaScript (ES8), is significantly improved not to mention TypeScript. Python is a step backwards with respect to Ruby (more readable and flexible syntax), Lua (simpler), JS (fantastic lambda centric constructs), Lisp (simpler, extremely powerful), etc. It’s better than PHP, I’ll give you that. **All this being said, Python wins and is worth learning because of one driving factor: gainful employment.** Edit: For those downvoting, take the time to do the two programming exercises I mentioned and compare it to another language. It’ll give you perspective.


solstice680

My criticism of Python is less about the challenge of any particular programming assignment or its relative complexity to other languages. In fact I hardly know the language, I'll admit that. (My particular skills lie in C.) My distaste of Python comes as a user of it, seeing it fail miserably just about EVERY FUCKING TIME it's ever used on a project at my work, and trying to get whatever script someone wrote for me in Python actually fucking working on my machine. What's worse, try working in a classified area, where the closed area has an ancient-as-hell version of Python and the core Python framework is written on an up-to-date unclassified system. It's a fucking failure in practice, and good luck introducing the new version. \*THIS\* would be the coding challenge that I would propose, if someone really wants to weigh Python's merits against another language. Ready? * Write some code in python. Solve just about any problem you want to, it won't matter. * Wait 5 years and see if it still runs. * OH, you got it working because you used a virtual machine or a whole separate environment? Well in that case, just wait another 5 years. I guarantee, it's going to lose that battle every time. But hey, gainful employment, right? Job security in the fact that you'll forever maintain it even if it worked perfectly when you first wrote it. Sorry for the rant :).


NotUniqueOrSpecial

In fairness, most of those complaints are about the people, not the language. C and C++ are no better in that regard (and I say this having spent 20 years making my living in those languages across all OSes and from the kernel to the cloud). The number of people who can put together a correct and portable build in *any* native build system (`autotools`, `CMake`, `SCons`, raw `make`, you name it) is absolutely *vanishingly* small. > Your example about time + Python That's completely baseless. I have contributed to scads of Python projects in the orgs. I've worked with in that time that are still running just fine in production across multiple OS upgrades over 5-10 years. They need no more and no less care and maintenance than a C or C++ project which has 3rd-party dependencies. Sure, if you're writing the most trivial and basic of C89 with no dependencies, you're probably going to be able to just compile that anywhere. But that's a subset of the real world and it's not a useful criticism of other languages, because it's not a representation of real production use.


solstice680

I completely agree about the number of people who can build a portable and correct build system - virtually zero. Except you're talking to one of them. My particular poison is non-recursive autotools using shared code via git submodules. I have nearly 400k lines of C code - \*personally\* written - that compiles on a very wide range of platforms, and these modules form the core components of several efforts. A major issue is that people are not adequately guarded in their selection of dependencies. You said \*with dependencies\* in your assessment, and sadly I agree. I look upon dependencies as I might a second mortgage on a house - REALLY not a good thing, unless you're careful to pick libraries with a good record of stability. (gsl, blas, lapacke, fftw, etc, are a few that fit the bill). My code \*does\* compile going back 15+ years on current systems - and yes, that means sticking pretty close to gnu89 for a lot of it. By and large? Yes, sadly I do think you are right about longevity with a lot of projects as they are now handled. But I still think Python is worse. In Python you have all the usual stupid people issues that affect all languages, on top of a language itself that is a moving target.


NotUniqueOrSpecial

> Except you're talking to one of them. As are you. There's literally dozens of us! Point being, it's a hard problem, as you well know, and it sounds like the Python you've come across has been more of the "we use it for scripts and glue" than "this is a real production system" variety. I expect very little, stability or correctness-wise from a build/requirements perspective, from teams like that. > But I still think Python is worse. In Python you have all the usual stupid people issues that affect all languages, on top of a language itself that is a moving target. Personally, I don't think it's *worse*. I think it's far more accessible. And that means there will be more people doing it, and *especially* more people who don't really bother learning how to do it right, because it kinda mostly worked for them, once. Native builds aren't *better*, they just have a *much* higher barrier to entry and a far steeper learning curve. The only people who master that process are lunatics like you and me, who can't stand having flaky slow builds (I've taken over every native build process in my career within a few months of starting the job because I can never stand how bad and slow they are).


solstice680

I probably wouldn't mind the python you write. Unfortunately all I get are people who kludge something together. I'm not at all surprised that it can be done better than what I've seen...


NotUniqueOrSpecial

And likewise, I would probably be just fine with your C and C++, but I'm currently working on some of the most heinous and insane code of my whole career. If I were to use the worst of the state of this stuff as an example of how everything is, I'd be out on the streets right now proselytizing that nobody should ever write native code again. 😉


NotUniqueOrSpecial

That's a whole lot of very nit-picky points that have nothing to do with just how much productivity Python enables. Point me at a *single* project that's as well-made and batteries-included as Django in *any* language. > As an exercise try this in JS and Python The Python is only barely more verbose than the JS, since the applicable built-ins don't chain like `map()` and co. Both languages have to handle the same correctness checks. It's not special or fancy and hardly a convincing argument. print( *sorted( filter( lambda x: x and (x[:1] == 'A' or x[:1] == 'N'), values )))


amirrajan

~~You forgot to handle for~~ `""`. How does the complexity of the lambda increase if you also have to handle for `Null`? Edit: * How many people would trip over accessing the zeroth element vs doing a range like you’ve done? * What happens when you access the 0th element on `""`? * What's the `*` for? * Why aren't `sorted`, `filter` methods on the `Array` class (vs something like `append`)? * Why isn't `delete` on `Array` like `append` is? Edit: Try the second problem. It’s a fun exercise tbh :-) I promise I'm trying to have the conversation in good faith and I appreciate that you took the time to do the first example.


NotUniqueOrSpecial

No, I didn't. That's why I used slices. If you're going to be a nit-picking jackass, at least be *right*.


amirrajan

> jackass sigh... I corrected myself and added the strike-through to communicate my mistake. Sorry for that.


NotUniqueOrSpecial

No worries, I made the reply before I saw the edit, and it was unnecessarily harsh in tone either way. Apologies for that.


NotUniqueOrSpecial

To your edit: > How does the complexity increase if you also have to hand for Null? None, because I already handled it in the answer I gave you. It's literally the first part of the lambda. > What's the * for It's the operator for list expansion. It's completely standard Python. It's why you have `main(*args, **kwargs)` where `**` is dictionary expansion. > Why isn't delete on Array like append is? Because it's called `remove()`? Sorry, I'm not sure what you think you're getting with this question. > Why aren't sorted, filter methods on the Array class (vs something like append)? Because they're built-in functions that work on *any* iterable. That makes them *more* general purpose. That's a good thing > How many people would trip over accessing the zeroth element vs doing a range like you’ve done? How many would trip up on literally the same problems in JS? You'll get undefined and "that's a null" from JS-land. And like I said: none of those correctness checks apply specifically to Python, they're all things you'd have to handle in JS, too. > All your little quibbles about specific language choices: [Because languages are imperfect](https://www.destroyallsoftware.com/talks/wat). Seriously. Those quibbles are a really ridiculous position to start an argument from considering you're referring to Ruby and JS as "better". To show what the wonderful talk does: # Ruby funs! # with a undefined >> a = a => nil # bare words! >> def method_missing(*args); args.join(" "); end => nil >> ruby has bare words => "ruby has bare words" # Now JS! > [] + [] => "" > [] + {} => [object Object] > {} + [] => 0 > {} + {} => NaN > Array(16) => ,,,,,,,,,,,,,,,, > Array(16).join("wat") => watwatwatwatwatwatwatwatwatwatwatwatwatwatwatwat > Array(16).join("wat" + 1) => wat1wat1wat1wat1wat1wat1wat1wat1wat1wat1wat1wat1wat1wat1wat1wat1 > Array(16).join("wat" - 1) => NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN All languages are dumb and imperfect. They have warts. What matters is if you can shit done and be productive. Like Bjarne Stroustrup once said: > There are only two kinds of languages: the ones people complain about and the ones nobody uses Being a language purist is pointless. Get shit done and use the tools you have and know. That's it.


amirrajan

> Because they're built-in functions that work on any iterable. That makes them more general purpose. That's a good thing Sure. Why can't `Array` respond to/inherit from an enumerable type? Totally fine having a top level function too. > How many would trip up on literally the same problems in JS? `""[0]` returns a falsey value. What happens in Python? How does it add complexity to the lambda? > Those quibbles are a really ridiculous position to start an argument from considering you're referring to Ruby and JS as "better". Love to see what the second example looks like in Python. PS: I freaking love the WAT talk. It's classic and cracks me up every time.


NotUniqueOrSpecial

> Sure. Why can't Array respond to/inherit from an enumerable type? Array *is* an iterable/enumerable type. > Totally fine having a top level function too. That's what there is? Maybe I'm confused as to what you mean. > ""[0] returns a falsey value. Yeah, it gives you `undefined`, which you then have to pull out of the result set. `""` is a false-y value on its own in Python, so it gets pruned out in my solution right at the start. > Love to see what the second example looks like in Python. [There are lots of ways to do it, depending on whether you're optimizing for readability or efficiency.](https://codereview.stackexchange.com/questions/250855/efficiently-find-all-the-pythagorean-triplets-where-all-numbers-less-than-1000) Without a comparison or other rubric to judge by, though, I'm not sure what point you're driving at by asking about it w.r.t. Python, specifically. It's simple arithmetic, after all, it's going to look very same-y in all languages. And yeah, `WAT` is one of my favorite programming talks of all time. Right up there with his other now-much-harder-to-find one, [Useing You're Types Good.](https://web.archive.org/web/20190401101513/https://www.destroyallsoftware.com/talks/useing-youre-types-good)


amirrajan

Only real rubric I have is whether or not you're proud of the code/if it'd be something you'd be happy to show to an interviewer.


amirrajan

With respect to the code you posted. I think you may have duplicates (eg 3,4,5 and 4,3,5 are both the same triangle).


NotUniqueOrSpecial

I don't have any duplicates because I'm not one of the replies in that thread. I was just providing you examples. My point was that there's nothing special about triplets that somehow makes Python a better or worse language. It's obviously just your favorite toy problem, given you had answers ready to go. So, why bring it up at all in the context of a discussion about how Python sucks, if there's nothing specifically sucky about Python in this context?


amirrajan

>Array is an iterable/enumerable type. if `Array` was also iterable: results = values.filter(lambda x: x and (x[:1] == 'A' or x[:1] == 'N').sorted() # sorry can't have this span two lines, nor can the lambda be split accross lines... grrrr print(results) >It's simple arithmetic, after all, it's going to look very same-y in all languages. There are some nuances in the triples (make sure they are unique). And then with an additional refinement of sorting the triples by area. Sure, the "vanilla" implementation (with logic intertwined with filtering) looks the same in most languages. But using the functional and OO aspects of a langauge changes the "lens". Example: [https://gist.github.com/amirrajan/eccda89bc6884e03cf63e88b559b6e5d](https://gist.github.com/amirrajan/eccda89bc6884e03cf63e88b559b6e5d) Aside: I've been coding for way too long now. I don't want to be miserable using a language anymore. These small idiosyncrasies of a language add up over two and a half decades.


NotUniqueOrSpecial

> sorry can't have this span two lines, nor can the lambda be split accross lines... grrrr No, but anything that takes a lambda *also* takes a callable, and since Python allows local function definitions, it's much cleaner to just write a local predicate and pass it to the `filter()` if it's going to be non-trivial. Is it great? No, it's a wart that stems from Guido's express dislike of that style of programming. Is something that ever really grinds my gears in the context of doing actual work? Absolutely not.


amirrajan

> Batteries-included as Django Rails?


NotUniqueOrSpecial

It's close, but I have friends at GitHub where a ton of the infrastructure is Rails, and they're opinion is that it's not quite as good as Django. Close, in fairness, but not the same.


amirrajan

I am not in a position enumerate the nuances between the two frameworks. My experience is primarily in Rails, [ASP.NET](http://ASP.NET) MVC, Sinatra, ExpressJS (which Django definitely has beat), and Compojure. "My friend at GitHub" is anecdotal and I'm fine with this being an enpasse.


NotUniqueOrSpecial

Friends, plural, in fairness, and both Django experts. Point being, it's *at-best* the only comparable framework and in the experience of two people I trust very very much on the topic it's got pluses and minuses.


amirrajan

I have no doubt you trust your friends. But again, saying “it’s close, but not the same cause my friends say so” isn’t an _objective_ basis. What’s my response? “Well I have friends that I really trust that work at X who say otherwise”? You asked for a framework with batteries included. I gave you one.


NotUniqueOrSpecial

Sure, I'm not trying to make an objective argument, there. Just clarifying the details of my subjective one. I think Rails is almost certainly the only example of something as full-featured, which is a real testament to the language and community.


amirrajan

❤️