Don't use IoC if you don't need it, but I'll explain why we need it in our case: some customers require different implementations.
That's where the DI part comes from -- to enable us to load a different dependency based on the customer. Now, you could provide a different bootstrapper class per customer or start building a mega class with a lot of ifs-and-buts(elses), or you specify this kind of stuff in a configuration file.
We opt for configuration files. We opt for IDEs that can interpret Spring configuration files which means typos or incorrect dependencies do show up. This allows us to swap out implementations in case shit goes down without having to recompile, connect over a VPN to a remote desktop and hop through a few more hoops to get our class file on the other side. If you're not running your own apps on infrastructure you control (we should be so lucky), you have to take this sort of stuff into account. I'd love to be able to say "This is how stuff's set up. Deal with it."
(And when shit goes down, it is usually not at the place you were expecting it to happen, which means all kinds of configuration options for your bootstrapper would probably still fall short.)
I agree with using IoC for different implementations, but I'm puzzled by those who want to use it everywhere, because it supposedly makes the code easier to test.
Guice is a nice IoC framework, but look at what they say on their website:
Testing is kind of a side effect. When you design your code with IoC in mind, you naturally will create more logical separations and avoid tight coupling -- which in turn will make your code easier to test. (Source: I wrote Ninject. :)
If your code has a hard-static dependencies to web-service call, you can't test it easily (and repeatedly). Especially when the actual service is down.
If your code has a hard-static dependencies to DB call, you now have excuses not to write test against it because "it's hard to prepare the environment to do such things."
Not all projects are as small as a Todo-List written using Rails.
Medium-to-Large size projects with large DB schemas exist in which it will take hours to run your Rails tests: "testing-my-active-record-models-as-unit-tests"
Exactly, you should really think about when and if you need IoC, just like with any other technique. It can be really useful. Unfortunately, if misused, it can lead to an absolute nightmare.
The problem is that when people learn about new techniques then they end up wanting to use those techniques in their next project. It reminds me of something a doctor said to me once, "Every time a new disease is identified there's an epidemic." Meaning that when doctors have something they can now identify as the new disease they are much more likely to do so since they've just heard about it, when before they would have identified it as "flu".
Then updates to the customer's configuration requires modifying code, compiling it, and shipping the result. It's easy to put an interface on configuration file modification and in many cases, updates can be applied without needing to restart a running system.
That's the problem with soft-coding, you trick yourself into believing that modifying a configuration file is not modifying code, but it is. It's code that isn't compiled, isn't regression tested.
As far as re-shipping, nearly every language nowadays has a method for automatic updates. Here is what Chrome uses: https://code.google.com/p/omaha/
But it's modifying code that your support team is allowed to modify in the field. By contrast, depending on the business policies in place any code that has to go through a compiler might also have to go through meetings, reviews, QA testing, a release cycle, IT department scheduling, acceptance testing, blah blah blah.
By this logic, every user is "programming" when they change their facebook account settings or configure the appearance of their desktop. Call it what you want, but configuration via "config files" of some sort (perhaps managed by a GUI) is a totally different beast from modifying 'main'.
There really isn't much difference between using a bootstrapper class or a spring xml file, they're still both configuration files and should be equally convenient to maintain.
One of the advantages spring gives you in your scenario is multiple options for configuring your app. So in your case you can use annotations for parts of the app that don't change and then specify the parts that are different for each customer using xml(I seem to recall you might even be able to wire up a spring container using vanilla java).
Spring actually brings a lot more to the table, properly qualifying it as an IOC container. It offers mechanisms for applying cross-cutting aspects such as transaction and security management.
Off-topic, but a heads up to the Mixpanel team: your announcement email sucked. A single big image containing all text? Come on. You guys can do better than that.
Hi Ian,
Welcome to Storylane, a place for great inspirational life stories. So that we can help you get started, here are some of things you can do on Storylane:
Share stories
Everyone has amazing life stories to tell, and so do you! Sometimes the only thing you need to get started is a good suggestion for some inspiration. Start sharing stories »
Ask anyone to tell a great story
Whether it's your friend or someone you look up to, everyone has amazing life stories. Storylane makes it easy for you to ask people to tell their stories. Find people and ask them for stories!
Save the ones you love
Storylane is full of great stories, and it's easy to discover those close to your heart. Show your love for great stories, save them for later and then get back to them in times of need. Find stories to love!
-----
Once you're logged in, it looks sort of like a Kickstarter full of... blog entries. Some could be considered actual essays while others have pretty much posted lists, extended anecdotes, there's an iPhone 5 review, etc... The main feature I guess is that you can cycle through prompts from an array of categories to give you something to write about. Of course in the early stages they're pretty hit or miss, but I imagine there is potential if users ended up carving out their own niches– you might start to see more things like "How did you start programming? What do you think were the most important things that helped you grow?". Of course they're just prompts, and you should be able to write about anything you want.
Weird that most of the users who i browsed through, seem to not be actual users and are just syndicated from existing blogs. (with the owners permission ?!)
Seriously? Nine out of ten companies will turn "make it suck less" into "make it even better". Apple dropped the ball, Apple does some very questionable things, but please stop this idiotic bashing, whether it's targeting Apple, Microsoft, Google or even RIM. Just stop it.
What's confusing you? (I'm trying to help, not being snarky)
If you want to invoke some Django-based logic at regular intervals without having to install Celery (and monitoring and a decent queue) you'll opt for a management command. The link you posted should help you out here. Invoking the script yourself or telling cron to invoke it for you shouldn't be hard if you know about cron.
With regards to Celery: I think the tutorial and docs are pretty clear on how to use it and how to set it up.
Thanks for your comment =) Nothing is confusing me there, but try to search for "django script cron" and you'll see people suggesting setting up urls to start the script, having an external script that import settings and many other complex things. The craziest thing I've seen (but probably useful for some cases) is to have the regular requests from google-bots invoke scripts... That's why I think it's a good thing to suggest managment commands when they're so easy and integrates nicely with your apps. Celery however is good for more complex usecases. I was merely making a suggestion for best-practise.
I imagine most of those icky suggestions are coming from people who used to run php on hosts with a lot of restrictions. You're right, this should definitely be a part of a best practices guide.
The site is still raw but I decided to put it up to get feedback. It's a file marketplace mixed with a referral system. I think people should be rewarded for sharing.
The reason you have to start looking in settings.py and urls.py is because you used "django-admin.py startproject". Why would you do that? Probably because it provides a nice and common layout with some sensible default configuration.
No, I don't recommend you to do that. Use Flask, Bottle or any other lightweight framework/library you want to use. Just don't get hung up on how the Django docs suggests you structure your project. It's all still Python.
That's where the DI part comes from -- to enable us to load a different dependency based on the customer. Now, you could provide a different bootstrapper class per customer or start building a mega class with a lot of ifs-and-buts(elses), or you specify this kind of stuff in a configuration file.
We opt for configuration files. We opt for IDEs that can interpret Spring configuration files which means typos or incorrect dependencies do show up. This allows us to swap out implementations in case shit goes down without having to recompile, connect over a VPN to a remote desktop and hop through a few more hoops to get our class file on the other side. If you're not running your own apps on infrastructure you control (we should be so lucky), you have to take this sort of stuff into account. I'd love to be able to say "This is how stuff's set up. Deal with it."
(And when shit goes down, it is usually not at the place you were expecting it to happen, which means all kinds of configuration options for your bootstrapper would probably still fall short.)