13.07.2015 Views

Software Engineering for Internet Applications - Student Community

Software Engineering for Internet Applications - Student Community

Software Engineering for Internet Applications - Student Community

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

{strResult = "[NULL]";}else{strResult = objResult.ToString();}Console.WriteLine("Employee #{0}'s first nameis: '{1}'", strEmployeeID, strResult);Console.ReadLine();}}}Not too much to note here except that Microsoft seems to like@emp_id rather than Oracle's :emp_id, i.e., they use the at-signrather than the colon to indicate that something is a bind var.4.8 Bind Variables in JavaAn example of bind variables in Java may be found athttp://java.sun.com/docs/books/tutorial/jdbc/basics/prepared.html.Here's a code fragment:PreparedStatement updateSales =con.prepareStatement("UPDATE COFFEES SET SALES = ? WHERECOF_NAME LIKE ? ");updateSales.setInt(1, 75);updateSales.setString(2, "Colombian");updateSales.executeUpdate():Note that JDBC, the Java database connectivity library, uses "?" as abind variable. It is up to the programmer to count the Nth occurrenceof the ? in a SQL string and bind a value to that. As you can imaginethis process becomes error-prone if the SQL statement contains 15or more variables, a very common situation in real applications. Youcan also imagine the possibilities <strong>for</strong> introducing subtle bugs if theSQL query is changed and the bind variable sequence numbers arenot properly updated.Supposedly this situation has been improved in JDBC 3.0 but thisexample of Java's inferiority to C interfaces from 20 years earlier15.9 Carrots and Sticks; Chicken and EggMost workers get rewarded <strong>for</strong> working; why would they want to taketime out to author knowledge and answer questions in an onlinesystem? People take the time to ask questions in venues where theycan expect answers. If nobody is answering, nobody will ask, thusleading to a chicken-and-egg problem.It is important to create an incentive system that rewards users <strong>for</strong>exhibiting the desired behavior. At amazon.com, <strong>for</strong> example, the siteowners want users to write a lot of reader reviews. At the same timethey don't apparently don't want to pay people to write reviews. Thesolution circa 2003 is to recognize contributors with a "reviewer rank".If a lot of other Amazon users have clicked to say that they foundyour reviews useful you may rise above 1000 and a "Top 1000Reviewer" icon appears next to your name. From the home page ofAmazon, navigate to "Friends and favorites" (under "SpecialFeatures"). Then, underneath "Explore", click on "Top Reviewers".Notice that some of the top 10 reviewers have written more than5000 reviews, all free of charge to Amazon!What makes sense to reward in an online community? We could startwith a couple of obvious activities: content authoring and questionanswering. Every night our system could query the content tablesand update user ranks according to how many articles and answersthey'd posted into the database. Is it really a good idea to rewardusers purely on the basis of volume? Shouldn't we give more weightto content that has actually helped people? For example, supposethat there are 10 answers to a discussion <strong>for</strong>um question. It makessense to give the maximum reward to the author of the answer thatthe person asking the question felt was most valuable. If a questioncan be marked "urgent" by the asker it probably makes sense to givegreater rewards to people who answer urgent questions than nonurgentones. An article is nice but an article that prompts anotheruser to say "I reused this idea in my area of the organization" is muchnicer and should be encouraged with a greater reward.15.10 Exercise 6: Gather StatisticsRather than do surgery on the discussion <strong>for</strong>um system right now,let's start by adding an accounting system to our new knowledgemanagement data model. Start by creating a table to hold objectviews. Here's an example:create sequence km_object_view_id;70279

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!