/si/ - Self Improvement

Learning new skills, getting over bad habits, health and fitness

Reply
Name
Subject
Message

Max message length: 4096

Files

Max file size: limitless

Max files: 3

Captcha
Options
Password

Used to delete files and postings

Misc

(64.26 KB 468x452 terminals_10.jpg)
Learning to code - JavaScript Anonymous 01/19/2020 (Sun) 15:37:55 No. 2
You will hear a lot of programmers talk about JavaScript with disdain - because most programmers are male and have to tell the world how their dick (programming language) is bigger than yours. There is more or less nothing wrong with it though, and IMO it's a great choice for beginners for a few reasons; You don't have to install anything, if you are reading this post on a PC you have a browser and therefore you already have a JavaScript runtime installed. It works outside of webpages too so skills you gain are transferable. Node.js is a platform for running JavaScript programs directly on a machine's operating system. This is an important difference because unlike a webpage you can access the filesystem and other OS functions. The imageboard software for this site was written in JavaScript. There are also ways to use it to write desktop applications, eg electron.js - the Discord desktop client is written with electron. So with one language you can learn to design webpages, work on servers, or write apps that work on any OS. Another big advantage JavaScript has is how it integrates with HTML and CSS, which is by far the easiest way to build user interfaces (they can be a nightmare with other languages). https://www.w3schools.com/ is a great site to start learning, they have tutorials which guide you through everything you need to know step by step. They also have complete references for all the standard JavaScript functions, as well as HTML and CSS. https://developer.mozilla.org/en-US/ is the definitive reference and goes into much more technical detail but is often harder to follow and w3schools has most of the same information. The only thing you need to get started is a text editor - for windows I would recommend Notepad++. You can just use notepad but Notepad++ has a ton of features (like syntax highlighting) which make things easier. It is also much easier to share your results using JavaScript since nobody else has to install anything or download an exe to see what you've made.
Thanks for the thread anon! I had heard about Node.js but didn't know what it was exactly. Right now I'm trying to make a web page with a form that would be processed using Java (very basic I know). My end goal at the moment is to make a small website with a form to create articles (like a small wikipedia). I'll have to find ways to use JavaScript as my main purpose in making this website is to improve my coding skills!
Thanks for the thread OP. >>3 Sure, feel free to post any questions you may have. I know JavaScript and with it, I'm also very familiar with React and Node.js (both quite popular and in demand). I do know a few other programming languages but they're not the topic of this thread. As for me, I'm currently playing with Three.js. There's a lot of outdated sources out there so it takes some extra time to filter them out but there are so many things you can do with them. I'll post link to codepen if I make anything worth seeing.
>>3 Just an info dump for anyone who may be interested; Java and JavaScript despite the name have absolutely nothing to do with each other and are very different kinds of language. In the first place, Java is a strictly typed, compiled language. Everything has to be declared precisely, in advance, and once you've written the code it needs to be compiled before it will run. The strict typing makes it less prone to human error since it will refuse to compile unless everything matches up perfectly and in general programs created using compiled languages run faster, although Java isn't the best choice for speed. It has some idiosyncrasies; in terms of coding style it enforces an object-oriented approach and is built to run on the JVM Java Virtual Machine which means the same code can produce binaries for any platform - at the time Java was being developed this was a unique feature. It's very popular as a didactic language, i.e. it is taught in universities and many large corporations have been using Java software forever and want to keep doing it. Jobs for Java developers attract some of the higher salaries in terms of languages. JavaScript, by contrast, is a dynamically typed scripting language. Variable types and objects (there is in fact no difference in JS) do not have to be specified in advance and can change, and an interpreter can run the script directly from the code without the intermediate compilation step. The loose typing makes programs a lot less tedious to write at the cost of it being slightly more difficult to spot errors. While interpreted languages are as a rule not so fast as compiled languages, JavaScript is the best optimized and fastest compiled language in use. If you are still working on this anon, I would look up a CRUD tutorial - Create, Read, Update, Delete, the internet is full of them and you can get through the basic steps that way and add on your own ideas from there.
>>8 >If you are still working on this anon, I would look up a CRUD tutorial - Create, Read, Update, Delete, the internet is full of them and you can get through the basic steps that way and add on your own ideas from there. Yup, thanks for the tip. Should we make this thread web development general? I feel an entire thread only for JavaScript is maybe a bit too restrictive given the low traffic here. I'm going to have to learn PHP and MySQL as I have the opportunity for a small internship where I'll be working with these two.
>>14 Well the OP is making a point that JavaScript isn't *just* for web development, but maybe we can make it a coding general. Either way I'm going to talk about PHP and MYSQL now. These are your bread and butter for serverside web development. PHP is another interreted language like JS but it's really only used for serverside applications. Up until around 10 years ago when NodeJS came out it was the default language for writing webserver and huge parts of the internet are built with it - all the wordpress sites, wikipedia, lolcow farm etc. It can be kind of a messy language but it's still an important one to learn because the use is still so widespread. And because so many non-coders occasionally have to learn a small amount of PHP to eg make their wordpress sites work properly there are a vast number of tutorials explaining how to do things. In order to practice, you need an environment, also called a stack. On the server this is typically a LAMP stack - Linux, Apache, MySQL, PHP but if you're on windows you want to put WAMP into google instead. Here are a few: http://www.wampserver.com/en/ - does exactly what you'd expect https://www.uwamp.com/en/ - minimal installation headaches (uses SQLite instead of a full blown MySQL installation, but everything pretty much works the same way) https://www.mamp.info/en/ - works on mac as well as windows I wouldn't recommend trying to install the webserver, interpreter and database one by one, it's a headache and there's really no need and you aren't gaining transferable skills because linux distros ship this by default and 99% of any servers you work on will be running linux. Once you have your stack things get really easy, you just type localhost into your browser and can start serving yourself webpages and seeing how things work without getting tangled in how to access a remote server. If you're just running PHP/MySQL based applications, servers are free. Yes, free. You're limited with what you can get the machine to do (e.g. anything other than processing PHP scripts that serve webpages) and the hosts will serve ads that you didn't put there, but for experimenting it's great. https://www.000webhost.com/ offers free PHP/MySQL hosting, but google can find you others.
I'll also add that you should be aware of which version of PHP you're using. Newer installations will use PHP 7 whereas older ones may still be using PHP 5. In particular there are a lot of tutorials out there which use the mysql() function for connecting to a database, and even rather old versions of PHP deprecate it in favour of mysqli(). If your tutorial is using mysql() it is likely to be hopelessly out of date (the disadvantage of there being so many how-tos). There are similar considerations regarding mysql5.7 vs mysql8.0 vs mariadb but they all work mostly the same way as far as the PHP code you write is concerned.
>>16 >>18 Thanks! I'm using an Apache server on a raspberry and accessing it through my Windows computer via the Ubuntu terminal but this is good to know about. Your info on the PHP versions is very good advice, I'll be careful about that.
>>19 For a windows terminal I'm going to plug MobaXTerm: https://mobaxterm.mobatek.net/ Even the free version has a million features you'll never use but is also has ones you will use like inbuilt sftp to not need a separate ftp client to upload files and the ability to open a temporary copy of a remote file in a text editor (the built in one or your own) and upload the changes when you save.


Delete
Report

no cookies?