Sunday, May 20, 2007

Review - Tools


Bug Tracker (we didn't use!)
Fog Buz - would like to try this
Bug Net
Gemini

3rd Party Controls
Telerik

Code Generators + OR/M's
CodeSmith / Nettiers
Iron Speed
nHibernate


LLBLGen
Castle Project (NHibernate),http://wiki.castleproject.org/index.php/Main_Page

MonoRail (MVC)
http://www.fogcreek.com/fogbugz/ - bug tracker
http://www.highrisehq.com/home - CRM from 37signals
Basecamp - Project Management from 37 signals

Full Apps
Community Server


nAnt - scripts out the build process
nCover - code coverae for unit testing
Cruise Control - auto code building / testing


What Makes Apps Good?
Fast
Easy to Use


Microsoft Empower program for Micro ISV's

maptalk.co.nz
attackpoint.com - fast

Review - Front End Stuff

This is where we are keen to learn more

Datarepeater
Rounded Corners javascript - http://www.html.it/articoli/niftycube/index.html

Using EntityDataSouce (from nettiers) instead of ObjectDataSource (VS)

Didn't implement on keypush, javascript to connect to webservice.

Would like to implement caching (server side in memory), to avoid calls back to db

To Do
Explore AJAX Extension toolkit http://ajax.asp.net/

Review - Enterprise Lib / CodeSmith

Enterprise Library3, and 2.

Had issues where Micheal had signed his own assemblies that wrapped EL2, and when I had EL3 installed it all didn't work.

We Used EL3 initally in the HelloWorld 3-Tier app for the :

Database Connection Block

However we could have just used ADO.

Code
[Serializable]
Interfaces
Contracts
[Browsable Attributes]
Reflections

Codesmith / Nettiers
How easy is it to setup and get going?
How simple can you make it?
Looked at config setup and really quite good.

We used custom methods - by putting our own Stored Proc in the Database - GetCurrentQuiz, Codesmith generated the classes we need to wire up.

Subversion
Loved the plug in for Windows explorer

Compared to Visual Source Safe, seems easier to use, and has mergeing.

ASP.NET
So many tutorials (57 in the db section) and videos to watch
and Starter Kits to work through.

To Do
DaveM - build a really simple CodeSmith project
DaveM - setup Subversion live on the net somewhere to host projects
DaveM - asp.net

Review - Agile

eXtreme Programming (XP) is a subset of Agile Methodologies..

Keeping client in the team
Working in small teams
Pair Programming


SCRUM

Used to 'wrap' XP. This is where the word Sprint comes from.
"..maximizing the team's ability to respond in an agile manner to emerging challenges"
http://en.wikipedia.org/wiki/Scrum_(management)

Review - Overall Thoughts

2pm on the following Sunday, over some pretty nice food!

General thoughts from Phil were that Codesmith is a steep learning curve and still complex for small projects

Coding

- What are they? eg Whereby an ArrayList is a collection of objects... Generics allows us to say have a store of strings.. and then wouldn't have to convert the strings to objects and back again. Allows us to keep strongly typed more easily.

Like templates in C++.. Windows Template Library... Windows Foundation Classes...

Why Use C++ these days for projects? Unless drivers / hardware dependant... probably not.

To Do
Dave - Spike Generics

Sunday, May 13, 2007

Day 4 - Go Live!


5:30pm

Changed web.config to live database.

Coppied files to remote server. Ran database scripts (this is a great thing - to keep a text file of your scripts). Included views. We forgot the SP's.

Phil realised we'd forgotton the SP's.

Site works. http://mateer.dnserver.net.nz/treasurefull

End of Sprint.

Well done to everyone - Michael, Phil, Gary and Me (Dave).

Day 4 - Results Page


4pm

I mocked up a results page... Then we all helped to wire it up correctly.

Turned out that the best way to get data like this is to create a view in the database, then let CodeSmith generate classes to reference it. Hard thing was to create the view (well done Phil) after days of hard coding. Michael has another Stored Proc solution.

We wired it up to a DataGrid through an ObjectDataSource.

Day 4 - Debugging / Logging

1pm

Michael got his Logging wrapper for the Enterprise library Logging block working. Basically he installed EL2 on my machine, which have hime the interface to allow him to write entlib.conf files easily. Also the assembly was signed on his machine??

Problems with 2 assigned quizzes being created.

Day 4 - Answers, Clues, Give Up

9am

Michael working on this side of the code (the main Quiz.aspx page). He was looking at initally calling a webservice so that onChange in the answers box, it would fire and we would have functionality like www.smaps.co.nz have when you type in an address - it autocompletes.

However in the end we went for when the user clicks out of the answer box, the event fires.

Michael also looked at caching of the answers locally, so that we wouldn't have to go back to the database each time when a quesiton was answered, or a clue asked for.

Day 4 - Home Page CSS + Ajax

9am

Phil and I working on the home page to make it look good. Using a javascript rollover on the image, where we included the javascript in the Masterpage. Problems with image border, which we solved (badly) by hard coding the inline element with a border=0.

Using CSS for everything as much as possible. So home page has no tables, and using Absolute positions for the images.

Text is simply referenced by classes.

Answers is within an UpdatePanel (for AJAX)...with linkbutton, text box etc.. Passes the actual number the users enters in the query string.

Day 3 - Debugging.. Try/Catch

5pm

Trying to get Exception / Logging libraries working again... Ended up using a Try / Catch around the hyperlinked image which went to the page which failed. There must be a better way.

Eval / Bind. Using 'old school' asp style tags on the aspx page to allow databinding.

Saturday, May 12, 2007

Day 3 - Logging and Exception Handling (coding cat)


2pm


While debugging why the forms app didn't work properly (turned out we'd missed an !). Anyway, we decided that Logging an Exception handling were a 'Good Thing'. So Michael had his own wrapper for the Enterprise Libray.. which we couldn't get working.. Trying to debug the exceptions, and going into the config file.


Looked at linked files / making sure the config files are in the right place.. and we don't have more than one of the same.


Then we created a TreasureError page... but onto the next post.
PS the cat is called Midnight






Day 3 - Data from Excel to DB - SSIS

1pm

While Michael made his forms app, I used SQL 2005 Integration Services. Used my datasource as Excel, and my destination db. Only trick was to remember to set the destination table name, and to map the columns correctly.


Don't know if this is available for SQL 2005 Express users.. to get there from SQL 2005, right click on the database, and tasks export data.

Day 3 - Data from Excel to DB - Forms app


1pm
Michael wrote a Win Forms application that is a project in our existing solution. Basically it uses the Entities layer of our design (Common layer) by

Questions.Add( q );

where q has been instantiated as a new question object, and has properties of text, answer and clue.
When Parse button clicked, instantiates a new object of the filconverter class called conv. Then calls the conv.run(filename.text) method.
The form uses:

private TList questions = new TList();
which is a collection of Question (which is what we have defined in our Entities class), using generics. **To Do... comment source code**


Friday, May 11, 2007

Day 3 - Summerising what we've done


9:30am

While Micahel worked on AJAX I showed Phil what we'd been doing over the last few days.

HelloWorld test on openhost
HelloWorld test from the database (1 tier app) - http://mateer.dnserver.net.nz/dave1/ **To do - fix the virtual directory problem had to comment out the connection string..made a VDirectory**

2 tier app

HelloWorld (3 Tier ) - currently a console application tests the other layers

discussed different layers

Presentation
Business
Data
Common

Out app at the moment, can get one record from the database
Phil then extended it to bring back all records

using Lists
this is an example of generics

Showing how we use business objects to transfer data between layers.

Treasure Hunt - http://mateer.dnserver.net.nz/treasurefull

Day 3 - AJAX

Michael created a simple ajax test page, which I shamelessly hijacked:

http://mateer.dnserver.net.nz/ajaxtest/default.aspx This has no Ajax on int. It is simply a Literal object (text) and 2 buttons, with code behind which does the click event.

http://mateer.dnserver.net.nz/ajaxtest/default2.aspx This has Ajax working.


Phil worked on Spikes:
http://mateer.dnserver.net.nz/phil3/ This again is working under a virtual directory. Here is one that has the upper update panel with a timer inside of it, and a label which adds another . on every tick.

The second has a drop down list (hard coded with data) and the event:
OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged". This runs a filter on the SQLDatasource which is bound to the GridView below it.



How to covert an existing project into an AJAX project

http://community.rampgroup.com/blogs/ramp_technology_group/archive/2006/06/14/82.aspx

There is a sample AJAX datbase application here: (press go at the end to see it running)

http://ajax.asp.net/docs/tutorials/CreateSimpleAJAXApplication.aspx

Thanks Everyone.. we are half way!


A big thanks to Gary who helped out on Day 1.. here is the story on his blog:

http://sharethelearning.blogspot.com/

Also to Phil and Nora for their hard work in preparing the site design and concepts over the last weeks.

And to Michael who is a guru coder.

Thursday, May 10, 2007

Day 2 - Can't Bind to Child Properies....

5:30pm

In the quizDetails section we want to display the name of the Quiz, and it's Description. This is stored in the db, and the data should flow through like everything else.

However when we coppied the control like we used for QuizNumber... which we already

Had to create public properties on the assignedQuiz entity method.



Day 2 - Site live(er) - CSS Controls

5pm

Working on the UI to use the customer CSS controls we discovered yesterday.

Coppied the folders App_Browser, App_Images, CSS, WalkThru into our web project. Basically this makes this very nice and css'y and not tables.

Mocked up the questionContainer... see photo below of our design. We know it will change, so just mocked up best we thought.





The mocking up the quizDetails which are in the picture too.. Found a last minute problem...

Day 2 - Site Live! (sort of)

4pm.


Got the 'site' live on http://mateer.dnserver.net.nz/treasurefull



Problems we had were:



Turned off CustomErrors in web.config (to see crashing in all its glory)
Needed to create a Virtual Folder through the control panel (tedious)

web.config errors: (our solution was to comment out lines until it didn't crash)



**Disclaimer... worked on our machine **

Day 2 - Presentation Layer

1pm

Made Treasure.master for master pages. Have got leftover code from /Admin which Codesmith creates, and allows us to add/edit/del to the database.

Made default.aspx which has an imageButton with the postBack property set to go to Quiz.aspx.

Quiz.aspx is the main page. Using dl (datalist), dt (data text), and dd (data) css style presentation.

Got to the stage of rendering:

At the moment we are using ObjectDataSource, not EntityDataSource (which is a nettiers custom control which hope to use). ObjectDataSource called methods in our Manager layer.

Day 2 - nUnit and TestDriven.net

11am

Added in TestDriven.net which seemed to add in nUnit as well. Installed nUnit seperately as then got the nice interface. TestDriven great as can test the dll without needing a UI application.
Ran the CodeSmith nUnit tests - mainly against the Data layer. These are auto generated by CodeSmith.

Ran our own nUnit tests against the Business Layer (both Manager and Service)
- checkConfigurationTest
this actually tested against the data layer, to make sure our db conenction worked.
We had an issue where we were not referencing the data layer, and it all failed.

- getCurrentQuizTest
tested against service layer
test was it returned notNull

- loadQuestionsTest
tested against service layer
tested that it returned a non empty collection

Day 2 - Creating Custom Method / Stored Proc and wiring up to Manager layer

9am

Here is our rough layout of layers, and table structure.





Created Custom Stored Proc - custom_Quiz_GetCurrentQuiz.

Regenerated Codesmith, and it made in Services.QuizService Quiz a custom method called ..
GetCurrentQuiz.

Then looked at DeepLoad (a method created by Nettiers) which loads the child properties/collections of the quiz into the quiz entity. This was in the Service layer in QuizService in a method called LoadQuestions.

The Manager layer above contains methods.... which the UI will call.

Day 1 - Notepad, Strongly Typed Datasets

9pm

Notepad ++ - http://notepad-plus.sourceforge.net/uk/site.htm Open Source text editor

Reading Data Tutorials from http://www.asp.net/learn/dataaccess/default.aspx?tabid=63. This is a 57 set of subtutorials.

#1 was about the Data Access Layer. To return strongly typed objects, they are using Typed DataSets versus Business Object (which we are using). An example of loosely-typed objects are the dataReader and DataSet... to access a particular column here we would use :

DataTable.Rows[index]["columnName"]
DataTable.Rows[index].columnName (strongly typed)

Advantages of strongly typed are that we know of errors at compile time, and don't have to wait to connect to the database, and see wrong data flow through the app.

Day 1 - Subversion

Source Control is a good thing.

http://svn1clicksetup.tigris.org/ - setup the server using this.

Created new repository called Treasure

inside repository, made conf

svnserver.conf
changed to passwd.txt from passwd

passwd.txt
added in user dave and michael
anon-access = read
auth-access = write

Made a trunk.

Then using TortoiseSVN (right click from explorer menu) imported in files

svn://davehome/treasure/trunk

Only imported in files we will edit into the repository (and not any codesmith generated files, as we can regenerate this anytime, and may frequently do so)

Day 1 - Codesmith4

3pm ish

3 Tier Code Generation Tool. Using the netTiers2 libary.
Uses Enteprise Library, AJAX .NET


Made our Story 1 database with tables of:

Quiz - QuizQuestion - Question
Assigned Quiz

Pointed where we want our code produced
Pointed it at the local database
Selected nUnit testing
Selected to create an admin website
Selected to create Stored Procs

Created the code. Lots of code!

Presentation

Business Layer
Service Layer
Data Layer
Called Data Layer
And SQLClient

Common
Called Entities

UnitTests (this works mainly on the Data layer)

Wednesday, May 9, 2007

Day1 - Hello World 3 Tier


1pm ish - Made a 3 tier hello world application

Using Enterprise Libary Database Factory
SQL 2000 locally

Gary was doing his magic:

Create a new Solution (as it makes is easier).. c:\code\treasure
Asp.net project went in c:\code\treasure\website\
Business library c:\code\treasure\business
Data
Common
TestConsole
treasure - the solution file went in here some reason.

naming - treasure.Data, treasure.Business, treasure.Common .. to prevent any naming clashes in the future.

Added references.. Data needed common. Business needed Common and Data, Presentation need Common and Business. TestConsole needed Common (maybe not) and Business.

Coding
Made Data tier first
Then Common
Business
TestConsole app

Useful shortcuts
ctrl k s - to surround code

Improvements
Generic collections

Day 1 - Architecture and tiers

midday ish...
1-tier application. Put everything in aspx page (or code behind) eg data connection, SQL selects (or even Stored Procs's). Just like dave1 example did earlier. SqlDataSource and Gridview all on one page.

2-tier. Presentation layer and Data layer. http://www.asp.net/learn/dataaccess/tutorial01vb.aspx?tabid=63 Here is an example of this.

3-tier. Presentation (eg aspx), Business, Data. Generally uses a common library too.

Entity Model

Quiz ---- User


Question Response

eg Response would have as properies
- Given Answer (text)
- Validity of Answer (enum)
- Correct
- Clue needed
- Gave up

Data Transfer
Options included:

- Business Objects eg a helloworld business object can have properties of .id .Description and .FullName (which could be a concatenation of id and description). Went for this as it is easier at this stage for future development.

- Structs - this is like a lightweigt class

- Typed Datasets - this class is created by a tool in VS.

Day 1 - Spikes - Hello World!

10am ish....To continue with coding tradition....

We are using Openhost.co.nz for our live webserver.

1 - Hello World in plain text
We put up a default.aspx page on mateer.dnserver.co.nz. I am using VS2005. Created an ftp website, with no local files at all. Just working straight off live. Using the inbuilt ftp explorer in VS... website, copy website.

2- Hello World from a database
We created a database on openhost. Then created a user. Created a new ftp project called dave1. Then used a SqlDataSource control to connect to the live database, using the wizard and the SQL database login we'd just created. Then bound a GridView, DataList, and DetailsView.
http://mateer.dnserver.net.nz/dave1/Default.aspx

3 - Connected to live database through SQL Server Management Studio
Had to open up a port on Openhost's firewall. Then could connect.
http://mateer.dnserver.net.nz:85/sql.php

Watch out above, especially if you're behind a firewall, as more than likely they will block this outgoing port.

Day 1 - Goals and Storyboard


Day 1 - 9:00am The start of the Sprint!

Who: Gary and Michael and Myself.

We discussed the Goals of the project
"To see how good Visual Studio 2005 / C# ASP.NET2 is at developing rapidly, to use agile techniques, and to use good practise"

Discussed the ASPNETCssFriendlyAdapters.vsi which is a CSS set of plug ins for Visual Studio which generate standards compliant code (ie not tables, but div's etc..) Why use this? Accessibility, fast loading, and easy to make other versions of pages eg a printable version.

Our Website
Went through stories (on a whiteboard).. we'd already come up with rough designs on the site on paper.

1) User clicks 'Get a Quiz', prints out page with a unique non sequential quiz number.

2) User clicks 'Get a Quiz', answers most questions, then goes away to find other answers.

3) Users returns to answer remaining questions. Users knows if answer is correct after each question is answered. Answer compared against range of answers.

4) User comes along and puts in wrong quiz number

5) User presses clue on a question

6) Users gives up on a question

7) Once all questions got right, or gave up. Go to results page. User can then enter name optionally in high score table.

Design will have to highlight the quiz number, as without it people wont be able to get back to their session.