views:

1336

answers:

12

I have worked on single threaded business logic/back-end programming for most of my career. I now wish to learn web programming but would like to know how web programming is different from non-GUI programming (e.g. writing an API or a file processing application). I am not talking about the GUI design aspects (someone has already asked that question here) but more about programming complexity.

On the few occasions when I have worked on a web application, I felt that web applications are relatively more non-deterministic and unpredictable (for example, due to the event driven, multi-threaded model of web applications, there are several permutations and combinations of events and actions one needs to take care of) .

What would you say are some of the basic features of web programming that makes it different from non-GUI applications? What are the pitfalls/mistakes a back-end developer might commit while working on web applications?

EDIT My definition of back-end programming means non-GUI applications like an API or a file processing batch application that parses a large data file, reads the records, does a lot of number crunching calculations on the data and spews out the results into another file or database. Anothe example could be a library of date and time utilities.

+9  A: 

The biggest challenge with web programming is dealing with state. HTTP is a stateless protocol. This can make maintaining state more challenging than in a desktop application. Web applications tend to have a different life cycle due to this. Each web development platform deals with this somewhat differently, but they all need to deal with it in some way.

Jim Petkus
Lots of desktop applications use HTTP.
Luca Matteis
Yeah, so those desktop applications are the beneficiaries of what Jim Petkus is talking about.
Rex M
Agreed. The statelessness of HTTP is the worst thing to the matter.
Paul Nathan
You should elaborate on the different ways it is handled
Simucal
+1  A: 

Most web sites have a back end component as well. Typical structure will be something like:

  1. UI - html/css/javascript
  2. Controller - if using MVC
  3. Business Logic/Services - this is backend
  4. Database - this is also backend

So building web sites will still mean a lot of back end work. In regards to the UI, the main difference is that you will need to have a good eye for design and layout to do it well. The html/css technology is pretty simple in itself.

Craig
Using a nice MVC framework means you can be pretty de-coupled from the design part, though. It helps to know CSS/HTML (if nothing else, just to know whats possible).. but leave the actual "making the design look good" to a designer.
gregmac
+6  A: 

Web applications generally feel like single threaded applications, as you - the application developer - rarely create threads of your own. If anything, it's actually a lot easier, because the stateless nature of the web transactions means that you have to load the data for the page each time from the database. Therefore, you don't have to worry about concurrency, since 'whatever is there' is usually good enough.

The biggest problem with Web development is all of the background knowledge that you have to accumulate over time. How do you lay out web pages? How do you style things with CSS? How do you get parameters from the query string? How do you validate a field value in JavaScript? All of those things are actually really easy to learn, but there's just so many of them that it can be a real pain.

Travis
+1  A: 

HTML was actually developed to deliver physics papers. You can still see it in some of the old meta tags. At any rate the difference is web programming is stateless and thick client development is not.

As you have adeptly indicated, its all driven by events. True javascript has mucked up web development a bit by creating the illusion of a stateful enviornment but in the end everything comes down to simple HTML.

Its never too late to start learning, I would say start making some static HTML pages and move your way up to an MVC Framework, I suggest Microsoft MVC Framework. Its pretty fantastic, there are others you could use like ASP.Net Webforms but you won't learn anything by dragging and dropping things onto a designer ;).

Al Katawazi
I never knew that regarding physics papers -- which meta tags are you referring to?
Erik Forbes
Tim Berners-Lee, a scientist at CERN, invented the World Wide Web (WWW) in 1990. The Web, as it is affectionately called, was originally conceived to meet the demand for automatic information sharing between scientists working in different universities all over the world.
Al Katawazi
Tags include Title, Description, Keywords, distribution, resource type, ect. These all pertain to describing documents. Suprised there is no ISBN meta tag :D
Al Katawazi
+3  A: 

The biggest pitfalls I've witnessed Application developers make when moving into Web is not considering the costs of their code. Either they abuse MySQL to much too the point of bogging the RDBMS down, they write code that uses too much memory, or they make front end pages that are to big to fit in dialup/cellphones or low end broadband/dsl pipeline.

Sometimes it can't be avoid in writing a heavy duty page, but considerations can be made to attempt to cache as much as possible or when writing a page that will be hit a lot they will make no effort to profile and optimize queries before they go out the door.

Its not that these people are stupid, just a lack of experience and awareness that they need to play nice and write code that's somewhat lean.

David
A: 

Web programming isn't back-end programing. It shows stuff on the front end, the web.

Are you defining it otherwise?

EDIT

Web programming pulls you into presenting data consistently, visually, to everyone. Back end coding means constructing that data, in the same way for presentation, but not presenting it.

Jas Panesar
I am not trying to define it otherwise. Please see EDIT for clarification. I understand the difference but am trying to figure out the difference in "programming complexity" between web/GUI programming and non-GUI programming.
Rahul
Web programming pulls you into presenting data consistently, visually, to everyone. Back end coding means constructing that data, in the same way for presentation, but not presenting it.
Jas Panesar
+1  A: 

Back-end programming is infinitely easier than web programming. (You have been warned!) Web programming is the easiest to show off to everybody.

too much php
A: 

Another consideration is that Back End programming as per your definition is easier to test.

Once you begin web programming you're at the mercy of the various browsers' different interpretations of the same code. Plus the user, with inputs of mouse and keyboard, has a variety of ways to break what you produce.

MadMurf
A: 

web & GUI applications interface with humans .. back-end applications interface with services and databases .. As such your specifications need to include significant consideration of your user's mental model - making things behave as people expect them to. And doing that - understanding how users think - is not always easy or logical. You may have elegant algorithmic solutions that simply fail to engage, because people don't always think logically. Many times, quite elegant UI's are extremely twisted coding-wise .. which is very contrary to system->system programming

Depending on problem-space, much of this can be more art than science.

Scott Evernden
+1  A: 

One consideration (amongst many) with web programming is that users won't just be stupid (not that they all are, but you always have to factor that in), they will sometimes (assume always) be downright malicious and nasty, and will do everything in their power to destroy your application, your database, your weekends, your sanity...

Be as paranoid as a very small nun at a penguin shoot. Do not trust your users.

seanb
"Very small nun at a penguin shoot" +1 LOL
Abie
A: 

Based on your definition of "back end programming," your question applies not only to web applications, but to any GUI application.

It kind of depends what kind of GUI application we're talking about. For example:

  • Internal business applications tend to involve lots of business process workflow logic, record keeping, and interoperability between separate systems. No fancy alorithms or number crunching are needed. Your audience is limited, so performance is not a big deal, but cross-platform compatibility is important so these tend to be web applications. Your main concerns are making it easy to tie business sytems together, and keeping the API layered to ensure that the GUI code does not have to deal with any of the business logic code.
  • Public web sites (such as this one) tend to involve less of a formal architecture, and more of a mentality of "just get this cool feature to work so we can get more visitors." Again, no number crunching or algorithms unless performance is an issue. Performance is more of an issue for massively popular sites like Slashdot or Google, so if you anticipate rapid growth it pays to design for scalability in advance.
  • Public e-commerce web sites are kind of like both of the above: features and performance are important, but equally important is the structured architecture underneath it that ties all of the commerce business systems together (purchasing, supplier, shopping cart, payment gateways, etc.)

For the actual GUI portion, the complexity of the application kind of determines how complex the GUI code will be. For highly complex, nested GUIs where your requirements change often, it's easy to fall into the trap of putting too much GUI stuff into one page. Soon the page exceeds most people's complexity threshold, making the page very difficult to maintain. It pays to think in advance how you can separate different portions of the GUI into separate components, and then tie them together. If you're new to GUI programming, read some articles on the Model-View-Controller (MVC) pattern.

For simple web sites, where most pages are fairly static, this issue doesn't come up so much because each individual page is easy to maintain.

davogones
A: 

Most web programming is done in the style popular in the early seventies, before Dijkstra's 'goto considered harmful' was well-known.

Stephan Eggermont