Last night while i was talking with my little sister about her exercise: Making a website to sell old/unused book. She is studying business matter. Wow a good idea! Suddenly i came up with a site doing nearly the same thing. It is for Sharing books. Basically it is quite different since i am not making any business here or gain any money from that action.
Let start with the story. When i was at the university, every semater i spent lots of money on books. Event though the true was not 🙁 since i was not so interested in those books at all. And then when it came over, where those books went? They became garbage; a waste of money. And the cycle begins with new comers. So what can we do? Instead of buying the new ones, we can ask for them with lower price or even free ( if you meet a generous guy).
What is the obstacle in that solution? The communication: how do you know where/who to ask for? Therefore, the site i am going to build is a meant to solve that issue. Of course it needs help from many people especially the ones who have old books.
Let summary the process:
Book owner publishes books into the site.
People needing book go in and search for them.
He, then, contacts with book owner for a deal.
Book owner updates the available number of that book or remove them if out of stock.
Simple 🙂
Version 1.o:
The very first version should be simple and supply enough functionalities: search, upload, manage books. Below are stories in this version. The search GUI should be something like google. As simple as possible.
User stories:
Story 1: Seeking for books
As a normal user who is looking for a book without registered
I want to look for books by name
When i enter the name
Then the system should return to me list of books with having that name in their name and i should know the author as well as the description.
Story 2: Registration is required when uploading book
As a normal user having some books
I want to share or sell to others
When i ask for that task
Then the system requires her/him to register into the system. When done, redirect them to the upload page.
Story 3: Register user
As a normal user
I am required to register in.
Then the system show me form to fill in information: Name(required), Email, Phone, Address(required)
Story 4: Upload book
As a registered user
I want to upload book i have into the site
When i ask for it
Then the system should show me the GUI to allow entering book details: Name, Author, Type, Description, Available amount, Price
Story 5: Display my books
As a registered user
I want to see all books uploaded by myself
When i log in and want to see them
Then the system should list them out
Story 6: Remove books
As a register user
I want to remove some books since they have been bought or free-given
When i am in my display books
Then i should be possible to remove them and they no longer appear in the site.
Story 7: Added/changed book displays immediately
As a registered user
I want to see my added book shown immediately in the list
When i finish adding one book
Then the book should appear immediately on the list.
Story 8: Only me or addministrator can remove/change my books
As a registered user
I try to remove or change info of books which are not mine
Then i have no way to do that.
Story 9: Show total visitor so far and today
As a user goes in the site
I want to know how many people has visited the site so far
When i am in the home page, the page to search books
Then the system shows me that number and the number of today.
So great! I have not been on vacation for long time. Usually, when having vacation days, i go to my hometown, staying with my family, It was fine. Thing changed! I took a vacation for 4 days going to Buon Ma Thuat City.
The very first word, i want to say thank you to my friends in Buon Ma Thuat: Van Anh, Her boyfriend, Le Vi, and his friends. They are soooo nice and guide me visiting many places. We really had happy time staying there.
Back to the trip, it took about 7 hours to get there, about 350KM far from HCM city, 150K/person for the ticket. The bus stopped at Bu Dang station for upping your power and toilet as well.
After 30 minutes at Bu Dang, Got in the bus and drove straightforward to Buon Ma Thuat city. Even thought, it was a long trip, we did not get tired since sleeping all the time on bus.
Bravo, Welcome to BMT, the first feeling was: the fresh, cool atmostphere. Checked in the hotel, took a rest and started with first day.
Day 1: Buon Don, 40km from Buon Ma Thuat city
We decided to target at Buon Don. My friend, VA with his boyfriend, took us for breakfast and morning coffee. Driving on the road to Buon Don york, suddenly i felt something strange: Hic the after tire broke. No problem, i got the nouvo one from his brother :). From that on, i got it for the left days:
Eventually i got to Buon Don, ticket costs 20/person.
The bamboo chain-bridge used to navigate there. Wow, it was a little bit worry for the first time. However, it was exciting :). There were not much sight seeings here. The interesting things were that i knew it and felt like it. It is best for outdoor activity. You can bring food, beer, water or whatever to eat, drink in and enjoy with your friend. Here are some pics taken there:
Here is the food i used and the elephan:
We also went to another place however it was not so exciting. it was peaceful.
Day 2: Draysap waterfall ( DakNong province). About 30km from Buon Ma Thuat city
As normal, we started with breakfast and coffee for a new day. I love coffee so much.
We went to the waterfall with other friends from my friend Vi. We were a group of 9 people on moto bikes.
public static void CloseCurrentSession()
{
HttpContext context = HttpContext.Current;
ISession session = context.Items[CurrentSessionKey] as ISession;
if (session == null)
return;
session.Close();
context.Items.Remove(CurrentSessionKey);
}
public static void CloseSessionFactory()
{
if (_sessionFactory != null)
_sessionFactory.Close();
}
public static void CommitTransaction()
{
GetCurrentSession().Transaction.Commit();
}
public static void AbortTransaction()
{
GetCurrentSession().Transaction.Rollback();
}
}
It contains some methods to deal with transaction.
The configuration is done, and ready to use. Come to your business class.
Business classes:
They are all under AnhDuc.Blog,Business project. Each class has its own mapping file. All mapping files are put under hbm folder. I am not going to explain in detail about mapping here. However, it is the most important thing when you work with NHibernate.
Be aware of inheritance when designing your domain. In many cases, inheritance is not encouraged.
So far i have read many articles about web application development. So general speaking, i have tools in hand to build a website in no time with less effort. Just need to structure code and deal with business logic.
Here are some:
NHibernate: Deal with DataAccess layer and maybe more.
IoC, from Windsor, and Mock from Rhino deal with DI and Unit testing
jQuery to work with JavaScript
NUnit to test my code
That’s quite enough! However i have never interated them in one application at all. That’s why i am going to make a simple web application to demonstrate my understanding.
The web is about a blog site with:
List of categories on the left.
Click on one category, then list out all blogs in that category in short.
Click on one blog item, then the detail is displayed
Assuming that, all data will be added into DB directly. What i want to archive are:
Of course, the system works
Easy to extend, since i will add administrative functions later: Add, Edit, Delete,…
Easy to maintain code.
Apply all the things i have known so far, those i list above.
Along with the development process, i will update my blog. I am sure there will be more fun while doing it, yeah with difficulties as well.