Web App Development?

Started by
17 comments, last by JonathanLyons 9 years, 6 months ago

Hey guys,

I've been a C++ programmer for 3 years now. Dabbled in C#/Unity and Python and recently I was tinkering with an API using C++, cURL and Jsoncpp. One of the apps I've made using said API is pretty good, but it has no place as an executable - why would you use an executable you have to download when you can do the same operation on a website?

My knowledge of web development/web app development general is extremely limited. I know a little bit of HTML/CSS and practically nothing else. I've heard of terms such as GET, POST etc but only have a super vague idea of where to start. I'd like some advice on where I should begin if I want to create an app on a website. Would HTML/JS do the job? Do I need to look into PHP? MySQL won't be needed as the API returns all data in Json.

TL;DR Wanting to start developing basic apps to plop on a website, any good resources/tutorials/advice for this?

Thanks smile.png

EDIT: I'm aware this isn't strictly game related, but the API is for a game if that helps! The app I'm thinking of is interactive either way and I've been on these boards for a fair while - probably the best place to ask.

BSc Computer Games Programming (De Montfort University) Graduate

Worked on Angry Birds Go! at Exient Ltd

Co-founder of Stormburst Studios

Advertisement

When you say an "app" on a website, that's not enough information. Are you talking about a game, or a business app on the website, or are you talking about having a client program that performs tasks on a website, like a multiplayer game?

Either way, the first thing you need to do is decide on all the technology you need. Long ago there wasn't a name for all this stuff, but now this collection of software is called a "technology stack." This could include the language, web server, database, and javascript libraries used for the client web pages.

So this puts you in a strange place right from the start. I've never done anything like this, and I have no idea what to do, and you want me to pick specific technologies from thousands to perform the specific parts I don't even know I need? Yep. This is probably what prompted the question.

All of this stuff basically does the same stuff, it just trades one thing for another. It is just like different languages, IDEs, and libraries do the same things but just in different ways. You just have to pick one and use it, and then if you get a lot of experience you can choose different stuff.

For now, if you are trying to make a client program that talks to a web server, the prototype to make to learn about this stuff is a chat program.

If you are trying to make a webapp, then you want to start simple and make a fake online store with products in a database, and walk the user through putting stuff in a cart and checking out.

With a little more information I think we can point you in the right direction.

I think, therefore I am. I think? - "George Carlin"
My Website: Indie Game Programming

My Twitter: https://twitter.com/indieprogram

My Book: http://amzn.com/1305076532


why would you use an executable you have to download when you can do the same operation on a website?

because bandwidth costs money?

because networked apps are inherently slower than non-networked apps running on the local machine?

because you don't want to have to connect every time you want to run the app?

there are only two commodities in life: time, and money. using a web app can cost you more in both.

That being said, the "suite of tools" or "technology stack" required will depend on the nature of the app. more detail is required. there's a big difference between writing say an MMORPG and a perl shopping cart script for a secure order form. Other folks on the forum here are working on the former, and i've done the latter. So you are correct in guessing that there may be some guidance available from the forum members here on gamedev.

Norm Barrows

Rockland Software Productions

"Building PC games since 1989"

rocklandsoftware.net

PLAY CAVEMAN NOW!

http://rocklandsoftware.net/beta.php

There are a lot of reasons why you may want to provide an executable instead of a web app:

- Web applications have a lot of the source public (HTML and JS are visible on any browser). Even with technics of obfuscation everything that's happening on the client's PC can be seen, on an executable it's harder for the average user and even advances user won't see the code you wrote, only the assembly generated. This can lead to security issues, so you need to be more carefull in a web application.

- Browsers are different, something may work in some browser and not in another, even following the standards. Some browsers support WebGL and some not, for example, but it goes to even the basic stuff (like setting the border size of a button).

- Web pages have some limitations. On the client's PC you have a sandboxed environment for security reasons, you can't access the file system unless the user allows it and even there you may encounter some problems accessing to other external devices.

- JavaScript is a non-typed language, for C++ developers it could be a hard transition. It's not a hard language, but the way you code it's really different (imagine using A LOT of function pointers in C++ and ignore some things you know about classes).

There are probably more, but I can't think more right now.

You'll learn most things creating web apps, so don't worry if you don't know the difference between GET and POST right now.

When I started making web apps I used PHP with CodeIgniter for the web services and HTML/CSS/Jquery for the client side. PHP is the language, CodeIgniter is a PHP framework that already manages a lot of things, HTML and CSS are the standards for presentation and JQuery is a framework based on JavaScript.

I've never used other frameworks but there are a lot. I've read that CodeIgniter is kind of outdated now and the "new thing" is Laravel, so maybe you can start with that for the web server. Other PHP frameworks will also work, but I've read that CodeIgniter is one of the simplest for a begginer.

Going out of PHP (it's a really old language, even though it's still being updated) the most popular option currently seems to be Ruby on Rails (Ruby is the language, Rails is a framework). I've done some simple test with it an it looks really powerfull and easy to code.

It's not clear what you wan't to do with your web app/game, but if you're C++ API does not listen and respond to HTTP requests you'll also need a web server (and you probably would, since making an app that does that is not trivial, and you won't find a web hosting that supports your custom web server). For a PHP web server you should use Apache (I always use xampp, it sets up an environment with Apache, MySQL and more). I'm not sure what web servers you need for other languages. Once you have the web services you can execute your C++ executable (http://php.net/manual/es/function.exec.php) and send to the client the json your c++ code generated.

If you want to make a browser game you can find several JS frameworks for games, look at Phaser for example.

I'd disagree in a web app taking more time (for the user, at least!). Downloading an app, potentially having to install some stuff for it, running it etc - why would you do this when you can enter a URL and have the app sat there in front of you?

I'll be a bit more specific - I want to access an API to return some information in Json based on the input of the user which will be two usernames. Grab some data, do some checks, inform the player of whether or not the first name has played with the second name recently. It's not complex at all - I thought it'd be a soft introduction to the myriad of web tech smile.png

If I create a website for myself I'd like to attempt to create other programs that utilise databases. In terms of games on said site.. It's unlikely!

Thanks for all your help so far.

EDIT: @Diego, thanks for the more in-depth analysis too. I've tinkered with JS before and the function pointer thing is a bit of a 'that's crazy!' thing at first but it's all good now tongue.png I've also heard about RoR a few times over the last few weeks - best give it a look. Thanks again.

BSc Computer Games Programming (De Montfort University) Graduate

Worked on Angry Birds Go! at Exient Ltd

Co-founder of Stormburst Studios

I don't know what all the grief about bandwidth and web apps being slow is coming from. This is how the modern world works. If you want to bank you use a web app. If you want to sell stocks and shares, web app. If you want to book a holiday, web app. Pretty much any coperate software that interacts with a back end database, web app.

The modern way of doing this would be to use some kind of framework such as RoR or cakePHP to build out a restful API. The frontend would obviously be done in Javascript (or some fancy new language that compiles to JavaScript).


The modern way of doing this would be to use some kind of framework such as RoR or cakePHP to build out a restful API. The frontend would obviously be done in Javascript (or some fancy new language that compiles to JavaScript).

+1

For what you want to do, whether you use a web page with Javascript or a C++ app, the easiest way for the server to provide the functionality is a simple Restful service that consumes and produces some JSON. The client needs an HTTP library to send the Get, Post, Put, and Delete messages, and the server needs to consume them and return the requested data.

At this point the server code depends completely on the language/web server you are using.

I think, therefore I am. I think? - "George Carlin"
My Website: Indie Game Programming

My Twitter: https://twitter.com/indieprogram

My Book: http://amzn.com/1305076532


The modern way of doing this would be to use some kind of framework such as RoR or cakePHP to build out a restful API. The frontend would obviously be done in Javascript (or some fancy new language that compiles to JavaScript).

+1

For what you want to do, whether you use a web page with Javascript or a C++ app, the easiest way for the server to provide the functionality is a simple Restful service that consumes and produces some JSON. The client needs an HTTP library to send the Get, Post, Put, and Delete messages, and the server needs to consume them and return the requested data.

At this point the server code depends completely on the language/web server you are using.

That kind of site makes me sad. Or angry.

All errors are unrecoverable. There is usually no way to resubmit. You cannot bookmark, or at least bookmark easily. Back button is broken.

Prime example hit my team today. We were editing a bug in Jira (a common bug tracking database that relies in the above-mentioned heavily scripted system). Multiple people were involved in researching it. It took about a half hour, maybe 45 minutes, to figure out and update the details. Hit submit. The form vanished and several seconds later there was a popup, "Error communicating with the server." There was no way to resubmit. Opened the page in Chrome's development window while praying it was just inside a hidden element. Nope, it was inside a now-deleted dynamically created JavaScript powered div.

While those JS-powered pages can look pretty slick, they are filled with assumptions that fail horribly in the real world.

Another example, the entire HealthCare.gov site. Everything scripted. Under load people get errors similar to the ones above with no way to resubmit on errors, no way to bookmark their progress, no way to handle anything outside the ideal perfect flow. If there are any errors, any busy servers, and dropped connections, their fancy JavaScript power pages fail spectacularly.

I highly recommend you have a look at Dart.

It's really easy to get into if you have experience with languages like Java and C#. The syntax is similar to those languages.

It has a really powerful HTML manipulation system which works really really well. It's like vanilla JavaScript but actually usable.

It compiles to JavaScript as well so it's guaranteed to run in any modern browser.

http://dartlang.org

Why not get any of the opensource content managenent systems out there (drupal comes to mind, there must be a ton of others) that you can install and will actually already work as the basics of your website, that you can then reskin with your own templates (HTML, Javascript and XML involved, or, in some cases, you get a nice shiny web interface if your reskin is lightweight), and for which you can then write plugins (PHP or whatever kind of language the CMS supports) that will implement your actual web applications functionality?

I guess 80% of what you need you will get out of the box from a cms like drupal, or some already existing extensions or plugins. The rest will still need your work, but at least you don't have to write basic stuff.

List of available CMS:

http://en.wikipedia.org/wiki/List_of_content_management_systems

This topic is closed to new replies.

Advertisement