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 6540539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:59:25+00:00 2026-05-25T10:59:25+00:00

I’m writing an Android application, a dictionary just for fun. I’ve decided to use

  • 0

I’m writing an Android application, a dictionary just for fun. I’ve decided to use MVC as architectural pattern. I need to do many queries because I want to create an istant searching like Google does: Every time the user add a letter to the EditText I want do query the database.
I’m wondering what is the best solution if opening the database every time or keeping it always open. The former could be better because the database is open only when is strictly necessary, the latter should be more performant.
There is another way. Because I’m using MVC is the view that will query the database. So I can create in the Model part a public method to open the database when necessary and close it when the user has found the word. But could this be a good solution? Two of the most important function of the database (open and close) will be exposed at the view part. This doesn’t sound much correct: it hasn’t got any information hiding.

What do you think about this logical and perfomant problem?

  • 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-05-25T10:59:25+00:00Added an answer on May 25, 2026 at 10:59 am

    If we’re talking purely on the theoretical pattern design, the truth is that the Model probably shouldn’t even expose the fact that it’s getting it’s data from a database. You can easily keep track internally in the model of whether the database is open or not and open it when necessary.

    On the performance aspect of the question, when it comes to questions like this, the only way to get a good answer is to measure. It could be that keeping the database open won’t have any ill effects and you won’t have any problems just keeping it open. That will be the easiest and fastest solution more than likely. However, it could be that keeping it open might take up too much memory, or keep the CPU busy, or some other side effect.

    As I mentioned, the only way to really have a definitive answer is to measure. You can use DDMS, amongst other profiling tools.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;
I need a function that will clean a strings' special characters. I do NOT
I am writing an app with both english and french support. The app requests

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.