mstnorris's avatar

Real-world app example and best practices

I would really love to see a real-world app example, going in a little more depth, maybe skipping over the things quickly that have already been covered in other series.

It would be great if it could include best practices. For me, I struggle with the when and why I would use something more than the actual doing the work.

Or, could we have a section (and others can chime in here) or little scenarios and the appropriate solution.

0 likes
16 replies
mstnorris's avatar

@RachidLaasri that doesn't help ;) I understand that and preach it all the time. But I am in the process of putting a very large app together and want to know the best practices for a real world, large scale app. Not just something that is put together to get us started. It doesn't have to come in the form of a lesson as I appreciate that it isn't for everyone, but like you have done, I would appreciate others saying what they've done and why and how they've done it.

mstnorris's avatar

@RobertDBroley or even a commentary what certain apps are likely to use. Even apps that don't use Laravel as I'm sure there are more that don't than those that do. I would just like to see some examples of what their architecture may be like.

Also, a series / few lessons on what architecture would be needed for large scale apps.

toniperic's avatar

There's a great Larabook series here at Laracasts. It's a great real-world example where you can often find good practices and great ideas on how to design your app.

mstnorris's avatar

@toniperic I watched that one when it was published as I am sure everyone else here has (who has a subscription). But I want something more, (maybe I am not making my point clear enough).

I don't think another "how to" or step-by-step doing the same thing, but maybe discuss what the requirements would be. For example:

You need to have XXX server architecture set-up in order to have 10,000,000 concurrent users online at anyone time. Things to this effect.

toniperic's avatar

As with lots of things in IT - it just depends.

If your app is terribly (un)optimized, as in it's doing lots of unnecessary database queries and having lots of HTTP requests, then you might come into situation where your app can't even serve 100 concurrent users regardless of how powerful the server is.

On the other side, if your app is well-designed (codewise) and is doing as little database queries as possible, having all Javascript and CSS merged into two separate files, thus having only 2 HTTP requests per page load, then you might serve hundrends or thousands of concurrent users with not-that-powerful server at all.

You should use profilers or some kind of application performance analytics tools and see what you can optimize in your whole app and server, depending on your traffic.

Hope I could help.

martinbean's avatar

@mstnorris The problem with “real-world” applications is, they all have their own requirements. A server set-up for one site serving a million of users per month may not work for another application serving the same number of visitors due to that site’s particular needs.

Your best bet is to keep posting on forums such as this and Stack Overflow with specific issues, and go with what works for your project, and team if you work as part of one.

mstnorris's avatar

@martinbean again, I appreciate the input but I (along with many others) understand all this. I know that there isn't a one-size fits all solution, but it would be good to have an idea of what to think about.

toniperic's avatar

@mstnorris think about writing as optimized code as you possibly can? Do as little queries to the database as possible? Serve as less HTTP requests as you can? Properly index the database? Leverage caching within your app so you don't have to execute some code/make a db query on every single request? Use opcode caching as well?

Just some of top off my head. It generally comes down to using debugging and profiler tools to see what you can do about your app, and then start from there. There isn't one recipe to rule them all (the apps).

mstnorris's avatar

@toniperic I know all of this, but it is good to see others are on the same page. I am talking more about the hardware requirements (servers, data storage etc) that will be needed for a very large app.

toniperic's avatar

Can you define a very large app?

If I just had a blog written in Laravel, I could still make it very inefficient if I were a sloppy programmer. Could make my app do hundreds or thousands of queries per each page request, which would mean my app couldn't even serve a couple of hundreds of concurrent users, especially on a cheap server.

On the other hand if I was a great programmer and I've optimized my app, it could serve thousands and thousands of users on most likely even a cheaper server.

It all comes down to checking where the bottleneck is, and what you can do about it.

I don't think you can just say you need a server with quad-core CPU and 16 GB of RAM for a large Laravel app.

PS: Perhaps I am still missing your question. It's late here and I should've been in bed by now.

jekinney's avatar

I loved the larabook series but, on purpose, Jeffrey wasn't consistent per say. Sometimes a command bus, sometimes not. As a teaching exercise it more then fit the bill.

I agree and would like to see the app at the planning stage to deploy. Even a simple subscription based blog with a good feature set. I emphasize planning stage as imo tutorials don't cover it and in reality many coders don't. We all know Jeffrey doesn't just sit down code some stuff whilly nilly but has some plan even if notes.

pixelpeter's avatar

@mstnorris I totally understand where you're coming from and what you want to achieve/learn

It's more of a software architectural thing and this is a topic always very specific to the app you'll be building and the given requirements and prerequisites.

You know it's up to you to decide if you want to use repositories when building a simple blog or if you want to use DDD style, CQRS, micro services (and so on). Its up to you to decide how to achieve the things needed for your app.

This was also a point that was hard to understand for me. I always thought there's a one fits all solution (totally ignoring tmtowtdi)

IMHO it will be difficult to find a setup/app to build which will cover all topics and will be fit into a manageable amount of time (although I would also like to see something like this) Even the small Larabook series lasts for 6 hours.

I can recommend you http://culttt.com/.

There's a series about building an app based on ddd principles and besides showing how to do it he also talks a lot about the why.

Maybe this will make a good community project/dev game where (maybe) you will be the product owner, defining what the app will be. In different discussion with all the great devs here you/we will work out the hows and whys. And you/then we will build it.

You'll see there are a lot of different opinions how to build things :-) Maybe we can have @JeffreyWay as the software architect and final decider telling us that approach (b) will be the better solution to realize feature (c), and so on.

And finally: If you build an test backed app you'll always have the possibility to improve it over time and implement a better solution or new things that you have learned.

I don't think the perfect app comes right out of the box. It matures over time

pmall's avatar

You need to have XXX server architecture set-up in order to have 10,000,000 concurrent users online at anyone time. Things to this effect.

Nobody can tell you this. This is the first time you launch a "large" app, you will have problems, no matter how many books/lessons you learn. Like everything you will have to try and fall. Keep things simple and see whats happen. And when you fall you can ask us :)

And don't over optimize prematurely. The problems you will have are probably not the ones you expect.

Please or to participate in this conversation.