Planning a database app [closed] - database

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
I am in the planning stages of a database app for personal use. I have a good bit of the database structure planned, but as I think about how I'm going to write the program, it made me wonder if I'm doing this in the right order.
Which should I be planning first, the db structure or the classes?

I think designing your data model first is a very good idea.
If the app is to be database driven it is a good idea to have an solid understanding of what your data model is going to look like before even attempting to write any code.
You can still conceptualize how you think the classes may look as your thinking about your data model. Keeping this in the back of your mind as you determine your requirements will help when you begin to write some code as well.
Of course, as you begin to write code you will probably have to revisit your data structure, so it is an iterative process, but good planning at the onset of the project is a good idea.

I think you will get a differnt answer from data centric poeple vice application centric people. Personally I always start with the data but an application programmer would probably start with the classes.
In reality, I think you need to work on the two at the same time.

They most often develop together, although it's often easiest to start designing the basic structure of the database, and then move to the code. You'll find that depending on the size of your application the database will change frequently along the way to final product.

I typically plan as best I can, then I start creating the database per the planning/design specs I wrote for myself.
Then, I use something like Linq-To-SQL to generate some basic DAL classes -- wrap those in a repository class that manages most of my CRUD situations.
Depending on the complexity of the app, I then write a GUI which consumes the repository directly (quick/dirty) or I write a domain logic class (and potentially Data-Transfer-Objects or dumb POCOs) which wraps up the functionality in the repository.
Obviously, the best planning misses things, so make sure you take in to account that you'll have to go back and add fields, change types, add relationships etc.

If the purpose of your system is to store, retrieve and report on data, then I would say by all means it is appropriate to design the database first.
If, on the other hand, the purpose of the system is to implement a business process or processes using software, then it will often be more efficient to design the "domain model" first, modeling out the business process into objects/classes, then determining how to persist them to/from a database later.

Related

When to go with traditional Java stack (Struts2/SpringMVC) vs modern JS stack (AngularJS, NodeJS etc) [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
Improve this question
We need to implement a one-form app (long form) that persists into Oracle DB. There are no Web services of any kind. The culture is traditionally Java-oriented here but it's open for suggestions.
What are the Pros and Cons of going with:
The traditional MVC Java stack - Spring, Struts2 or SpringMvC, Hibernate
The JS (modern) stack - AngularJS, NodeJS, ReactJS
Any clear explanation of the differences, with the Pros and Cons, would be strongly appreciated.
As I stated, I haven't been able to find a reasonable and understandable comparison.
It's apples and oranges. I'm only posting this as an answer because it outgrew the comment.
First to nitpick a bit, AngularJS is front-end technology, you can use it with any back-end technology (I use it with Struts2). So lets remove that from the comparison.
Second nitpick your comparison is more a JS vs Java choice. If you did your research you could be comparing NodeJS against Play, Vert.x, or similar. Not because those frameworks are "modern" but because they share some of design goals which made NodeJS what it is (Vert.x is very similar in intention, it has comparable speed, non-blocking design, and allows for polyglot programming).
But really there is something more fundamental than the frameworks... and that is the language. If you know JS and you've worked on the front end design did a mockup and then need to develop server side services and aren't more comfortable with another language, well it really doesn't make sense to invest in that heavy lifting when you can start doing something useful right away. It's also the same the other way (from the Java perspective) no matter what the framework you need to invest time, if you already know a Java web framework, why waste your time figuring out something else?
That last question isn't rhetorical, seriously why waste your time? In defence of keeping with JS, you can keep everything in one language, NodeJS is pretty fast, although keeping the comparison fair there are many Java web frameworks Struts2/SpringMVC don't have similar design goals to NodeJS while Play, Vert.x, and I'm sure there are others would be a more fair comparison. JS has a different way of doing things and if you have JS ninjas then it does make sense to do everything that way. As for why Java, it is fast, it has an enormous codebase, there are APIs and frameworks for everything, from meta programming, AI, robotics, security, obviously databases and everything common, there is enormous choice. It is more structured, in the end this means that months later you can generally figure out what you were doing and you can better share work and divisions of labour. But again, does any of that matter? I'm not looking to start an argument with the general public, only you know your requirements. Consider them and also consider human nature and take a reasonable course.
In my experience people use what they know, people I find are often splitting hairs over their favourite framework and someone else's for no other reason that that is what they know. If you're going to use some technical tooling advantage to try an get consensus that is highly unlikely to happen, and I would recommend first to look at your human resource capabilities; I mean you could write it in Java or JS, whatever but happy employees will produce way more regardless! What the majority would rather work with can't be discounted lightly.
This is not a question which stack you use. Pros and cons have nothing with the technology involved rather than humiliating the user experience by choosing one framework over another.
If you get any project from an idea to the production software you should know that many many, many factors apply on making decision on the architecture of the project. All it depends on the proposal that you should write first. The quality of this document will make influence on the further decisions and directions, feed-backs from the end user who is the consumer of the desired product.
No language, no framework, no programmer needed to provide you the user requirements. It's just the software that should do some things. That's all you need to know at the first time.
You can promise the user that you can build the software that is required, but you don't tell how it would be built, which language you use, framework, technology, resources.
You can see what other people is created and how it works and if it fits with what user is required then you luckily copy/paste. Unfortunately, it doesn't work in most cases and you have to pay for every brick in the building.
The most significant part over technology is programming resources. If you have such resources that you already tied a half which technology is preferred to use with the project. Technologies, languages, frameworks are different, and nobody can handle them all with expert level. You can build the software with one framework, then rebuild it from scratch with another and then you can compare. If you can't compare the costs used to build the software than your decision is just opinion based on other opinions.
The pro-vision occurred if you have experience of building production software on different platforms using different languages and different frameworks. Because many languages, frameworks are in most business problem oriented and recommended to use by experts as suitable to solve such kind of problems. There's no any point which one is better, because if you choose one that is more recommended than others and create ugly software using it you can't say that it's worse that others that are less recommended. On the other hand if you choose framework and create the great software that may be lacks some features available in other frameworks you'll win.
Don't play with the technology, use qualified consulting services. This is out of the topics of stackoverflow. Because this information is always commercial. Good luck with your endeavors to find the better software that suits your needs.

Creating custom order system [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
The question i have is many fold.
So I work IT for this company. It’s a small company. Very small. They have an ancient ordering system that uses MSACCESS and was built in Visual Basic. I’ve been tasked with developing a new ordering system that processes orders as well as take in orders online.
I’ve created an order form in Excel with all the proper calculations that need to be made as sort of a foundation. I’ve found a service called SpreadsheetConverter that converts it to HTML or if I’d like Node.JS. But to be completely honest I have no idea what to do with Node.JS. I have some knowledge of VB and i’m (sort of) starting to understand databases.
My question is where would the best place to start if I wanted to build an application that can take in orders, store/retrieve customer data (autofill?), store order information into a database so i can retrieve them. The order system has to customly tailored to this company, they make Doors, so the calculations deal a lot with sizes and styles.
I have all the calculations i need. Basically where should i start if I want to build a UI, write simple code, and have it interact with a database. I’ve checked out Xojo, I have a Mac so i cant use Visual Basic. Where should i look to start a database?
Or is it possible to connect the Node.JS that spreadsheetconverter creates and connect it to something like Firebase?
I’m sorry if this all seems confusing, I basically don’t know where to start and a push in the right direction is all i need so i can narrow my focus.
Xojo might indeed be a good start for this.
Xojo includes access to a sqlite database, and you can add new records rather easily. You do need to know how to design and query an SQL db, though.
The biggest question is probably how to implement the user interface. This will be the biggest task. With Xojo, you can design it fairly easily, using its window layout editor.
Then you can either develop a monolithic desktop app, i.a. a Mac or Windows app that runs and maintains its database all on the same, single, computer. Or, if you want to allow multiple users access the database from different computers, consider writing a Web application in Xojo, which will be used through a web browser then. Most code will be the same, but testing will be a bit more complex and slower for a Web app, probably.
You would have to re-implement all your calculations in Xojo, though, as Xojo has no way to use or import Excel sheets this way.
Also, have a look at FileMaker. I have never used it but it may fit your needs.

Disadvantages of Page Object Model in Selenium [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
Are there any disadvantages of using page objects for Selenium tests?
Page Objects Model is best suited for applications which have multiple pages or states. Each of which have fields which can be uniquely referenced with respect to the page.
Advantages:
Object Repository: You can create an Object Repository of the fields segmented page-wise. This as a result provides a Page Repository of the application as well. Each page will be defined as a java class. All the fields in the page will be defined in an interface as members. The class will then implement the interface.
Functional Encapsulation: All possible functionality or operations that can be performed on a page can be defined and contained within the same class created for each page. This allows for clear definition and scope of each page's functionality.
Low maintenance: Any User Interface changes can swiftly be implemented into the interface as well as class.
Programmer Friendly: Robust and more readable. The Object-oriented approach makes the framework programmer friendly.
Low Redundancy: Helps reduce duplication of code. If the architecture is correctly and sufficiently defined, the POM gets more done in less code.
Efficient & Scalable: Faster than other keyword-driven/data-driven approaches where Excel sheets are to be read/written.
Disadvantages
High Setup Time & Effort: Initial effort investment in development of Automation Framework is high. This is the biggest weight of POM in case of web applications with hundreds/thousands of pages. It is highly suggested that if this model is decided to be implemented, then it should be done parallel to development of the application. Refer V-Model for Software Development Life Cycle.
Skilled labor: Testers not technically sound or aware of programming best practices are a nightmare in this case. Perhaps this is the biggest mistake to make, employing unskilled labor in hopes of training them during implementation. Unskilled testers need to undergo a Training Boot Camp to be ready for such an undertaking. Also the Architecture of the framework should be defined clearly and completely before development in order to avoid any loopholes in later stages. Every application is different and it may require the automation framework to be significantly tailored towards it.
Specific: Not a generic model. Automation Framework developed using POM approach is specific to the application. Unlike keyword-driven/data-driven frameworks, it is not a generic framework.
Irrespective of the disadvantages, POM is perhaps the most efficient and highly recommended approach towards any web application. As the framework matures it is perhaps easier to modify it into a hybrid framework from a POM approach than from other keyword/data driven approaches.

How do database driven blog-style websites work? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
Before I start: I know this is a very broad question, but it is the best way I could phrase it, I have searched around a lot and can only seem to find generic explanations. I searched SO and didn't find much. I have also skimmed through some pages in the wordpress codex, and didn't find anything really useful.
I would like to create a simple database driven blog-style website, it will really only consist of stories (their title, date, content, etc), I just began teaching myself web development and my idea of how database driven websites work has proven to be completely wrong. I figured you would always need a file connecting to the database for each article, but the more I read I learn about mark up being generated on request, and so on, so the actual /year/month/day/article doesn't actually have to exist on the server, or that may be wrong, that is why I am here.
As I said I cannot find much on this topic that isn't a generic graphic of a server interacting with a web page. How does one go about creating a database driven website of this style? Are the files/directories not actually on the server but only created on a case by case basis as someone requests it? If so, then why can you type out a complete url and it be there with out throwing a 404? I have a lot of questions, really all I need is a strong explanation of how these sites work, code examples, and so on. Could someone explain how they work or point me to information (recommended articles, examples or books)?
EDIT: Please don't recommend a framework, I want to understand how these sites work and build one myself.
It's actually quite simple. Wordpress's index page calls wp-blog-header.php. That file calls for other files, and those files call for other files. It goes on for some time until all the contents of the page are actually loaded.
The databases come in when you start thinking about having users. Obviously the user information is stored in the database. Beyond that, Wordpress keeps post titles, dates, and other information in the database for easy loading later on.
Comments are also stored in the database. Each comment is associated with a number, and in the database, just like the posts, the dates/times as well as the usernames associated with the comments are kept.
Further exploration in the actual Wordpress files will reveal a lot of interesting features.
You might want to check out Django. It is an open source Python web framework that provides a lot of the functionality you are talking about. It also has a lot of very good high-level documentation with even a free e-book. It is centered a bit more on newspaper type sites than blogging, but most of the same principles apply. If you are new to python and like to use IDEs I would recommend checking out PyCharm. It has tight Django integration and makes for simple project setup and debugging.
Generally speaking, you'll use a framework that will take input parameters (year/month/day/article), run some code to fetch data from the database, and dynamically create the webpage. There isn't an actual .html file sitting on the webserver. One of the most popular frameworks to do websites like you're describing is Ruby on Rails, which makes it incredibly simple to do.

Keeping validation logic in sync between server and client sides [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
In my previous question, most commenters agreed that having validation logic both at client & server sides is a good thing.
However there is a problem - you need to keep your validation rules in sync between database and client code.
So the question is, how can we deal with it?
One approach is to use ORM techniques, modern ORM tools can produce code that can take care of data validation prior sending it to the server.
I'm interested in hearing your opinions.
Do you have some kind of standard process to deal with this problem? Or maybe you think that this is not a problem at all?
EDIT
Guys, first of all thank you for your answers.
Tomorrow I will sum up you answers and update question's text like in this case.
As mentioned in one of the answers to the other post, if you are going to keep your layers separated, there is no good way to avoid duplicating the validation logic in each layer. If you use something to automatically tie them together, you have introduced a sort of coupling between the layers that might hinder you down the road. This might be one of those cases where you just have to keep track of things manually.
However you go about it, you have to make sure each layer is doing its own validation, because you never know how that layer is going to be accessed. There's no guarantee that all the layers you implemented will always stay together.
I like to use a validation service, which doesn't necessarily care about the origin of the data to be validated. This can work in a few different ways when you get to the part about transmitting validation rules to a client (i.e. web page), but I feel the most important aspect of this is to have a single authority for the actual validation rules.
For example, if you have validation logic on your data core entities, like a collection of ValidationRule objects that are checked via a Validate method - a very typical scenario, then I would promote those same rules to the client (javascript) via a transformation.
In the ASP.NET world (the only one I can speak to) there are a couple of ways to do this. My preferred method involves creating custom validators that tie in to your UI widgets to fields (and all their validation rules) on your entities. The advantage of this is that all your validation logic can be bundled into a single validator. The down side is that your validation messages will become dense, since the validation rules are all tested at once. This can, of course, be mitigated by having your validation logic return only a mention of the first failure, etc.
This answer probably sounds sort of nebulous and unspecific, but the two points that I'd like to make are:
Validation should occur as close as possible to the points where data is entered and where it's committed.
The same validation rules should be used wherever validation occurs - if client-side validation passes, then it should never fail validation later on (pre-save business rules, foreign key violation, etc.)
Some framework provides a validation support the may keep your client and server validation in sync. Take a look at this Seam validation tutorial using annotations. It's a good implementation and very easy to understand.
Anyway, if you don't wan't to rely on frameworks, I think it is easy to implement something similar.
If you're using ASP.Net there are a number of validation controls you can use. These controls are written in a very generic way, such that most of them automatically duplicate your validation logic between the client and server, even though you only set options for the control in one place.
You are also free to inherit from them to create additional domain specific validators, and there are third-party control packs on the web you can get that add to the base controls.
Even if you're not using ASP.Net it's worth taking a look at how this is done. It will give you ideas for how to do something similar in your own platform.

Resources