I'm following the Heroku scala tutorial at https://devcenter.heroku.com/articles/scala
I was able to get everything working, but I have absolutely no idea where to go from here. I'd like to avoid using a framework (for now) if I can since the point of this is to learn scala and create a website with it. Their webwords example they list as a followup is completely different from the basic hello world example.
Mainly, I have no idea how heroku/scala/sbt know how to actually start the app and respond to requests since the samples are so different. I've looked at some frameworks and they seem pretty similar in that regard.
I'd really just like to know what the standard method for creating routes is (if there is such a thing). Any other tips about how to create a small MVC framework would also be of great help to me. A lot of the tutorials I see seem to make assumptions about what you already know (e.g. you would already know how to create routes and the like) but I can't find any tutorials that are even simpler.
Ultimately, the purpose of creating any web site, regardless of the technology used, is to offer some sort of content or functionality. You can't just say "I want to create a web site." any more than you could say "I want to build a building."
Once you have defined what the web site is supposed to do, then and only then is appropriate to consider how to implement it. The purpose of most frameworks to provide easy to use solutions to common and often difficult problems. For example, using a web application server like Jetty, Tomcat, or Glassfish trivializes most of the "route" issues. Any time that you save by using available tools can then be reinvested in creating better content.
On the other hand, if you really do want to implement an entire web server from scratch, the place to start is with the basic Hello app. In Hello.apply, you can start by looking at the HttpRequest (JBoss JavaDoc). getURI() will give you the request URL, and you can work out, from there, how to handle the different routes that you want to support.
Related
I have been making Web apps for a while now. Mostly frontends.
I have always wanted to make fully functioning websites, and therefore, my question.
The question might be dumb, so please bear with me...
I have realized that there are two ways I can develop web apps:
1. I initialize/work with stacks (MERN, LAMP). Everything inside one folder. The
backend throws the HTML code (as far as I understand).
-----or-----
2. I make a Frontend service (localhost:3000 for React (for example)) and I create
a RESTful API (with its own endpoint, say localhost/somethingBackend or
something like localhost:8000).
My question is:
Did I understand this right ? Is this how webdev works ?
And the more important one, WHEN TO USE WHAT ?
What is faster or better ?
Normally I'd google something like this, but there's either not much Information about this, or more probable, I'm searching the wrong thing.
Please help me clear my concepts.
Thank you for reading this long post :)
Both are correct approaches.
But the first one is a more traditional approach towards web app but it comes with the difficulty of writing sensible, reusable code in it compared to writing random-looking nonsense which happens to work, along with performance and reliability issues.
Writing code with a RESTful approach is what I personally prefer. The majority of frameworks use this approach. Maintaining code between teams is easy.
Modern backends like nodejs can also throw HTML as a response(see templating engines) but as I said option 2 is always preferred.
I know Scala. I've used mongoDB, redis, sbt, ... backend stuff.
I know basic HTML, CSS and JavaScript but have never done real web development.
I don't know what AJAX is. I don't really know any frontend stuff.
What should I learn before I start trying to tackle Lift?
If you know Scala, you are pretty much set on the programming side.
On the other hand, Lift requires HTML/CSS templates. In fact, it is completely separate from programming, so that a professional web designer can work on them, while the programmer works on the code. If you can revise your HTML/CSS stuff, it will help.
You don't need to know AJAX -- that part Lift takes care of for you.
So, it seems you are mostly set. I strongly recommend Timothy Perret's Lift in Action, from Manning. Though the book hasn't been released yet, you can get the Manning Early Access Program (MEAP) for it and, as it happens, the whole book has been written already.
If you already know Scala, learn some basics of web development and how Java handles it:
HTTP protocol
Servlets (also know what JSP is)
AJAX
I am facing a really tough time doing this. I haven't done much on web development before this. I know HTML and dats it. What else do I need to learn in order to start coding a good facebook app (specifically scripting languages like JS, PHP, MySQL etc). I have already created a test application using a web hosting site. Time is of the essence here.
I would pick up Head First Servlets and JSP or Head First PHP & MySQL. They will be your best friends in the process of writing PHP or JSP. Then of course you should learn what's in the Facebook API and how to use it.
You mentioned that time is off the essence, but I simply can't think of a reasonable way by which you can learn PHP or JSP without putting in the grunt work (which takes time). You should definitely do some reading unless you want to make an app that's hacker's paradise.
If you're already familiar with Java, then JSP will feel more natural and probably easier/faster to learn.
P.S. Sorry for the multiple edits... I felt like my wording was a bit off.
If you were going to start building web sites as a consulting business on the side -- keeping your day job -- and you also had a toddler and a wife, what frameworks/tools would you pick to save you typing?
Any language.
I'm looking for a productivity superstar stack that won't tie my hands too much when I have to update the site 6 months later, or "evolve" the data model once in production.
It needs to allow me to say "yes" to the client: community features, CMS, security, moderation, AJAX, ...
I would suggest Django. Super simple to get something up and running really quick. You are using Python which has a large library to go with it. For me Ruby on Rails would be a close second.
I'd probably look at DotNetNuke. Its easy to set up (a lot of hosts will do it for you) and easy to use and put together a custom site that business's will be able to maintain in the future.
Its fairly easy to create custom modules that are specific to a business and hundreds of modules for sale (or free) that can be integrated into DNN for special uses.
Take a look at Microsoft's Sharepoint server if you'd like a pre-made framework with many options for plugging in your own code. Sharepoint is kind of a world unto itself but it is a very powerful environment.
Update: I'm surprised to have been voted down on this one. Keep in mind that the questioner specifically requested frameworks that included a CMS. Sharepoint meets this criteria - unlike straight .NET or other web development frameworks.
If you are going to vote the entry down, I think you owe it to the person who asked the question to explain why you don't think he should not even explore it as an option. You could be right - collective wisdom is what voting on SO is all about. But without an explanation, we don't know why you think you are right.
My answers are going to revolve around the .NET stack.
Use Master pages and CSS templates. This makes it so much easier to pop in a new look and feel for your customer.
For sure I'd include the Dynamic Data framework in the .NET world.
Hosting might become an issue for your customer. Questions around managing email addresses, procedures on how to quickly update the website to include the new contact phone number (different for each customer, I'd assume) Consider getting a reseller account on your favorite webhost, and dole out webhosting accounts as appropriate. There are lots of issues around this point. It may turn out to be a nice source of recurring revenue.
Build yourself a few patterns including a database wrapper which would handle all your data calls (i.e. a dll which wraps all your data calls, sets up your ADO.NET objects, runs your sproc calls, and picks up the connstring from app.config or something similar.)
This goes a long way to maintainability as well.
I would recomend going with anything MVC in a language you can undertand! Theres a couple of CMS's in python, php and ruby using that design and well... that allows you to be ready for combat for Ajax and expanding anything very fast.
This is definitely not a question that can be answered.
I prefer asp.net webforms because I think it allows for extremely rapid web app development, but I am sure you will receive recommendations for:
asp.net mvc
Ruby on Rails
PHP and some framework
Python and some framework such as Django
I believe PHP has the most pre-built apps that you can use, though asp.net also has the things you are looking for.
All of these platforms and frameworks can do what you want.
Choose between Rails and Django. They both have different strengths. I like Rails better in general, but Django's admin interface can save you a lot of time when you need it.
There's another factor to take into consideration here: what are you the most familiar with? I believe that some studies have found upwards of a 30% loss of productivity when trying to learn a new language/framework.
Sometimes, there's nothing wrong with just sticking to what you know. But if you're interested in what languages/frameworks to learn, I'll refer you to the other posts because the above was the only thing I really have to add.
I recommend looking into Grails. It uses Groovy which is similiar to Java (so if you know this already you're good to go). Groovy runs on the JVM so you can still use all the great libraries already available for Java. Yet, since it's a dynamic language with a lot of the similar bells and whistles like Ruby you can use closures and that kind of neat stuff when you need/want to. And you're not slowed down by Java's traditonal slow compile-deploy-test development cycle.
Grails is already setup with Hibernate and Spring. You can create CRUD application in practically no-time (pretty much like Rails applications), and at the same time drill down and be able to control every little details since it's built on such proven and well-supported technologies. In addition there's literally hundreds of plugins available that helps you easily set up things like mailing lists, security, AJAX components and so on.
Otherwise, if you want to set up a community site and don't want to code a single line you could always check out ning.com.
I need to create a internal website and can't figure out if we should be writing our own, or using an existing framework.
Most of the website will essentially be a front end to a database. We need to have a number of people enter data into forms. We then want to be able to show different views of all this data -- including running small queries (e.g. how many resources do we have with attribute 'X'). As is usually the case with this, we will want to tweak the UI on a regular basis.
There actual data design is not a simple 1:1 mapping of resource to entry. For example, we might track several attributes for one item as the "base set of data" for that item. Then we could have several additional sets of data.
Imagine a recipe application. You might have a recipse for a starter. This could then be referenced by several other recipes that need that same information.
I feel like this is best suited for a general framework (Ruby on Rails, Django, etc), but I wonder if it might not be good for a "traditional" CMS platform like Drupal? I specifically mention Drupal since the people that would develop this have the most knowledge using php and MySql.
I usually lean towards wanting to use an existing platform, but am interested in other people's thoughts. To give you an idea of scope, I would imagine if we wrote this from scratch we are probably talking about 3-5 weeks of development.
Would you recommend writing our own, or using an existing framework? If you would suggest using something that exists what would you recommend?
Would you consider this to be best suited for a straight framework or a straight CMS?
Thanks!
It's possible that Drupal will be a good solution for you, though you'll probably need a few key additional modules like the "Content Creation Kit" (CCK) and "Views".
Unlike other web CMS systems (WordPress, Exponent, phpNuke), Drupal treats your entries as a "pool" of content, from which you pull various subsets for different areas of your site.
There is a lot of documentation for Drupal (almost too much), the biggest problem is finding the piece that's relevant to what you're trying to achieve. Diving on to one of the interactive IRC channels can be a good idea, as the community is quite helpful and is almost always willing to give you a pointer in the right direction.
The power, flexiblity and capability of Drupal is both its biggest strength and weakness - I know it took me a bit of effort to get my head around key concepts, and I'm far from being a Drupal Expert.
One last comment: Having written my own CMS from scratch, which I abandoned in favour of Drupal, I'd suggest your 3-5 week estimate is likely on the light side.
Stay away from Drupal for any site that requires customized functionality. I recently used Drupal for a website at work, and it was VERY difficult to figure out how to get it to do what I wanted it to do. There is a lot of documentation out there, but all of it is unhelpful -- it answers very specific questions about specific issues but does not provide any context as to how you would approach building the site as a whole. If you're a programmer, using a more general framework will probably work better, as CMS's are designed for a specific kind of site, and if you want your site to have non-standard functionality you are going to be fighting the system instead of working with it. If your developers are most experienced in PHP, try one of the PHP frameworks that mimics the architecture of Rails -- e.g. cakePHP or CodeIgniter.
CMSes usually make sense when you have a broad and potentially expanding array of different content types and modes you need to handle. Drupal has literally dozens. Given than you mentioned RoR, it sounds like what you need is more of a MVC style framework. Maybe similar to the sort of thing stackoverflow was built with. .NET an issue for you?
If you are really limited to 3-5 weeks, however, I think a Rails-based strategy makes sense so go with RoR or CodeIgniter
If Drupal can do what you need easily I would say go with Drupal. I don't know much about Drupal though.
Otherwise, what you describe sounds like a data driven web app or more like a reporting app. It sounds like you might have some very specific needs or that users might want very specific needs in the future. That is something hard to get from premade software since you have no idea what users are going to request. Since I'm a programmer I would probably want to build it myself.
Funny you should ask... I just came across this in SD Time's Linkpalooza this afternoon:
Ten free powerful content management systems…
There are at least 4 more mentioned in the comments to this post.
It seems to make little sense to develop a new one with so many from which to choose!
BTW, this is neither a recommendation nor endorsement of any particular CMS.
Treat Drupal as a framework. Core modules + CCK + Views is a good start to build on.
If you're doing something that you might want to expose to other applications, consider the Services module. A lot of interesting things have been done with flex frontends connected to drupal running services with amfphp.