Storing Data. A Note About Creating Games Why do you want to store data? 1.Data files 2.Configuration files.

Slides:



Advertisements
Similar presentations
Week 7: Input and Output 1.  Now we are going to talk a little bit about output  You have a lot of experience with System.out.println() and System.out.print()
Advertisements

Contest format 5 hours, around 8-12 problems One computer running (likely)Linux, plus printer 3 people on one machine No cell phones, calculators, USB.
Chapter 3.2 C++, Java, and Scripting Languages. 2 C++ C used to be the most popular language for games Today, C++ is the language of choice for game development.
Introduction to a Programming Environment
Chapter 1: Introduction
How to build your own computer And why it will save you time and money.
Database Management Systems (DBMS)
Session-01. Hibernate Framework ? Why we use Hibernate ?
Generics, Proxy, and The Compile Time Type Checking Debate You are either with us or against us. Please snarf the code for today’s class.
Software development. Chapter 5 – Data management.
Struts 2.0 an Overview ( )
Object Oriented Databases by Adam Stevenson. Object Databases Became commercially popular in mid 1990’s Became commercially popular in mid 1990’s You.
1 Spidering the Web in Python CSC 161: The Art of Programming Prof. Henry Kautz 11/23/2009.
Week 14 - Monday.  What did we talk about last time?  Image manipulation  Inheritance.
Groovy WHAT IS IT? HOW DOES IT WORK? IS IT USEFUL?
How a little code can help with support.. Chris Barba – Developer at Cimarex Energy Blog:
Basics of Web Databases With the advent of Web database technology, Web pages are no longer static, but dynamic with connection to a back-end database.
Computers in the real world Objectives Understand what is meant by memory Difference between RAM and ROM Look at how memory affects the performance of.
Overview Trackaparcel booking system is very easy to use which sends up to minute information directly to the logistic company whilst building the manifest.
 Nate Locklin ◦ Database Analyst, PPG Industries ◦  Steve Tirone ◦ Data Warehouse Analyst, Amerinet ◦
COLD FUSION Deepak Sethi. What is it…. Cold fusion is a complete web application server mainly used for developing e-business applications. It allows.
/425 Declarative Methods - J. Eisner /425 Declarative Methods Prof. Jason Eisner MWF 3-4pm (sometimes 3-4:15)
1 Lecture 19 Configuration Management Software Engineering.
1 In the good old days... Years ago… the WWW was made up of (mostly) static documents. –Each URL corresponded to a single file stored on some hard disk.
Chapter 2: Operating-System Structures. 2.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 2: Operating-System Structures Operating.
Design and Programming Chapter 7 Applied Software Project Management, Stellman & Greene See also:
Chapter 34 Java Technology for Active Web Documents methods used to provide continuous Web updates to browser – Server push – Active documents.
Chapter 3.5 Memory and I/O Systems. 2 Memory Management Memory problems are one of the leading causes of bugs in programs (60-80%) MUCH worse in languages.
How to Set-up Your Local Listing. Welcome This tutorial will take you through the steps to set-up (or edit) your Local listing to ensure you get the most.
Fall 2007cs4201 Advanced Java Programming Umar Kalim Dept. of Communication Systems Engineering
2005 Epocrates, Inc. All rights reserved. Integrating XML with legacy relational data for publishing on handheld devices David A. Lee Senior member of.
CS 4720 Dynamic Web Applications CS 4720 – Web & Mobile Systems.
Access Forms and Queries. Entering Data in Your Table  You can add data to your table in Datasheet view, by typing in the columns and rows.  This.
Model View Controller A Pattern that Many People Think They Understand, But Has A Couple Meanings.
Observer Please Snarf the Code for Today’s Class..
What is a port The Ports Collection is essentially a set of Makefiles, patches, and description files placed in /usr/ports. The port includes instructions.
1 Implementing LEAP2A using the Argotic library in.NET Andrew Everson Extensions for Argotic version can be downloaded from:
Introduction to Compilers. Related Area Programming languages Machine architecture Language theory Algorithms Data structures Operating systems Software.
3 Kinds of Libraries And some reflections on libraries in general As you arrive…please sit with your Tivoo groups.
An Introduction to Designing, Executing and Sharing Workflows with Taverna Katy Wolstencroft myGrid University of Manchester IMPACT/Taverna Hackathon 2011.
Database Management Systems (DBMS)
Persistence – Iteration 4 Vancouver Bootcamp Aaron Zeckoski
Advanced Object-oriented Design Patterns Creational Design Patterns.
Compare and Contrast : Blackboard & a Personal Web Page www3.ltu.edu/~s_schneider/howto/faculty.htm You’ll find this presentation (and another) here :
Jennifer Widom JSON Data Introduction. Jennifer Widom JSON Introduction JavaScript Object Notation (JSON)  Standard for “serializing” data objects, usually.
Unit Testing & Code Coverage Please download and install EclEmma (link in resources section…I recommend Option 2) Also snarf the junit code for today’s.
BTeV Software Workshop - FERMILAB October Dario Menasce I.N.F.N. Milano Code Browser Philosophy.
Google maps engine and language presentation Ibrahim Motala.
How to Set-up Your Business Alliance Listing. Welcome  This tutorial will take you through the steps to set-up (or edit) your listing to ensure you get.
CS 440 Database Management Systems Stored procedures & OR mapping 1.
Split your database Store temporary tables in a backend Don't use memo fields Create temporary tables to speed up queries Don't put Mac and Windows users.
XML & JSON. Background XML and JSON are to standard, textual data formats for representing arbitrary data – XML stands for “eXtensible Markup Language”
Introduction of Wget. Wget Wget is a package for retrieving files using HTTP and FTP, the most widely-used Internet protocols. Wget is non-interactive,
Best 3 Software Development Languages. Hibernate Training Hibernate is a high-performance object-relational mapping tool and query service. Hibernate.
Computer Systems Nat 5 Computing Science
NOSQL Data Models.
IBM Connections Side by Side/ In Place migration 5.5 / 6.0
Top 8 Best Programming Languages To Learn
A very brief introduction
Persistence – Iteration 4 Vancouver Bootcamp
Computer Systems Nat 5 Computing Science
Spark Presentation.
Dynamic SQL: Writing Efficient Queries on the Fly
SharePoint-Hosted Apps and JavaScript
Cracking the Coding Interview
Compiler Construction
Prof. Jason Eisner MWF 3-4pm (sometimes 3-4:15)
Dynamic SQL: Writing Efficient Queries on the Fly
Getting Started With Solr
CS 240 – Advanced Programming Concepts
Presentation transcript:

Storing Data

A Note About Creating Games

Why do you want to store data? 1.Data files 2.Configuration files

Configuration files Pros: Pulls crap like strings and constants out of your code Lets the same code run with different configurations at runtime Others can edit the configuration files themselves…sometimes the configuration files are a programming language unto themselves Centralizes config stuff Cons: You now must consider file management

Example Config File Application: Internationalized Applications Instead of JButton myButton = new JButton(“Press Here to Continue”); JButton myButton = new JButton(StringConfig.getStringFor(“PRESS_HERE”));

How do I store data? 1.The right answer is almost always not write a file format yourself 2.Know and use the right tool for the job: 1.Write the file format yourself (flat file) 2.Serializing 3.XML 4.JSON 5.Databases

Flat File Pros: Pretty Easy Requires no fancy libraries whatsoever You have total control, so you can deal with space/performance constraints directly (though this is not usually particularly easy) Cons: Parsing is notoriously error prone If you don’t deal with speed, it’s slow Concurrency and half written files are an issue

Serializing Pros – Super duper easy to use, even with complex data Cons – Can have complex issues with versioning (especially in a strongly typed language like Java) – Sometimes tied to language or library version – Not hand-editable, usually – Be sure you’re only serializing what you intend to – If something is half-written or has concurrency problems, expect to toss the whole file in the trash

XML Pros – Will parse for you, including some nice searching – XML library ensures you always have a well formatted file – Super portable format that almost anybody can read Cons – Search/update is still slow – Concurrency and half written files are an issue – Super verbose, and those XML libraries are often a major pain to use

JSON Pros – Will parse for you – JSON library ensures you always have a well formatted file – Portable format that almost anybody can read (but you usually will need to download a small library for most languages) – Easy to use! Hand editable Cons – Fancy-smancy corperate folks will complain that you didn’t use XML – Have to read everything into memory so it’s not suitable for giant chunks of data – Concurrency and half written files are an issue

Databases Pros – Lots of built in protection to prevent corruption and allow concurrency – Fast even with a large amount of data – Has a query language (usually SQL) that lets you do arbitrary kinds of searches on data Cons – Tricky to set up – Abandon all hopes of hand editing, but you can update with queries – For high performance, you have to understand how things work under the hood

JSON Sample Please snarf the code for today’s class You’ll need to download the JSON library Gson (URL is in the snarfed code) Modify the code to output a Map to a file and read it back When you’re finished, submit the code via ambient