1

I have to create a Media Library for a tasksheet, which stores Peoples Information (Normal People, Artists, Bands) and Media(Audio [audio length - type String] Video[Size - type String])

I started creating a MediaContainer Class, which (through ArrayList) allows me to store information of type String. So I thought I would simply create two classes (MediaContainer which is supposed to hold the data, and Information Class which has all the methods to fill it - I'm a beginner so extra question: am I doing it right?)

The Help i really need is assurance or advice from more experienced users in a form of feedback (so i know i'm heading the right way). This is how far I am -

import java.util.ArrayList;

public class MediaContainer {

    ArrayList<String> Media = new ArrayList<String>();

    public MediaContainer(String addmedia) {
        Media.add(addmedia);
        System.out.println("this is the list :"+Media);
    }
}

How should I proceed? Many thanks in advance!

partlov
  • 13,789
  • 6
  • 63
  • 82
gbe
  • 25
  • 2
  • 6

1 Answers1

2

I would write a simple unit test to show you can add the information you need and retrieve it.

I would also try to;

  • follow Java Coding Conventions e.g. camelCase variables.
  • make fields final and private where possible.
  • use interface instead of concrete types for collections where possible e.g. List
  • I assume you will need a custom class Media to record the information associated with media. i.e. one String will not be enough.
Peter Lawrey
  • 525,659
  • 79
  • 751
  • 1,130
  • And I would also not separate `Artists` from `Normal People`. ;) – Rohit Jain Jan 10 '13 at 11:01
  • @PeterLawrey.. Can you help me out in this question: - http://stackoverflow.com/questions/14252520/is-there-any-available-api-to-represent-various-units-of-item-like-kg-litre-me if you haven't already seen it. I'm afraid that question is now burried deep, and I haven't got any convincing answer :( – Rohit Jain Jan 10 '13 at 11:05