Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8201719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:54:38+00:00 2026-06-07T06:54:38+00:00

In a MVC architecture the model is used to store data used in the

  • 0

In a MVC architecture the model is used to store data used in the application. I create a class and use some static properties to store data so that it can be used throughout the application. For example if there is a datagrid, I use a static arraycollection in model class. Update it whenever a service is called and by using databinding update the dataprovider of the datagrid. I have read that singleton class can also be used to accomplish this task. Is the way I use for model class is better or there exists some other ways too?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T06:54:39+00:00Added an answer on June 7, 2026 at 6:54 am

    As the discussion Tianshen referred to points out, there is hardly any difference between a bunch of static variables and a Singleton. Both can be seen as a form of global variables, with all the accompanying downsides. I’m not going to argue about how Singletons are evil here; plenty has been written about the subject already that you can easily find on the web.

    However, I would like to present an alternative: Inversion of Control (IoC), also referred to as Dependency Injection (DI). I’ll explain this pattern in short, but you can also find plenty of information for yourself. Take the ArrayCollection from your example; if you’d want to avoid the static variables or the Singleton pattern, you would have to create one instance and pass that instance around from object to object throughout your application and perhaps it would even have to be passed through an object that doesn’t really need it, which wouldn’t be very clean either.
    In comes the IoC container (for a Flex app it would take the form of library you add to your project): with such a library, you can create/configure that ArrayCollection in one place and let the IoC “inject” that single instance in whatever class that needs it.

    A concrete example: we might have a configuration file like this

    <fx:Object>
        <s:ArrayCollection id="myLetters">
            <fx:String>A</String>
            <fx:String>B</String>
        </s:ArrayCollection>
    </fx:Object>
    

    and a class like this

    public class MyClass {
    
        [Inject(id="myLetters")]
        public var letters:IList;
    
    }
    

    The IoC container would then inject the myLetters ArrayCollection instance whenever a MyClass would be instantiated. There are a lot of other injection techniques, but this example is just to give you an idea.

    At the time of this writing I belive Parsley to be the most widely used IoC container for Flex.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

in asp.net MVC architecture, can i write AuthorizeAttribute on the method of model class?
I am new to ASP.net MVC architecture. I have read in some articles that
I have a PHP application that is built around the MVC architecture without any
What architecture and patterns can I use to share the most model and logic
We use an MVC architecture with a model consisting of a BLL and DAL.
I'm writing a quite complex JavaScript application that has an MVC architecture that I'm
Wondering the pros and cons for MVC architecture in terms of web application development?
I've searched around and found that when implementing an authentication module in MVC architecture
Just some architectural question: I use ASP.net MVC and exclusively rely on Strongly-Typed Views
In Ruby on Rails, MVC architecture is designed in such a way that, the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.