Programming languages for beginners. Is Javascript all right?

_Shadow_

Tech Magician Level:
Moderator
Joined
Mar 2, 2014
Messages
4,078
Reaction score
2,654
First Language
Greek
Primarily Uses
RMMZ
This thread is not directly related on coding or programming in Javascript, but on sharing thoughts about some things on Javascrpt, so I post it on General Lounge.


First off a WARNING. I am neutal to Javascript. I love to hear different opinions and that is why  I create such threads. But if any random wild drama queen emerge, I will be the first person reporting this thread to close. So, NO DRAMA. Nobody is against Javascript and this thread is not a debate on "What programming language is the best?". There is no answer to that anyway. The programming language that solves your problem optimal for YOU, is the best programming language for YOU, for the CURRENT job YOU do. Everyone has different needs, end of disucssion. The topic is different and I hope better than that.


So I realized, that everyone teaching Javascript these days tell people that  new properties and methods can be added to objects at any time in a program.


This is true and one thing that makes Javascript flexible, but it is also a huge problem. That is taken most of the time wrong. And it's not the learner's fault. What is wrong is that the prototype design must be correct and solid. Otherwise bad things can happen. The bad attitude that has passed through weak tutorials is that if someone will declare a prototype, but if the design is weak and wrong, "oh well, they can fix that by adding something here and there".


THIS is one of my greatest objections on JS as a "first learning programming language" or "learning programming language" in general. It gives you the power to make terrible code that will actually work. Most people think they know how to program, while they make code ready to be served to an italian restaurant (google spaghetti code).


There is a debate:


"If it works, I don't really care. It works for me."


True. But what if you revisit the code after six months and don't remember what on earth is going on? Commenting will not help a loose design.


Most important what if your code is about to be shared with other people? What if you make a plugin for instance?


Making solid prototypes helps you make solid code, without adding or removing much attributes or methods everywhere. That makes the code easy to maintain, debug, expand and modify, while having a loose approach can make it very hard to maintain the code.


So after sharing some thoughts, here comes a bunch of questions.


1] Do you believe that solid prototypes should be taught or not? Do you believe it is an issue that newcomers in JS create terrible code sometimes? I met many IT guys telling me they hate Javascript. But what I realized after long conversations was that they don't really hate the language. They hate how people use it.


2] Do you believe JS is good for beginner programmers? From one side they can make spaghetti code, on the other hand, you got ease and flexibility. I mean it is REALLY debateable. I learned to code in QBasic when I was 14 years old, when all I had was terrible code examples full of GOTO commands. I am dead serious, there was no internet back then. But I ended up programming well and if you ask me, QBasic wasn't a bad language. I just lacked a good tutorial on structured programming.


3] Tell me a few things you LOVE on JS.


4] Tell me a few things you dislike on JS.


I want to get a bigger picture and maybe this thread would be useful to more people in the future.


P.S. My JS level is newcomer, but I learn really fast, because I already know how to code on several other languages. STILL I am a noob on JS and that's why I make such a conversation.
 
Last edited by a moderator:

taarna23

Marshmallow Princess
Global Mod
Joined
Jul 20, 2012
Messages
2,402
Reaction score
4,966
First Language
English
Primarily Uses
RMMZ
I dunno. I learned Java first, but I don't think JavaScript is a bad one. It will be what my daughter will be learning first in school.


As for your questions/points...


1 - Lots of people hate JavaScript. It tried really hard to be Java, but in a different environment with a different use case, and causes confusion, as we see around here. Also, some things it does are stupid. Amusing, but stupid (see here: https://www.destroyallsoftware.com/talks/wat).


2 - I still make spaghetti code. I've made a workable random dungeon script that I may well never release into the wild just because it's a total nightmare. It works, but I wouldn't want to provide end-user support for it. Ugh. Everyone, when they're starting, writes spaghetti code. But as you get your code reviewed, you learn how to optimize (just don't get obsessed with this - code optimization is a whole other can of worms).


3 - I love that the syntax is close to Java - but I have a bias, as I learned Java first. I like that it tries to keep things simple. While that feels complicated at first, once you find yourself on level ground learning-wise, it gets really easy to use. Heck, I pulled off successful recursion in it, and that's one of the most hated aspects of programming at large.


4 - I hate some of the stupid things (link above for the big ones) and I hate that it was named JavaScript. I'm surprised that was ever allowed, really. Also, coming from a recent job where I almost exclusively used Visual Basic, the various brackets, braces and parentheses are going to make me crazy, right along with the semicolons.
 

nio kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,949
Reaction score
3,042
First Language
French
Primarily Uses
RMMV
I will add a pinch of salt because I think this interesting.


1] If you mean by solid prototype you mean actual OPP way of the JS, then yes it's something it's should be learn. Simply because it's save times, make your code more stable, and readable.


2] it is but in same time it's not due the fact it's lacks strict debugger it's can make the language even more complicate to use because if you example forgot a semicolon then your code will 'work' but  in a really undesirable way or just not working at all. This Why I use Typescript combined with Resharper for force a REALLY powerful intelisense.


3] I like the fact that if I need to extend a class I can just easily rewrite one function and fix something.


4] those damn semicolonnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn and the lacks of Private variables.


oh and the fact that peoples doe really messy code just because it's quicker but it's f*cking unreadable lol.
 

_Shadow_

Tech Magician Level:
Moderator
Joined
Mar 2, 2014
Messages
4,078
Reaction score
2,654
First Language
Greek
Primarily Uses
RMMZ
@taarna23 Ah! Visual Basic. My diplomatic was to develop a teaching course material for it. An easy to use language but it has its weak points. Like how you handle multi dimentional array redims. Also one bad thing it has when it comes to teaching, is that the symbol "=" is the value assignment operator and also the value comparison operator. It is essential to start with a programming language that makes it clear that for instance = and == are different.


As for https://www.destroyallsoftware.com/talks/wat  I really thank you, I had a great laugh!


Well yes, my point is that JS should be start being taught, like it being a strict type language.


As long as people would know how to do stuff the right way, then you teach them how flexible JS is and THEN they will also appreciate it I suppose.


I mean I do; I learned Java first and never regret it. I also love python. But JS is also a great scripting language to use.


The problem is people using it reclessly. :p


@nio kasgami


1] Bingo. Exactly that. It also makes the code easier to debug, maintain and expand.


2] Oh!!! Let me paste this link here. https://www.typescriptlang.org/


Didn't know that such a thing existis. Now that is interesting!!!


3] Correct. You can fix fast something. Boom done. But if you have to do a few changes here and there, you know you may kiss goodbye to the consistency of your code. :p   And this is my point exactly. As you mentioned at your andswer to [4] people can create really unreadable code.  Ont the other hand, such flexibility is really REALLY a very helpful thing at the right hands, especially in cases that time is of the essence. It helps if things are well designed.


4] Semicolons, yes of course. As for not private variables, yes it goes against encapsulation indeed, but at least Js has some local vars. :p  
 
Last edited by a moderator:

Mister.Right

Veteran
Veteran
Joined
Mar 7, 2015
Messages
249
Reaction score
83
Primarily Uses
I love this " Array is Object, Object is not Array " same as " My name is M.Right, M.Right is not my name "
 

kaukusaki

Awesome Programmer Extraordinaire
Veteran
Joined
Jun 27, 2013
Messages
707
Reaction score
529
First Language
English
Primarily Uses
RMVXA
Love hate relationship with JS.


I learned JS a decade ago. I just got back into it using OOP structure and I realised the spaghetti way i learned then gave me poor coding principles lolz. I love JS to death but it's easy to miss a damn piece of code to wreck the whole thing (glares at semicolon).
 

_Shadow_

Tech Magician Level:
Moderator
Joined
Mar 2, 2014
Messages
4,078
Reaction score
2,654
First Language
Greek
Primarily Uses
RMMZ
I learned JS a decade ago. I just got back into it using OOP structure and I realised the spaghetti way i learned then gave me poor coding principles lolz.


I can feel you. Actually JS wasn't designed to become what it is now. It is fantastic that it became a very popular and trendy language. More important it had prototypes and now it supports classes. :)  
 

mogwai

1984
Veteran
Joined
Jun 10, 2014
Messages
875
Reaction score
591
First Language
English
Primarily Uses
RMMV
I had to Google spaghetti code because I'm a web designer, not a programmer. I see what you mean. I've dealt with some pretty big meatballs writing userscripts to modify Tumblr. (some of my scripts are popular on Greasyfork.) The web console helps a lot. I'm self taught from Google and I'm still learning from back to 2007. My scripts aren't elegant, but they get the job done.


I notice MV has a web console thing too (F8). This is a good way to learn the game objects with console.dir();, JSON.stringify(); etc. 'cept in the Mac version there is no copy/paste. This kills me because I'm too lazy to remember big worded functions; I want to copy the injections I just typed to use in my scripts.


Though what would be better than dissecting that big mass of spaghetti via console, would be an actual online manual the likes of php.net or api.jquery.com with a basic function/object description + 1 or 2 working examples. The javascript in MV makes me feel like a newb again because it's like switching from jquery to prototype.js only even more foreign than that.


One thing I like about the javascript in MV is that it's not really spaghetti compared to the massive recursive monster window.Tumblr on Tumblr I've been working with.
 
Last edited by a moderator:

DoubleX

Just a nameless weakling
Veteran
Joined
Jan 2, 2014
Messages
1,787
Reaction score
939
First Language
Chinese
Primarily Uses
N/A
Before answering, I'd like to declare that I've only 1.25 years of Javascript experience(and I'm a very slow learner :D ), which is exclusively ES5, so I'd like all of you to know that these answers are from a nub's perspective.

I think the 2nd question, as with almost all programming languages lies on at least 1 of the common cores: The agendas of those beginners themselves.


As far as I know, Most beginning programmers will have to follow this rather natural path of growth when learning their 1st programming language:


1. Learn the programming language syntax


2. Learn the basic programming concepts


3. Learn how to write easy, simple and small codes that can deliver basic, crude and straightforward functionalities


4. Same as 3, except that those codes also have no nontrivial bugs(i.e.: learn basic debugging)


5. Same as 4, except that those codes also have at least decent code qualities(i.e.: learn basic code quality concepts)


After that, those programmers are usually no longer beginners, even though they'll still likely make an utter mess when writing colossal, complicated and convoluted codes.


P.S.: I personally think that solid prototype isn't on the beginner level at all, and I won't be surprised if teaching it to beginners has caused lots of them to write terrible codes ;)


Here's where the agendas of those beginners themselves come into play. In other words: Which step, after being reached, will cause a paricular beginning programmer to feel satisfied?


In the case of Javascript, I think it's generally quite good for step 1 - 3, at least when compared to Java, which has a strict typing system(a safety construct which is usually treated as obstacles by many beginners) and much, much more boilerplates, including the necessity of classes.


For step 4, Javascript usually isn't that ideal for teaching beginners proper debugging(let alone tools like JSLint, automated unit tests/property based tests), as the insane flexibility(weak type system, dynamic programming, prototyping, etc) of Javascript on the obviously unskilled hands nearly always end up with really dangerously elusive hacking, like the infamously dreaded callback hell. Their codes will probably become harder and harder to read and reason with, and/or worse, have even more nontirival bugs than before.


For step 5, due to the popular mantra 'With great power comes with great responsibility', given the unusually vast amount of power offered by Javascript, Javascript programmers usually need extraordinarily high disciplines to maintain high code qualities when working on a Javascript codebase. Unfortunately, high discipline isn't common among beginning programmers, so many of them will risk abusing and/or ignoring many well established Javascript best practices, sometimes even consciously.


Nevertheless, I think 'use strict' should be used as much as possible when teaching beginning programmers Javascript, as it immediately eliminates quite some creative yet insidious practices. For the same reason, eval should be avoided in this case too.


In short, I think Javascript tends to be good for beginners not caring much(like not having to, including some lone wolf web developers as hobbyists) about code qualities and beginners valuing code qualities and having high discipline. For most of the other beginners, I think they/their teachers better at least think twice before picking up Javascript as the 1st programming language.


This should also be my answer for the 1st question.


On a side note(To further answer the 1st question): Unfortunately, a seemingly ridiculous yet actually vital measure(used by external agents) of the practical proficiencies of professional programmers is their abilities to constantly work highly effectively and efficiently on codebases having extremely low code qualities.


After all, only working on codebases with at least decent code qualities is a luxury for many professional programmers, mainly due to the abundance and importance of legacy codes :)


On a personal note: As I'm going to be a full time Javascript programmer, I can only train myself to work well with terrible Javascript codes, including those written by myself :p



For the 3rd question, I primarily like the space of creativity, flexibility and power offered by Javascript.


While I've only learned 8 programming languages(some professionals have learned 26) - Pascal, C++, Ruby, Java, PHP, Javascript, Objective-C and Swift, so far my little experience, knowledge and observation tell me that Javascript can give me the highest amount of freedom, even when compared to Ruby(I've only practiced PHP for several weeks so I can't say much about it).


For the 4th question, I primarily dislike variable hoisting(I've only written Javascript in ES5 after all). I also liked Ruby's expressiveness, at least when compared to Javascript ES5, which is still a little bit too much boilerplate for me. Maybe it's just because I prefer as little boilerplate as possible.
 
Last edited by a moderator:

Mister.Right

Veteran
Veteran
Joined
Mar 7, 2015
Messages
249
Reaction score
83
Primarily Uses
JS is required for every web app developer since it is the only front end dominant, that means it is not an option for web app developer. I would advise learningJavaScript and pick one more back-end language (Java, or Ruby, or Python, or C# or Javascript itself), then focus on learning these programming languages frameworks which I think more practical than learning too many languages but could not create an app. The current web application development faces an issue that there are too many frameworks and technologies but technically does a similar thing meanwhile every development team favors different frameworks.


For an example when you look for a job you will see something like this;


Front-end developer


Experience in JavaScipt, Angular, React, Knockout, Ember 


.....


There is really only one language here the rest are just frameworks which actually does similar thing. 
 

_Shadow_

Tech Magician Level:
Moderator
Joined
Mar 2, 2014
Messages
4,078
Reaction score
2,654
First Language
Greek
Primarily Uses
RMMZ
The current web application development faces an issue that there are too many frameworks and technologies but technically does a similar thing meanwhile every development team favors different frameworks.


You are absolutely right on everything you said. Not to mention that the plethora of options make the industry struggly most of the time to absorb available programmers for hire. Meanwhile freelancers make ends meet easier.
 

Ellie Jane

Veteran
Veteran
Joined
Mar 17, 2012
Messages
752
Reaction score
1,488
First Language
English (UK)
Primarily Uses
RMMV
I program exclusively in spaghetti code, it's why I've never had the confidence to go for a job in computing.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,045
Members
137,569
Latest member
Shtelsky
Top