views:

75

answers:

3

This is somewhat confusing from my side to explain here.when i try learn new language i go on with some of these steps:

1) simple hello world programs, math programs, counter programs

2) interaction between pages, fetching data(RSS/Atom) from other websites using their API's.

3) storing or manipulating data(mysql/postgresql you can say as database).

Now the third part of storing and manipulating data is bit confusing for me. and it seems i can't get into coding. developers block maybe. but i want to know how can i visualize this structural way so that programming database apps look easy and i can go ahead without fearing about code and database connections. i mean irrespective of language used, steps to build database web app is quite typical(drivers/fetching table data/storing etc) but i can't get into visualizing it.

For example, how can i make create application that stores some info like addressbook using JSP/Servlet or PHP. What steps do i need to think before creating web apps ? I hope my question is clear.

+1  A: 

Well as you said the beginning steps are very basic. Of course you need to know SQL well enough but I think almost any server sided language offers good Tutorials (e.g. basic example in PHP where database functions are built in there) on how to connect and issue SQL commands (basically it is always building a connection, issueing an SQL command, and iterating through the results).

If you prefer the more object oriented way you could have a look at the Object Relational Mapping tools your server sided language offers (ideally you won't have to deal with the SQL stuff at all anymore).

Daff
I didn't get you in last statement of yours. What do you mean by "i don't have to deal with SQL stuff anymore" ?
Mahesh
With ORM tools, you'll still need to design the database structure in some way or another, but the amount of queries you write can be significantly reduced.
Thorarin
HM ok, but you usually design it in a object oriented way without taking the underlying database into consideration (so it doesn't matter if its Oracle, MySQL or any other relational dbmw).
Daff
+1  A: 

For web apps I recommend to think in terms of "Framework", not in "Language". It's the framework which has a big impact on the architecture of your web app. For database web apps, a clear Model-View-Controller (see Wikipedia) abstraction is essential. It can save you lots of repetitive coding by providing a bit abstraction.

I'd watch some screencasts about Ruby on Rails or Django, then decide for one. Do some tutorials and then modifiy the tutorials for your needs. After a few tutorials you will be fit enough to start your own web app using this framework. For common tasks in Rails, there are loads of free screencasts with added material available on RailsCasts.

bb
Framework is definitely a step ahead. I don't know how can we think about it if we're in initial step of building simple database web apps. i mean going for framework with limited knowledge of language is bit confusing isn't it?
Mahesh
To code with Ruby on Rails, for example, the biggest step is to understand the concepts of this framework. It does a big job in abstracting the database away from what you need to do. For simple apps it's just a call to "script/generate scaffold ModelName column:type" like "script/generate scaffold Person firstname:string lastname:string age:integer". With that, you get a complete CRUD web interface and you can learn the language and the framework by just looking at what was generated.
bb
+3  A: 

I've always found the data access stuff to be pretty tedious, so I try to make a nice abstract Data Access Layer that does most of the work for me. A typical database call goes like this (and I think it fits for most web-oriented platforms):

  • create and open a database connection
  • create a database command object
  • tell the object what you want to do (i.e. give it a SQL command, or the name of a stored procedure to execute)
  • give the object the necessary parameters to perform the task (i.e., first name, last name, address, city, state, etc.)
  • execute the command
  • do something with the results
  • at some point, do your cleanup (dispose of the objects involved, commit the database transaction, close the connection, etc.)

build yourself a data access object that does all of this stuff for you. you should have only a few public methods for the standard database operations you need to perform, such as "ExecuteStoredProc" or "ExecuteSqlStatement". this way, working with a database is boiled down to functions instead of a big, tedious mess.

ajh1138
+1. These steps are definitely helpful, something that i'm trying to think during visualizing web app development. Thanks.
Mahesh