My Linux experiance is pretty solid have wanted to get into a small amount of coding but i've come across a project that suits my needs just need to know the best way to do it.
Id like to build a basic website hosted on my linux server at home, the basis for it is to keep track of points and setup a leaderboard for a winter golf group thats in the process of being put together
Score entry system to allow players to drop down select a date and player name then enter a score.
Prevent player from adiding multiple scores per day but multiple scores over time
Allocate a point system dependent on score eg 36 gets 2 points 38 gets 3 points etc per round and calculate a total over multiple rounds and entries
A leaderboard page that can track number of entries per player current number of points alomg with a few other vairiable fields such as handicap etc
Maybe a archive option so that previous leaderboards can be viewed but not edited.
I apriciate this is probably a mamoth task for someone whos never done any web dev and whos sql knowlege is limited to a few lookups and basic selections but Ive got till october to attempt to get this working and am willing to wade through whatever books websites and other stuff needed
I appriciate I could probably do this in an excel spreadsheet or even buy an off the shelf solution but where would the fun be in that
Any and all initial guidence to get things off the ground would be great
You give no particular preferences for what language, server or anything else. PHP is a good way to start - popular language, quite good in its modern versions and lots of documentation and such out there. My personal recommendation would be Django Python framework. This will help you get something practical up and running. You'll learn more by writing something scratch in PHP but with Django you're more likely to actually get something finished to your satisfaction. It's very good.
You will want a web server installed on your GNU/Linux server. Apache is not necessarily the best these days but it's pretty easy to get started with and will meet your needs. So install apache2 on your server.
You will want a database installed on your server also. Postgres is very good but if you have no experience you will find MySQL more than adequate and simpler to get up and running with.
You will want to decide whether to use Python or PHP and install accordingly. Both are options. You will not want to use Python without using a framework (I recommend Django). You may want to use PHP with or without a framework. Without a framework you will do more of it by yourself and also learn different things. With a framework you'll be able to do things such as when you get to the point you need other people to be able to set up accounts and log in, install Django's standard user authentication plug in rather than write everything yourself. A framework will also have built in protections against attacks like XSS which if you're just starting out you wont even know you need to guard against let alone how. On the other hand, there's a joy in just writing all your own code and it can be less overwhelming to start with as well. Symfony is a popular framework for PHP if you want PHP and are looking for one.
jsmoke and
billyslieu's suggestions of just setting up the web server and writing some "Hello there" style HTML/CSS/PHP to start with are the best. It's fun to see something coming together and otherwise, what's the point? I would probably therefore suggest installing PHP, spending a fun little while trying things out with it and THEN decide if you want to switch to a framework or change to Python. You'll understand the basic principles much better once you've spent a couple of days fooling around with CSS, HTML, PHP, etc. and the time wont be wasted.
That's my main advice. Here are a few suggestions / tips, whichever route you decide:
- Apache is fine and you'll probably get everything up and running pretty easily but there are a few maddening gotchas with it. If you run into a wall with it, give us a shout here - it's probably something simple. Their documentation is not the best.
- The world of Javascript development is a mess. A real mess. It's about fifteen to twenty years behind where the rest of the programming world is in terms of approaches and maturity. At some point you'll end up developing stuff in Javascript and be hit with a wall of choices and ad hoc improvised compromises and competing approaches. node.js, thirty-two different front-end frameworks, require, webpack, es5 / es6 features and browser compatibility issues and IDEs that nag you if you don't type "use strict" at the start of every function and then complain at you about other things when you do. I tell you all this so that you don't think it's you when you find it all confusing and contradictory. Get the HTML/CSS/back-end stuff sorted first. I don't mean you can't throw in datatables library or something to make your tables sortable and pretty or something. But I would strongly recommend you put the world of Javascript development towards the end of your learning process. Vue.js is very good for when you do want to enter the hideous tangle of front end development but it's just a recommendation. There are a hundred different ways of doing your front Javascript development (and all of them should be put off as long as possible. You can do a surprising amount without doing more than the bare minimum of Javascript ).
- Get an understanding of the GET/POST model of HTTP vs. AJAX. You'll run into both and it's one of those fundamentals you need to understand before you get stuck in and mixing them all up. In brief:
- GET/POST model is the traditional approach to web development. Your browser sends a request for a page to the web server. This request will normally be either a GET request (not changing anything, just getting the page) or a POST request (sending information that the web server is supposed to do something with, like a username and password). The web server replies with a page for the browser to load.
- AJAX is where javascript sends off a request to the server without doing an entire page load. So if you had a news ticker on the page that kept updating for example. That would be making AJAX requests to the server and loading the results into the page rather than loading a whole new page. You should start off designing your site with just GET/POST - no need to complicate things right away. But you need to understand these two different approaches because you'll be coming across both a lot and need to know the concepts.
- JQuery can simplify a lot of your Javascript and frankly whilst I'm usually big on learning the fundamentals of things first, Javascript is such a pig's ear that I actually recommend just grabbing JQuery for any Javascript stuff you want to do at the front end unless / until you want to go full front-end framework
- The advice to just grab a text editor like Notepad (or better, Notepad++ or Atom) and start coding is the best. But at some point you will probably want to use a full IDE (Integrated Development Environment). By FAR the best, imo, is PHPStorm or it's sibling PyCharm (same company, shared code base). Not cheap in an absolute sense but cheap for software development tools. Aside from all the things an IDE provides to help you write the code in the first place, it also provides a front end for debugging. Now there's nothing wrong with sticking var_Dump($variable) and die("It went wrong here") statements throughout your code to figure out where something's gone wrong. But this is just a heads up for when you want to be able to step through it all. You just need to know there's a better way out there.
- When you put your database design together, make good use of indexes on your tables. They're not just for performance - they can ensure data quality. For example, if there's a unique index on the "email" field of your user table, you know a bug in your code can't enter the same user twice. Learn to keep an eye out for things that should be unique as good practice.
Finally - have fun and don't get discouraged. The programming world is big and until you have a bit of experience you wont know whether you don't understand a solution someone gives you because you're ignorant or because it's complex. That will come with time. Good luck!