5 ms·
Just in case the author is present in the thread: Your blog is extremely difficult to read on wide screen monitors. The entire left 50% is basically just blank
by scriptkiddy 9y ago
Just in case the author is present in the thread:
Your blog is extremely difficult to read on wide screen monitors. The entire left 50% is basically just blank space. My suggestion is to make the left side maybe 20% width on desktop or less.
Also, regarding the article content:
There really aren't any good reasons presented here about why you moved from Python to Javascript for back-end web development. It seems that you simply prefer Javascript semantics. There's nothing wrong with that, but the title is misleading considering that the bulk of the article is actually about which JS tools you use on recent projects and not why you moved.
Also, could you clarify what you mean by
> Also, there's no acceptable way to pass a function body to another in Python.
Functions are first-class in python and can be passed as arguments to other functions. I'm not sure I understand what you mean with the above statement.
Cool to see someone else has been using Nuxt though.
- haikuginger 9y ago> Functions are first-class in python and can be passed as arguments to other functions. I'm not sure I understand what you mean with the above statement. I believe the author is referring to inline definition: setTimeout(function(){alert("Timed out!");}, 5000) You can do something similar with lambdas in Python, but the allowed syntax is relatively limited compared to a full function definition. You could also define an inline function, but it'd be in a separate statement from the call you make with it. Unfortunately Python doesn't allow for creating and returning a first-class function in a single expression.
- 9t3h4r3o5w1a4w2 9y agoPython has lambda but they are one liners. There is no way to do write this in Python: someFunc( _ => { // this is // a function // with multiple lines }) Having to define a named function to use it as a callback is a pain in the ass. Python has an excellent standard library but the language itself is pretty mediocre IMHO. Classes are an afterthought thus verboses, as so is "functional programming" in Python. JS biggest issue is that it is not strongly typed enough. But ES2015 makes it really pleasant to use.
- anentropic 9y agothe problem is callbacks as a pattern if you have a multiline function it should be named and unit-tested instead of just stuffed anonymously into some pyramid of doom
- 9t3h4r3o5w1a4w2 9y ago> if you have a multiline function it should be named and unit-tested instead of just stuffed anonymously into some pyramid of doom It's like saying all data should be declared as variable, in the functional programming paradigm, functions are data. That's why closures are useful. And it has absolutely nothing to do with unit-testing, that's beside the point. Javascript is not harder to unit test because it has fully featured anonymous functions.
- mixmastamyk 9y ago> Javascript is not harder to unit test because it has fully featured anonymous functions. It is if you actually use them. ;)
- anentropic 9y agowhat does functional programming have to do with it? you still unit test functions in functional programming surely? > It's like saying all data should be declared as variable, in the functional programming paradigm, functions are data. That's why closures are useful. I don't think you understand what you're talking about. We were already talking about using 'functions as data', and closures and anonymous functions aren't the same thing. But anyway, how do you unit test an anonymous function? I assume you mean that you don't, you just test the bigger context around it. But that was my point, once your anonymous function starts becoming much bigger than a one-liner it ought to be tested itself.
- mmmpop 9y ago>> Having to define a named function to use it as a callback is a pain in the ass. Happy debugging!
- 9y ago
- jgalvez 9y ago> Your blog is extremely difficult to read on wide screen monitors. The entire left 50% is basically just blank space. My suggestion is to make the left side maybe 20% width on desktop or less. Thanks, I'll take a look when I have a chance. I myself don't own a widescreen monitor, the site looks fine on my MacBook and several other computers. It's not a paid job, not a lot of effort went into it ;) > but the title is misleading considering that the bulk of the article is actually about which JS tools you use on recent projects and not why you moved. Hm, actually, it's not. I'm surprised by this comment. I point out precisely the JavaScript features that weighed the most in my decision: "So with JavaScript you've got arrow functions, the method shorthand definition syntax, the spread operator, destructuring assignments, all functional Array methods and async functions. Combined with Vue's minimal patterns and Nuxt's conventions, I can't think of a better language to write web applications in." > Also, could you clarify what you mean by > > Also, there's no acceptable way to pass a function body to another in Python. Exactly that, a "function body", "closure", "inline function", whatever you wanna call it. In Python there are lambdas, but they're limited and not even encouraged anymore. We're left with passing function references, and that's where JavaScript comes out the winner IMHO.
- CuriouslyC 9y agoPython absolutely kills Javascript in the library department (particularly when it comes to doing stuff with tabular data). In my opinion the APIs for the built in data structures are also more intuitive and flexible. The __method__ protocols are also very elegant relative to what Javascript brings to the table. Of course, if you aren't doing anything fancy with data this point is partially moot. I do admit that Javascript's object and array destructuring is extremely nice. The combination of destructuring and the spread operator makes working with heavily nested JSON much more enjoyable than in Python.
- pseudalopex 9y ago"Anonymous function" is the term you're looking for. Lambdas are still encouraged for trivial functions; the only thing that's changed is that comprehensions have replaced many uses of map and filter. Python just requires you to name non-trivial functions. IMHO, complex/nested anonymous functions are usually bad for maintainability, so I'd rather have a language that doesn't allow them (Python) than a community that overuses them (JavaScript).