Question

As requested by my teaching professor of "Database Basics", I need to build a solid software project to get access to my final exam of this teaching.

My thoughts were to build an application (let's say a simple android application with a map) that would communicate with a WCF service(attached, obviously, to the DB i need to implement).

Now, here's the (probably dumb) question: it's ok if i reference directly my rows with the primary key? Following the example with the map, the service would give me a list of "markers" (which they would populate the map) with a ID each. It's generally safe to exchange the primary key of a table (in this case, the ID) for an easier use to the clients?

Was it helpful?

Solution

It's technically possible to pass primary keys through different modules of your system, but from a software engineering point of view, It's totally discouraged. There's a famous concept called Layered Programming, which you should have heard of it for sure.
The general purpose of this concept is the separation of functionalities or Loosely Coupling and ease of maintenance and further developments management. The concept introduces 3 general layers for any software solution (mostly data-oriented) : DAL (Data Access Layer), BLL(Business Logic Layer) and PL (Presentation Layer), which refer to 3 different aspect of the software solution.

Since you're to implement a college project, you don't have to go through the process of layered development, necessarily. But I recommend you to just try a simple methodology of this concept, because it really helps to build a robust foundation and dramatically decreases the rate of errors and code correction and adjustment efforts.

Also , exchanging primary key or any database-native data is totally discouraged.So try to exchange some other identifier. You can try to build an arbitrary identifier for each map marker, based on the primary key.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top