From Design to Development: Is there a common EmberJS workflow? - ember.js

This question is subjective by nature, but I am curious about a specific thing, so hopefully there is a decent answer.
I tend to be a little old fashioned and like to create all my pages static and get the design just the way I like it (or at least very close) before I start breaking it down into handlebars and components and templates. This is mostly because the Ember "Getting Started" Guide taught me that process.
Is this the common practice, generally?
I am the front-end Designer and Developer for my company, and basically I have two separate workflows, one for Design, and one for Development/Testing.
Is there a way to merge the two and get a single streamlined workflow (perhaps a JS task that can split up static pages into templates by using some special markup??)
Design tends to be a little easier when you are working with static pages.
Development (especially when using EAK or Ember-CLI) expects everything to be modular and dynamic.
Is there any clear answer to this question?
I posted a similar question on Ember Forums, but have not gotten many view, so I figured I would try here.

Short answer when you're building an app with Ember you want to build around the URL structure, due to the way the URL and Router interact. Here's an awesome talk by Tom Dale about the URL. This makes it a very outside in approach, since each layer deeper in the url is content that's generally embedded 1 level deeper in the page.
http://vimeo.com/68390483

Related

EmberJS Maintainability

I'm making an essay about AngularJS vs EmberJS. In here I compare these two with different questions and at the end a decision is made for which one is better for developing web applications based on the answers of these questions.
One question that I have struggled with for EmberJS is about maintainability. I haven't been able to find one article that gives information about this, unlike AngularJS.
I would like to know how does EmberJS helps you maintain your EmberJS web application. What concepts or whatever, does it provide to help you achieve a high level of maintainability for your web applications build with EmberJS.
Thank you for any help regarding answering this question.
How does Ember help you maintain your application?
Some of this is subjective/debatable, but in the spirit of essays, here are some points for Ember in terms of maintainability:
Because Ember is so highly opinionated, it makes it really easy for other Ember developers to understand your project quickly and pick up where you left off. While the framework has a pretty infamous learning curve, once you're comfortable with Ember, most applications share a lot of similarities. Ember has a prescribed 'way' for doing most things -- from file structure to REST api interaction. If you've worked on one Ember project, moving in to do maintenance on another should feel very familiar. It's a big, standardized toolbox.
The Ember Inspector browser plugin gives you a lot of transparency into what's going on beneath the hood of your application. It's very helpful to debug and maintain Ember apps. I haven't really seen anything yet that's quite the same for other frameworks. (https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi?hl=en)
Ember's handlebars templates don't allow you to put complex logic in your template. Any "if" check in a template must refer to a boolean value. This means less places to look to track down what you need to work on, and more testing of raw functions because your view isn't handling more than basic logic. It also encourages more readable templates.
Ember comes with built-in tooling for unit tests, integration tests, and end-to-end tests. This encourages devs to build tests for their applications or contribute to the existing tests of a project. Tests are good for maintainability.
Good luck!

Router Basics in 1.0.0-Pre.4 - what is the right way to write a router in current release?

I hate to ask such a newbie and vague question, but I imagine there must be others out there whose brains are also about to explode. I see related questions, but none that directly addresses my confusion.
I've just been introduced to Ember.js and I'm trying to learn the basics of the Router, but I can't find two sources that agree on how this is done. I suspect that I'm jumping in during an unstable transition. I'm using the latest 1.0.0-Pre.4 release.
The best I can figure, Router is the new mechanism, and possibly replaces StateManager - yes? Yet the classes listed under 1.0.0-Pre.4 API on the web site don't even list a Router object, nor does the guide make mention of it... yet, I get no complaints from javascript when I use sample code that extends Em.Router.
Ok cool, however it then barfs on the Router member "transitionTo" which is present in many of the demo projects, but is unrecognized in the current release.
So, I guess what I'm asking is not so much a direct question, as I am looking for a grounding point in a sea of contradictory information.
If starting out with Ember.js as it is RIGHT NOW (1.0.0-pre.4), with no history to contend with, what routing mechanism should I be looking at, and is there any tutorial or simple sample app that demonstrates and runs against this version of the library? Can you confirm my suspicion that the documentation is out-of-date in regard to routing?
Ember.js is a lot to learn, and if I ever hope to figure it out, I need to know what to ignore and what to embrace.
Thank you.
The best I can figure, Router is the new mechanism, and possibly replaces StateManager - yes?
Yes, Router is the new mechanism. It does not replace StateManager per-se. Early version of the Ember Router were based on StateManager. The new one (1.0.0-pre.4) is not, but StateManager is still an important part of the ember library. Many of ember's core components (models, views) rely are built on StateManager.
Yet the classes listed under 1.0.0-Pre.4 API on the web site don't even list a Router object, nor does the guide make mention of it... yet, I get no complaints from javascript when I use sample code that extends Em.Router.
The Router does not have API docs yet. I imagine these are in the works. When in doubt about a fast-moving open source project I always have a look at the tests. Ember has a really solid test suite, and in the case of routing you can learn a lot by reading through the integration tests here: routing/basic_test.js
Ok cool, however it then barfs on the Router member "transitionTo" which is present in many of the demo projects, but is unrecognized in the current release.
Sounds like those demo projects are out of date.
Can you confirm my suspicion that the documentation is out-of-date in regard to routing?
Re: the official docs I think both the API and Guides can be considered current, but be aware that not every ember feature has API docs so far. For sure there are many out-of-date sources floating around. Trek has been working to compile a list of out-of-date sources so that we can reach out to authors for a refresh. Here on Stack Overflow, anything related to the old router should now be tagged https://stackoverflow.com/questions/tagged/ember-old-router.
If starting out with Ember.js as it is RIGHT NOW (1.0.0-pre.4), with no history to contend with, what routing mechanism should I be looking at, and is there any tutorial or simple sample app that demonstrates and runs against this version of the library?
The ember team has been putting a lot of effort over the past few months into the Ember.js Guides - AFAIK they are all up to date WRT (1.0.0-pre.4) and are becoming more solid every day. They include a lot of detail about the new Router - see Ember.js - Routing for the most up-to-date information.
As for tutorials, there are several new ones that are worth a look. Check out this SO post for a few recommendations: Could someone point me to an ember.js project that uses the latest routing system? Bonus points if it uses ember-data as well
tip: build your own version of ember from master branch - they fixed few bugs :)

Integrating django apps in your own views

Let's say I'm writing a complex site in django with wikis, forums, ... or writing my own apps that I intend to reuse from different sites.
I really want to create, for example, a wiki page that has a forum at the bottom, or reuse my previously written wiki app with a different graphical layout.
What is the best way to structure my app to allow this kind of reuse?
So far, I have been giving apps their own urls in urls.py. This however does not work if I want to combine multiple apps together in a single page.
Additionally, most of the apps I found online come with their own templates, which has the full html, and do not separate the logic of creating / preparing a context from that of handling a request and generating a reply.
What is the best practice here? What do you do? edit the templates that come from applications you download online? refactor them to fit in your application?
what should I do for my own applications? structure them so they have a method to get the context, and a method to render it?
Django hasn't great support out of the box to component-oriented architectures. I find this problematic some times too. You'll face to problems here.
Architecture
Code
Architecture: As Django is not component oriented, all the apps aren't component oriented neither. The designers and coders for those apps haven't thought about that. So they've just built "views" to interface with their apps. You'll need to get something more "pluggable".
Code: Once you decide to build that, you'll have to find what support you have for that. Most Django apps are pretty well coded, so you won't have much code in views, but abstracted in other places. That way you could reuse that code and build your own components.
Example: Suppose you're working with a third-party Wiki app. That wiki has a view to display highest ranked Tags and other view to create a wiki entry. If the code is good enough (that I'm assuming it is because Django has a pretty good community), you could refactor that to use components. The view to create an entry must be using some Form, that you can plug in your own site. And the view to get highest ranked tags probably uses some utility function, or some Tag manager's method. In that case you could refactor it to your own needs.
Hope it helps.

CMS+blog+e-commerce: django or web2py [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 6 years ago.
Improve this question
At the moment we are running few smaller PHP sites (small company, private, non-profit org, friends...) and would like to migrate them to Python in order to be able to tweak them more easily and/or extend their functionality due to being familiar with Python although without real experience using some of the Python frameworks.
In order not to write everything from the scratch, we'd need decent CMS, blog and some e-commerce module.
We did some research, installed and tried few apps in Django world and so far have arrived to the two possibilities:
Django-CMS as CMS, Zinnia as blog engine and Django shop as e-commerce or
Mezzanine which integrates CMS+blog and Cartridge as shopping cart application.
Both combinations are nice, although not perfect...At the moment there is problem integrating released versions of django-cms & zinnia due to their usage of non-compatible versions of django-mptt or e.g. Mezzanine is missing some features like linkback support in blog etc.
While playing with the above two sets of apps, we heard about Web2py and must say that we like lot of things there...
We are aware it's younger project with smaller community, less apps etc., but wonder if there is some set of web2py applications which can compare with the two above-mentioned Django sets so that we can choose to start with Web2py, learn it and in that process replace PHP sites with it?
So, we would like to have some capable CMS+blog with the following features:
tag cloud, categories
spam protection
RSS feeds
multiple authors
threaded comments (optional)
linkback (pingback/trackback) support
(easily) theme-able
markdown/reST markup for writing content/posting
multi-lingual support
As far as e-commerce is concerned, besides easy integration with CMS+blog apps we do not need anything spectacular - our 'company' is selling 'services', so no need for thousands of products (only 10s of them), no complicated shipping options so something like:
multi-lingual support
basic infrastructure for payment methods (e.g.) PayPal and we would need to write a custom module for form-based API
simple shopping cart able to handle simple product descriptions
tax calculations and
(optional) PDF support
would be everything what we would need.
Considering the features we would like to have, our (non)experience working with any framework, which one - Django or Web2py - you consider is more suitable in terms of ease of learning, ease of use, application support etc. ?
I've sent two posts to web2py list and (maybe) because my query was not specific-enough (or some other reason) I did not receive any reply there and I saw there are some apps like KPAX CMS which looks old/non-maintained. Otoh, there is Powerpack which incorporates Instant Press but I'm not sure about availability of e-commerce component. Finally, I've found out about plugin_wiki which seems to be new/young app, but, considering we found* out about possibilities in Django-world, we would like to learn about the situation on the Web2py scene in order to be able to evaluate both options better.
p.s. it would be nice if Appliances list would be organized a bit better so that it's easy to find out what is maintained, where is project page etc.
I've had a lot of success with Django-CMS. It's very, very easy to write custom content-type plugins, extend menu nodes with custom nav elements, such as a list of product categories, etc. It's dead-simple to hook custom application code to any page in the navigation hierarchy.
As you mentioned in your question, Zinnia also plugs into Django-CMS for a nice blogging solution that is also extensible. Adding a cart app, whether it's from the DIVIO team or not should be an easy task.
Django, DjangoCMS and Python in general, have very low learning curves in my opinion. In 14 years of development, Django is the only web framework that hasn't gotten in my way, and Python is an absolute pleasure to work with on a daily basis.
I think you'll find that the Django ecosystem is much more holistic than any of the other Python frameworks, it's also very, very well documented and there are literally hundreds of 3rd party apps. Plus, Django admin can potentially save you many weeks of dev time, and you can override, skin and extend it to do just about anything.
My $0.02 :)
-- EDIT --+
Yeah, right after I posted I realized I was heavy on comparison of frameworks but light on suggested solutions to your problem (i.e. existing appliances). I think that Django probably has more matured addins/apps. That being said, crafting your own blog in web2py (a simple blog) is probably only a little harder than configuring one for another framework.
There is the wordpressclone appliance: http://web2py.com/appliances/default/show/36
(you can extract existing wordpress data and get it in here, i'm pretty sure there's a WP export and an import function on this appliance)
There is an e-store (haven't used it): http://web2py.com/appliances/default/show/24
There is KPax CMS, as you said, but i think this one might be out of date, unless it was updated recently. The integration between these should be possible, you can share sessions across apps and I think if you have the same auth_user db, it should work.
I would try installing these and see if they are close to meeting your needs -- especially KPax since I'm not sure the state it's in.
-- END EDIT --
Both Django and Web2py are very good frameworks in my opinion. I think you would be happy with either. That being said, having not used frameworks I would say to with web2py, unless you NEED certain modules that only exist in the django world. Web2py probably has a little more gradual learning curve. Also, it can do RSS out of the box, there's a screencast somewhere showing how to create a blog app in about 5 minutes (including comments), and the community is (usually) very responsive. I don't think there is anything that web2py can do that django can't (except DB migrations -- but i think you can make django do them with some 3rd party code), or vice versa.
Django favors a "explicit is better than implicit" development methodology, which requires to you import various modules and doesn't have all the "magic" of web2py. Using django, you will be more aware of exactly what is going on under the hood. The django templating language is easy to learn and provides a lot of functionality for common markup tasks. Their is a LOT of documentation, a larger user-base and tons of 3rd party modules/plugins/whatever.
Web2py favors a "everything should have a default" approach, and enables to to focus on the big picture without getting bogged down by the minutia of web development. I'm not saying this is in contrast to django, but rather that web2py is very strong on this point. It allows you to rapidly develop applications, and takes the headache out of things like updating a table schema (i.e. it does database migrations). I also prefer web2py's templating language to django's, as it allows pure python and does not require one to learn a separate templating language at all.
I think both frameworks have decent internationalization/localization features. I'm not sure if Django's is still under development or not? Web2py's is easy to use, but I think you might have to provide a lot of the translations yourself.
As for the lack of replies on the web2py list, maybe it's because this topic is becoming more and more frequent? I'm not sure. You could ask people on the web2py freenode channel.
Also, definitely check out this link:
Django vs web2py for a beginner developer
The first response is from the lead developer of web2py, but I think he makes a fairly balanced comparison.
Also, the previous thread includes a link to here (the good and bad of web2py):
http://www.mengu.net/post/django-vs-web2py
web2py is a great framework, but currently light on reusable CMS, blog, and particularly e-commerce applications. It sounds like you have already stumbled upon the main options -- plugin_wiki, Powerpack, and Instant Press.
I don't think there is a mature and currently maintained e-commerce application, but you may be able to make use of web2py-estore. There are also some options for accepting credit card payments (see also).
plugin_wiki includes comment functionality, and there is also plugin_comments. For PDFs, pyfpdf comes with web2py, and there is also web2py_appreport. web2py also includes RSS support.
EDIT: Also, another web2py CMS under development, to be released soon: SimplrCMS

using a static website generator for a blog on a dynamic website?

I'm looking into having a blog/content section on my dynamic website. Is it sensible to use a static website generator like Hyde to generate the "static content part" of the website?
Advantages would be:
easy/simple for a few other people to submit articles
performance
using a similar stack as the rest of the website - in my case, using Hyde and the same syntax as django templates
I would use the flatpages app for this. With the flatpages app you can still put your content (blog posts) directly on the HTML but you'll have the advantage of templating (using you base site template or just a custom one for the blog). You'll also be able to keep track of how many pages there are on the admin panels. You can also "outsource" comments to something like Disqus and maintain a dinamyc feel.
Still I would really think about the reason why you're doing this. Getting a blog post from a db isn't a very performance shattering operation unless your server is overly strained as it is.
You'd be far from the first person to do this. It still very much feels to me like Ruby's Jekyll (of which Hyde is a Python 'port' of sorts) is a bit more ahead in this regard, but I also come from a Python / Django background and can understand the desire for some homogeneity.
Most examples I can think of are done with people using Jekyll, but this blog post covers one person's move from WordPress to Hyde that they seem quite happy with, and there's also this Hyde blog, both of which potentially have some useful advice for you. Disqus seems like the comment platform of choice, and you integrate it simply by embedding some JavaScript in your site, hence it's a beautiful solution for a static site.
Realistically I can't see "performance" as a major issue; I may be doing you an injustice here, but it generally seems like those with enough blog traffic to cause performance issues are in the state where they've got the cash to lob a caching layer / extra servers at it. For me, the advantage has been in the flexibility of hosting (pretty much anyone will host static HTML for you for very little) and 'security' (the only thing executing server-side will be the webserver).