Mongo, Express vs mySQL - php

im currently in the face of considering what to use for building a piece of software - The system needs to handle complexity like:
- User Management (ex: Trainer Login - Client login)
Different dashboards (Depending on user profile)
Workout Builder (Trainer must be able to create workout programs and send(email) and attach (Client can see workout program in system) the program to a client)
Diet Plans (much like the above)
Workout Library
Booking/Calendar (Client should be able to book a trainer)
Training Logs etc...
As you can see, there would be alot of relations/bindings etc, and personlization (Dashboards) etc... I think you get the idea :) - However, im a Frontend Developer, I do have php experience and mySQL (However a long time ago) - So the question is... Is this system possible to build completely with ex: Angular, Express, Mongo and Node - Or would I have to depend on a database system like mySQL and use ex: PHP for the system ?
Thx in advance for any answers :)

In my opinion, if your hands on experience with PHP and MySQL is good enough you should go ahead and deploy your application with PHP and MySQL with MongoDB as an additional database.
I understand that MEAN stack can power up your complete app, but the development time would be longer, and for what I have felt while using MongoDB over petabytes of data is that MongoDB is amazingly great for storing complex data in a flat architecture in massive size. But just like all databases, even MongoDB has certain constraints.
You should go ahead with MySQL for your usual Login credentials and minor activities, for storing Diet Plans, Workout Libraries use MongoDB. Because that gives you a flexibility of the varying document structure and high availability. Over the time you will find MongoDB easier to work upon than MySQL.
Using MEAN Stack is great. But, now I prefer to use a mixed architecture of MySQL, MongoDB, and PostGres. If you are going to use any framework it would probably have ACL in it or available as an add-on, and that could help you with building permissions and roles of users.
Also, if you are using MongoDB, make sure you code according to the engine MMAP or WiredTiger, I had to do a major recoding because of the storage engine changes. Just a heads up!

Yes, it is possible to build on pure JavaScript stack like MEAN: MongoDB, Angular, Express, Node.js
Everything that MySQL does, MongoDB can do also. The question is only in proper database design and performance for specific use cases.

Related

Building Codeigniter Custom Application (seeking Advice) NoSQL?

Recently I've worked with my Developer to build a Codeigniter application to track user clicks on some ad campaigns using PHP/MySQL. In the past, I had used other paid tools out there to accomplish this, though they lacked the customization of building your own. This is what led me to this journey. Currently everything is setup on a VPS (paying about $70/month through Knownhost), so I think it should be good enough for what I'm trying to accomplish.
That being said, after building the initial tool and finally putting it to the test, it's super slow (usually resulting in 404 error, or a stuck query). I did some research, and I've discovered a few of my limitations. Anytime I try to gather click data on 5000+ clicks, it super slow (not loading 90% of the time).
1). Everything is built using MySQL (vs. NoSQL) and using a relational database. Accessing the data like this seems to be resulting in super slow queries. MongoDB looks like a valid non-relational database solution that looks affordable.
2). I'm not using a Cloud Database system (i.e. Amazon DynamoDB or Amazon RDS).
Next steps?
The next thing I'm going to test is loading the application on AWS Elastic Beanstalk to see if this improves the speed. If not, I will be going back to the drawing board and finding a plan of attack to optimize the page load dilemma I'm encountering.
Question:
1). Of the 3 points above, which do you think is going to result in loading the data faster. Obviously, some of it comes down to the programmer's ability to minimize and write efficient code ;)
2). If this were you, which of these areas would you attack first (if any). And if none, what would you recommend?
Thanks in advance, everyone. I appreciate your advice.

SPA server side framework

I am developing a new page and can not decide witch server technology I should use. I will try to describe as best I can, what I am making and hoping someone will have some advice for me.
The choice I have to made is PHP vs ASP.NET and in case of ASP.NET MsSQL vs PostgreSQL.
I must say I already spend a few months comparing and experimenting with this 2 products (and know both for many years, but for small projects).
So if I get to the point:
My web page will definitely be SPA. I don't intend to change some div content to achieve that, but open different content in dialogs or if you know KendoUI windows.
Everything else could be adapted to the selected framework. I don't plan to have many different views, but those few will heavily depend on data from database. The core of my page will be one view bind to a table with few 10/100 thousand records.
I am using jQuery to get data from server. I started with PHP, but it soon became very large project, tons of files for handling users, roles, access to file system, managing database, quering database, editing database, handling different language support... I use try version of zend studio which is great framework (you get debugger which is a little bugging from time to time) but can not compete with visual studio.
I also read on internet that all big sites (except SO) use PHP because they started small and when they became big there is no way to migrate to different server technology.
I get problems with requires files (there are to many) if I include from index.php there is different path that from AjaxCall/ProcessLogin.php. I always forgot to include some file and get unexpected result in client. ASP.NET would solve this problem. I huge disadvantage is also unknown types in PHP. I call function which return array of objects populate from database and I don't know nothing about object structure, but when using LINQ to SQL I know everything. It bothers me also that can not have 2 functions with same name and different parameters. LINQ to SQL is also amazing. And so on. Those who use both of them, you can say what advantages has developing in Visual studio c# over Zend studio in PHP.
I know (from what I read in past months) that PHP will get me better performance, that sometimes could be slower because of the interpreter. Again, I just use functions to get some data and on client side use telerik KendoUI for rendering contents.
My questions that I can not answer myself is is ASP.NET the right choise if I don't plan to use any other feature then [WebMethod] (any server side events, ASP.NET controls...)? Probably I should go with ASP.NET Web API or ASP.NET single page application? I read tutorial how can I call method with jQuery. I also found this thread. But I need to decide if I stick with PHP and do some hard work for stuff that I mention up, or I should use ASP.NET, get some really nice stuff on account of performance.
I must say that cost are not the problem. Hosting windows server, Visual studio ...
tldr; use PHP's Laravel Framework, it's a very good framework to start and it grows with you. Also it's heavily influenced by ASP.NET and Rails, just for the PHP world. Build your REST API with laravel and use jQuery for the AJAX stuff. Querying the database (e.g. postgres) with Laravel is amazing, just write something like User::where('age', 21)->get();.
Check spa-cart.com
Already much features with PHP SPA CMS

How to integrate two different applications ? Web applications

Hi all i am a Student working on a project in an Hospital we designed an application where patient can book an appointment with doctor similar to this application (apphp.com/php-medical-appointment/examples/sample2/index.php) and our application uses php and mysql and runs on microcms framework now what we are trying to do is to get this application integrated with MedTrak (http://www.intersystems.com/trakcare/) which uses CACHE DB (Intersystems Cache db a post relational db)
we have written our application using mysql so is there any possible ways that we can fire data from our application to their db and. get, data from their db
So far we have tried these methods
odbc will it work cause we have to write our application in ODBC again
Help
Enterprise Application Patterns is a great book and I highly recommend it. However, I would add that even if you had top notch messaging middle-ware available to ensure the 2 applications are as loosely coupled as possible, at some point you will have to read or write to the Cache database, and you will probably need both.
Also, a sophisticated approach to integration may or may not be feasible on a student project. Perhaps it would be sufficient to have most of your code talk to an abstract communication layer that encapsulates the exact integration? You could start with whatever is simplest to implement but could have a story about how it could be changed later. Even this is probably quite hard enough for a student project, since the interface really should assume the communication is asynchronous.
In any case, at some point the rubber will meet the road and you will have to read and/or write to the Cache database. And at that point, ODBC is available, and sounds like it would be a good choice for you. There are other methods to connect to Cache but ODBC is widely used (and therefore probably more reliable) and doesn't require you to learn Cache Object Script, which would be a lot of extra work for your situation.
There are many ways to achieve this - the best way to learn about this is to read "Enterprise Integration Patterns".
I wouldn't recommend writing directly to each other's database - it is a fragile way of gluing apps together, because a change in one schema requires you to change the other app at the exact same time. You have to deal with exotic failure modes - one database may be down for backups, which means you can't write the changes from the other database to it.
Read the book for alternatives!

Good NoSQL database for Write-Read Intensive Site

Ok I do have a small messaging site for my client. Well its more likely a post-comment system(created in PHP). Now my client want a system that can comment to another existing comment and add some features like liking and tagging. Another thing is the existing system is heavily used by my client in his company as they use it like a skype chat(that makes it write-read intensive). well my client want's to use open source software as possible. so I used mysql community edition.
Too much about my story... So I had a 1 week research about NoSql databases and I found it right for my requirements as my client wants to add features (that means adding and adding columns and tables from time to time.) Now these are nosql database systems that caught my eye.(well if you can suggest other nosql database system its ok)
MongoDB
CouchDB
Redis
Now my question is which of the three is good for my situation? I also read some bad things about those 3 nosql databases
MongoDB is crappy on its 2.x version
CouchDB is slow (my client doesn't want slow)
Redis is memory-based so it just writes on the disk on certain intervals. so when the system crash in the middle of the interval then the data is lost
I want to have some opinions about this and any advice that can help me to cope up with my upcoming situation
MongoDB is a popular solution to this, and my personal preference. The great thing about Mongo (besides being schemaless) is that you can have nested/embedded documents. So for example, you can have a comment which has an array of sub-comments which each have their own arrays of sub-comments. I don't know of any other datastore that has that feature. It's also fast.
CouchDB has some nice features, but Mongo is so similar and much better.
Redis is very different from the other two. It's used mostly as an alternative to memcached. So it's primarily used for temporary data. Although it has some nice pubsub features built in. A lot of people use both MongoDB and Redis, but for different things.

Migrating technologies: PHP+MySQL -> ASP.NET MVC+MS SQL 2008

I have a completed web app in PHP 5 + MySQL. I have not yet started its conversion, but it will migrate to ASP.NET MVC + MS SQL 2008. I'm not sure how to progress for the easiest transition:
Edit the PHP DAL for SQL Server. Migrate to the new db immediately
Leave the live code alone. Create ASP.NET MVC with a MySQL DAL to use for now. Migrate to new db later
Leave the live code alone. Write the new version entirely. Transition db and code at the same time
Is there some common wisdom for which path is best to take?
Edit: addressing Dave's question:
How are you accessing the database? If you have really good separation
between your code and database and are using stored procedures it would
probably affect the answers given.
None of the ASP.NET MVC stuff has been written at all. There will have to be some changes to make the current PHP data layer work with MS SQL. I'm currently taking advantage of some PHP+MySQL stuff that doesn't exist with PHP+MSSQL. Nothing major but it will take some amount of retooling. My data layer is sufficiently separate that I hope it won't be too invasive.
Also what's your release plan? Will you be forced to release incrementally
or do you plan on just "flipping the switch" one day?
Flipping the switch -- it's just a hobby site for my family. But I'm not opposed to leaving 1 db and both code sets live for a while until I feel confident that the new one is fine.
Edit 2:
Looks like my options are limited more than I thought. You can only use PHP's native MSSQL functions for SQL 2000 and before. For 2005+ you need to install MS provided drivers. I'm on el cheapo shared hosting so I can't really ask them to install drivers for me. Looks like I unfortunately have my answer :(
The purists will suggest starting with TDD so you can have a gauge of when the migration is fairly complete by having all unit tests pass.
However, I would suggest that you start with the app from scratch in ASP.NET MVC as it's very different from a non-MVC PHP application. I'd map the data layer first and build some models then work my way up controllers and the view. The data models should be fairly easy to migrate if you use the visual studio surface designer.
An easy way would be to use an Application generator.
There are many available like:
- Iron Speed Designer (only supports ASP.NET)
- Code Charge Studio (supports many different web scripting languages like PHP, ASP, ASP.NET, Pearl, etc.)
I have tried out both. But have not been satisfied with any as they have not documented the MVC/MVP part to extent that it becomes easy for developers to modify generated code.
Iron Speeds Designer MVC is better compared to CCS but ISD will prove to be costly as it supports only one set of technology while CCS supports many and one can add support for new language with a little support from its developers.

Categories