Programming Heuristics Implications for tagcloud? Identify the - - PowerPoint PPT Presentation

programming heuristics implications for tagcloud
SMART_READER_LITE
LIVE PREVIEW

Programming Heuristics Implications for tagcloud? Identify the - - PowerPoint PPT Presentation

Programming Heuristics Implications for tagcloud? Identify the aspects of your application that vary What might change in going from release 0.9 to 1.0 and separate them from what stays the same to 2.0 in tag cloud Take what varies


slide-1
SLIDE 1

Software Design 2.1

Programming Heuristics

 Identify the aspects of your application that vary

and separate them from what stays the same

  • Take what varies and encapsulate it

 Program to an interface, not an implementation

  • Specify behavior by name, not by working code

 Favor Composition over Inheritance

  • Use "has-a" rather than "is-a"

 Classes and code should be open for extension, but

closed to modification

  • The Open-Closed Principle

Software Design 2.2

Implications for tagcloud?

 What might change in going from release 0.9 to 1.0

to 2.0 in tag cloud

  • Should we worry about future changes?
  • Should we make things work now?
  • Can we do both?

 Strategy pattern

  • Algorithm varies independently from clients that

use it,

  • What are the algorithms in tag cloud?

Software Design 2.3

Design patterns

“... describes a problem which occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice”

Christopher Alexander, quoted in GOF

 Name

  • good name is a handle for the pattern, builds vocabulary

 Problem

  • when applicable, context, criteria to be met, design goals

 Solution

  • design, collaborations, responsibilities, and relationships

 Forces and Consequences

  • trade-offs, problems, results from applying pattern: help in

evaluating applicability

Software Design 2.4

Towards being a hacker

 See the hacker-faq (compsci 108 web page)

  • Hackers solve problems and build things, and they

believe in freedom and voluntary mutual help. To be accepted as a hacker, you have to behave as though you have this kind of attitude yourself. And to behave as though you have the attitude, you have to really believe the attitude.

 The world is full of fascinating problems

  • no one should have to solve the same problem twice
  • boredom and drudgery are evil
  • freedom is good
  • attitude is no substitute for competence

You may not work to get reputation, but the reputation is a real payment with consequences if you do the job well.

slide-2
SLIDE 2

Software Design 2.5

Aside: ethics of software

 What is intellectual property, why is it

important?

  • what about FSF, GPL, copy-left, open source,
  • what about money and monopolies

 What does it mean to act ethically and

responsibly?

  • What about copying? stealing? borrowing?
  • No harm, no foul? Is this a legitimate

philosophy?

  • Can software developers make a difference

in the world?

Software Design 2.6

Richard Stallman

 Free Software movement

  • Free as in speech
  • Not Free as in beer

 Wrote emacs, gcc,gdb,…

  • GNU's not Unix

 Grace Murray Hopper award,

Macarthur award, EFF Pioneer award,

Software Design 2.7

java.io.*

 What is a package? How are packages organized in

Java? How do you find how to use them?

  • Reading API, reading books, writing code

 In Java there are lots of ways of reading, mostly

using InputStream and Reader abstract classes

  • Corresponding Writer classes?

 These classes use the Decorator pattern

  • Reading files? FileReader to BufferedReader
  • How to read System.in line-by-line?
  • See also java.util.Scanner , your friend!

Software Design 2.8

java.util.*

 Contains the collections framework, legacy

collection classes, event model, date and time facilities, internationalization, and miscellaneous utility classes (a string tokenizer, a random-number generator, and a bit array)

 From programmer's perspective the Collection

hierarchy provides data structures

  • Lists, Sets, Maps of elements (and others)
  • Your code must know how to play well with

collections

slide-3
SLIDE 3

Software Design 2.9

Playing well with Collections

 Every object has an equals(..) method, contract?

  • What does this return? How do you implement

it, what about apples and oranges?

  • Default behavior? When to over-ride?

 If you override/over-ride equals, see hashCode()

  • What does this return? Implementation issues?
  • Good, bad, …?

Software Design 2.10

Loose coupling and collections

 How do you store data in tag cloud?

  • What do you store?
  • How do you access it?
  • What are performance issues and trade-offs?

 Difference in storing into a Map versus storing into

a CloudCollector?

  • What heuristics are in play?
  • What do you do first?