A Complete Beginner’s Guide To Hacking: Writing Code

This post is part of the series A Complete Beginner’s Guide To Hacking

Shells are the way that a user (as opposed to another computer) interacts with the actual operating system of you computer itself (as opposed to with an application running through your OS).

Normally when you are using your computer you probably have been using Graphical User Interface (GUI) systems like a “desktop” to open up files, software and folders. These are image-based ways to work using things like icons to see the options. You will probably use your cursor to interact with them, such as double-clicking to open or run a piece of software.

There is of course another type of shell that exists though – a Command Line Interface (CLI) works by typing commands or instructions to do the same things as the GUI – see the folders, files and software and interact with them. This was how operating systems were originally interacted with before mouses and cursors were invented. You’ll generally (not always) see a black background with a blinking line | waiting for you to type instructions.

Of course there are obvious reasons why most computers use a GUI desktop shell as default way of interacting with your OS – for example without a GUI you cannot point to a particular place on the screen for any graphical or CAD packages. Most importantly CLIs rely upon you learning what all the instruction phrases are – also known as the shell scripting language (ssl) – so you can work your computer and this is often more effort than the intuitive GUIs.

However, if you want to, you can still open up and use a CLI – in fact for some OSs and coding situations you will find that that is preferred – for example you can open Command Prompt in Windows, and Terminal in most Linux OSs. You will find a lot of systems use shells based around or upon Bash ssl and so if you are going to learn to use any it makes sense to learn Bash commands. There isn’t that much to learn – it is easy to google instructions to find them as and when you need them but to get you started on the basics I can recommend the Codecademy Command Line course.

So now you want to write your actual code but where do you do this?

Text Editors

You need to write them in something known as a text editor. The default text editor on most computers will be something like Notepad, which lets you write text and save it into any format of file. It is the file extensions or the name of the file after the “.” that generally tells a computer what language the code is in such as “.js” for Javascript. Of course people have developed better text editors than Notepad though over the years and many are free to use as well. A good text editor will number your lines of code so you can easily search through for problems and changes and will also have other features like recognise the language you are typing in and will suggest the words or highlight spelling mistakes when you are typing.

Personally I find Notepad++ and Sublime Text are my favourites.

If you want to get even fancier though you could try Vim or Emacs – these are two text editors with a Command Line Interface that require a little more work to use as they have their own set of commands that you need to learn to provide shortcuts and interact with. In theory this extra work ultimately allows you to work on your code more quickly when you are very familiar with them. They have very loyal fans who get very competitive with each other in what’s known as the “editor war” – i.e. the debate over which one is better.

Unless you think that you will be doing enough code that it is worth learning to save the time, I generally wouldn’t bother with the hassle getting involved with Vim or Emacs as a beginner. It’s  still worth knowing about them though so as to understand the debate that is part of the culture – you can safely tell someone in the editor war that you use Sublime though, don’t worry!

Graphical Interfaces

There is software out there that allows you to avoid learning to write code and instead “make it” through “user friendly” ways e.g. Dreamweaver allows you to design a website graphically. Personally I don’t recommend using these things as default unless you know that there is a specific advantage in your case that you will get from them. Often they create very buggy, messy code and makes it incredibly difficult to identify problems. Occasions when it might be recommended to use graphical interfaces would be to use Android Studio to develop Android apps for example.

NEXT: Running Code

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s