Ask HN: I want to write a simple webapp, how should I start?
First of all, thanks for reading this, you probably have read it many times before.
So, here is what I want to do: I want to index some of my magazines. My webapp should have a search field, where I can type in a single phrase or look up complete issues.
I know that I need a database in the backend for this (that I need to populate).
But since I have no experience in developing (neither web nor other) and only possess a "dangerous half knowledge), I'd thought I ask your advice.
Which road should I start on? PHP + MySQL would be the first to come into my mind, but since I'm a clean slate, would it make sense to start with something completley different (and maybe as accessible)?
Thanks for taking the time to read and answer, looking forward to your input.
59 comments
[ 4.8 ms ] story [ 122 ms ] threadP.S Laravel is one of the best PHP based framework.
If it's just for you, and you just want the tool, use a google spreadsheet.
If it's just for you, and you want the experience of building it, then create a simple PHP script, and use a flat file to store your magazines.
If your hope is to build a "real" web app, with user accounts and all that, then you've got a lot of choices. Start with a list of features and functionality you want in your app, and put them in order of priority (including "user signs in", "user recovers password", etc). Choose a technology, and start piecing together those features. Use stack overflow, and find communities for the technology you've chosen. Ask for help often. Take your time, and have fun.
It's just for me, I was hoping to use it as a kind of springboard to get into coding. I used a few of the ressources (including Learn XX in XX days), but I think I'll learn best, if I have something to work on.
So I'll probably go for the real web app part, just to learn. It'll be ugly, probably, but hey :)
It's not free, but you can run through at least one of their full blown web app tutorials in less than a month so you'll only pay $25.
I've been helping a friend who is trying to learn to build webapps and this has been his favorite resource so far.
If you have any specific questions about BaseRails or Rails/coding in general, I'm happy to help. Feel free to reply back here or shoot me an email at alex@baserails.com.
I'd try and get some basic programming in first. Javascript makes sense if web development is the end goal.
One of the reason why I asked here :)
HTML http://www.w3schools.com/html/default.asp
PHP+MySQL http://www.w3schools.com/php/php_mysql_connect.asp
Oh thank god, I thought I had stumbled in some kind of developer flamewar there.
If you're going down the Python route I'll throw in Full Stack Python http://www.fullstackpython.com/ I wrote FSP to provide beginners with context as to what these terms like web server, WSGI server and platform-as-a-service mean without assuming you have prior programming experience.
Of course, choosing another language (Python, Ruby, whatever) will likely mean choosing a framework and the package manager for that language, but with PHP you have to decide whether or not to use package management or a framework on your own. The minimum viable product version of this as I see it can be done within a single PHP file, so it could be argued that the extra complexity isn't strictly necessary.
If you're working in Windows, Xampp[1] makes it very easy to set up a local server and test PHP applications on your own machine.
[0]https://getcomposer.org/
[1]https://www.apachefriends.org/
I was thinking to use either a virtual machine or the LAMPP stack on my NAS/Raspberry. I tried Xampp, but it kind of screwed with my installation back than. Plus, the Pi isn't really doing anything, time to change that.
One thing I want to note is that you didn't mention which "kind" of webapp development you care about (ie frontend, backend or both). Roughly, the distinction is whether you care about making a website (the part where people look at) whether you care most about just the functionality part of the webapp.
Here are some suggestions for web-app languages:
Python + flask.
Ruby + rails.
Go standard HTTP library.
Haskell + snap.
I've used all of those and thought they were at least decent. The last two are my favorite for web development.
I would start by building a tool that can do this easily at the command line or with hard-coded inputs (whether you write it in Python, Ruby, PHP, Go, etc). Once the hard part (the search) is working to your liking, you can then go building out a web interface to it.
With this approach, you will work on the most interesting part of the problem first, which should be intrinsically motivating. And, when it works to your liking, you will be motivated to develop a functional interface, which will sustain your drive to finish the project.
Language choice.
For a long time PHP was the defacto standard. It has a lot of resources and tutorials plus the advantage of a huge amount of hosting options. However, I'm the last five to ten years, the field has opened up. Ruby and python both have strong communities and with app hosting solutions like Heroku, it is just as easy to get them up and running. All three are fine choices and if you're looking to make a career of web programming, you'll find plenty of jobs for all three.
Frameworks.
Frameworks are essentially scaffolding you can build your app around. The benefit is that you can get up and running pretty fast with them. Ruby has rails, python has django, and php has a plethora, with laravel being my favorite right now.
The downside of these is that they add another level of complexity to your app. In addition to learning the basics of a programming language, you also have to learn about routes,models, controllers, etc. While this information is very beneficial to have, it could overwhelm when you're just starting out.
If you want an app working fast, you can try one of the frameworks. However, if you want to understand the language more fully, at the cost of time, you may want to try your hand without a framework. If you do choose that route, php may be the best choice, since it was the only one designed specifically with web programming in mind. I'd reccomend php with mysql (using PDO for database interactions).
I'm currently on mobile right now, but if you'd like any more resources I can reply when I get to a real computer.
From your basic description, the simplest way to be to just have straight PHP with MySQL/postgresql. And I believe you mentioned in another response thinking about using a Raspberry Pi, it looks like a LAMP stack might be easiest to set up, so another point in favor of PHP.
Although if you're just looking at learning how to CRUD, then it's a good learning exercise.
The thing is, there are really lots of ways something like that could be achieved.
I use Ruby/Rails for philosophical reasons; I really love the language and framwork. I could do php - i just don't like php. Been there, done that. Others prefer JS for everything, or maybe ASP. None are "wrong". but there are differences and tradeoffs to each path; its not arbitrary by any measure.
If you want some fancy search, I do favor elasticsearch quite a bit. Everything else I've used doesn't compare. (but again, largely preference (because its better))
Rails or Django would be easiest, IMO, and they have a ton of libraries to make the search easy. You should absolutely not have to write any algorithms or anything... whatever you choose would probably just look like ExampleSearchLibrary.new(magazine_records).search(string_from_form) and that's it. I think the hardest part is getting all the magazine data in a DB, and designing the model layer in a way that makes sense. I'm assuming it's already digital, so it would be a matter of writing scripts to scrape & save.
Personally I think it would be easier to use an embedded database such as leveldb, and build everything out with browserify, npm, and io.js. This way you can build your application as single process. The entire application can then just be streams of data and tiny modules of code that do one thing well.
Practical Django Projects got me started with a simple webapp in around 24 hours.
I'm still sifting throug the comments, so please be patient, I'm trying to answer to all of you. It might just take a while :)
It'll be just a hobby, so I have the luxury of taking it slowly :)