|
A few years ago I worked on a project that used Coffeescript; but because it had to be transpiled into JS the code I was debugging in the browser looked nothing like what I wrote, making it far more miserable to debug.
If/when not-JS can be natively debugged in all the major browsers (Chrome, Edge, Firefox, Safari) it might be time to consider an alternative; until then I'll stick with the devil I know.
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, weighing all things in the balance of reason?
Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful?
--Zachris Topelius
Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies.
-- Sarah Hoyt
|
|
|
|
|
The question was 'Assuming you need to write JavaScript'
so I chose TypeScript because my understanding is that it has some form of type checking.
|
|
|
|
|
jQuery still offers some simple niceties that they have at best been jammed into javascript over the years.
$(".my-class").removeClass("jim");
let elms = document.querySelectorAll(".my-class");
elms.forEach(function(elm) { elm.classList.remove("jim"); });
|
|
|
|
|
… and would pass on any position that required it.
Weakly-typed languages are IMO too error-prone for production work, and any layer such as TypeScript is only putting lipstick on a pig.
</rant>
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
Not only weakly typed, but interpreted as well. Both are evil. I detest both "qualities".
Tell me what I do wrong as I type, or at the latest when I run the compiler. Tell me for all my code, not just the code lines being executed at one specific run. Tell me where there might be problems - I'll flag it as OK if I know what I am doing.
The first C++ compiler I worked with compiled to K&R C (and the C++ compiler was written in K&R C). That way, Strostrup could in a single go offer C++ compilers for "any" machine regardless of instruction set or libraries. K&R C was treated like the instruction set of a virtual machine.
Maybe JS could be treated a similar way. Write your application in a typed, compiled language and have it compiled to the instruction set called JS, for execution on any virtural JS machine. That is the only decent way to make use of JS. You should be as much (or little) concerned about the JS instruction set as you are of the x64 instruction set.
|
|
|
|
|
I feel the same way about javascript that I feel about VB. Get a shovel, dig a deep hole, bury both of them, then bury the shovel!
|
|
|
|
|
Haters are going to hate....
All languages are just syntax. They are tools. Used properly, they work.
If you cut your toes off using the shovel, are you going to hate the shovel?
Or should you focus on your own lack of skill / inattentiveness while digging the hole?
Oh well....
|
|
|
|
|
When people write that about VB it just sounds like they're not very good at writing VB.
|
|
|
|
|
I was being facetious. I spent many years developing UI's with VB6. I figured with my wise ass comment I would make people's day and have some fun in the process.
|
|
|
|
|
Glad you're just joking, there are a lot of code snobs around who think VB/VBA are "toy" languages, just like whenever you post a question about MS Access the "geniuses" post comments like "Access is crap, use a real database like SQL Server or Oracle" etc.
|
|
|
|
|
|
|
Daniel Pfeffer wrote: Weakly-typed languages are IMO too error-prone for production work
I believe the main problem about this misconception is because you don't work with it. In fact if you take Stack Overflow's statistics JavaScript outweighs C# twofold and it's more used than any other language. I suppose if we extrapolate that fact we can assume there are more Javascript based production environments than anything else. It would be very dangerous to assume Javascript is not suited for production with the amount of work out there.
There are many ways to ensure good code quality on JavaScript with linters and automated CI tools that runs automated code analysis plus unit tests (if you don't do these, no matter the language you program in, you're in deeper trouble than the choice of language). If you have a good test coverage it almost completely mitigates the weakly typed disadvantages.
Daniel Pfeffer wrote: TypeScript is only putting lipstick on a pig.
Not really. It's not a layer, in the end it's just a means for writing JavaScript in safer and more organized way. Which addresses some of the weaknesses of JavaScript. In the end TypeScript gets transpiled to JavaScript. So maybe, roughly 70% of programmers works with pigs
To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson
Our heads are round so our thoughts can change direction - Francis Picabia
|
|
|
|
|
Fabio Franco wrote: So maybe, roughly 70% of programmers works with pigs
Given the quality of the code and especially designs I see daily I'd say that 90% of them should work with pigs - and stay the fark away from a computer.
GCS d--(d+) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
|
|
|
|
|
Despite its many weaknesses, it also has many strengths. The trick to using Javascript well, it to know which is which. The best book I have read on Javascript (and in fact the only one I own personally) is "Javascript: The Good Parts" by Douglas Crockford. It's the only book you'll ever need.
"There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult." - C.A.R. Hoare
Home | LinkedIn | Google+ | Twitter
|
|
|
|
|
No hooks in my code - works anywhere, everywhere.
The only frameworks I use (per the context of the question) are the ones I write myself.*
* I don't count ZEND w/php - am I wrong, here?
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
I don't have to write anything in XXX-Script
...
...
yet
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Web Development - C# in the Browser with Blazor[^] - being able to dump JS and run a "real language" with a good, solid framework behind it in the browser instead?
Gotta be worth it if it gets released properly.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Sounds awesome in a "too good to be true" kind of way!
Whenever you find yourself on the side of the majority, it is time to pause and reflect. - Mark Twain
|
|
|
|
|
That's why "if it gets released properly".
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Somehow I suspect that a proper release will be the first of a million problems, especially those of an "Oops! It won't work with our browser (cos' we've made damn sure it won't)" variety.
Whenever you find yourself on the side of the majority, it is time to pause and reflect. - Mark Twain
|
|
|
|
|
Just curious...hasn't 'text/C#' been an option for script tags for a really long time even though I've never seen it used?
"Go forth into the source" - Neal Morse
|
|
|
|
|
It looks nice, but I haven't tried to use it yet.
CQ de W5ALT
Walt Fair, Jr.PhD P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
I tried TypeScript, which I thought would solve all the problems I have with JavaScript, but it's really just JavaScript with more syntax.
Maybe it's something like Stockholm Syndrome, but I've come to appreciate the flexibility that JavaScript offers.
That said, I try to minimize it because it's still JavaScript
|
|
|
|
|
I tried TypeScript.. and just from the day 1 completely forgot about pure JavaScript
Microsoft Certified Solutions Developer.
|
|
|
|