Wednesday, December 7, 2016

Object Oriented Analysis points to remember


Encapsulate what varies.

Code to an interface rather than to an implementation.

Each class in your application should have only one reason to change.


Coding to an interface, rather than to an implementation, makes your software easier to extend.



By Encapsulation what varies, you make your application more flexible, and easier to change.

When you have a set of properties that vary across your objects, use a collection, like a Map, to store those properties dynamically. 

You’ll remove lots of methods from your classes, and avoid having to change your code when new properties are added to your app.


Most good designs come from analysis of bad designs.



Never be afraid to make mistakes and then change things around.

Seeing how easy it is to change your software is one of the best ways to figure out if you really have well-designed software.

Cohesive class does one thing really well and does not try to do or be something else.


Cohesion measures the degree of connectivity among the elements of a single module, class, or object. 



The higher the cohesion of your software is, the more well-defined and related the responsibilities of each individual class in your application. Each class has a very specific set of closely related actions it performs.

Cohesion focuses on how you’ve constructed each individual class, object, and package of your software.

If each class does just a few things that are all grouped together, then it’s probably a highly cohesive piece of software. But if you have one class doing all sorts of things that aren’t that closely related, you’ve probably got low cohesion.


Use basic OO principles like encapsulations and inheritance to make your software more flexible.



Make Sure each of your classes is cohesive and should focus on doing ONE THING really well.

Always strive for higher cohesion as you move through your software’s design life cycle.

You solve big problems the same way you solve small problems.


Strive for a maintainable, reusable design.



By encapsulating what varies, you make your application more flexible, and easier to change.

Coding to an interface, rather than to an implementation, makes your software easier to extend.

Get features from the customer, and then figure out the requirements you need to implement those features.

Architecture is the organisational structure of a system, including its decomposition into parts, their connectivity, interaction mechanisms, and the guiding principles and decisions that you use in the design of a system.

Sometimes the best way to write great code is to hold off on writing code as long as you can and Plan,organise,architect,understand requirements,reduce risks all these make the job of actually writing your code very simple.


Absolutely! Remember,great software is more than just great code.



A design principle is a basic tool or technique that can be applied to designing or writing code to make that code more maintainable, flexible, or extensible.

First design principle is the OCP, or the Open-Closed principle. The OCP is all about allowing change, but doing it without requiring you to modify existing code.


Open-Closed Principle Classes should be open for extension, and closed for modification.





Monday, April 18, 2016

Palindrome Number Program and Fibonacci Series Program

class Palindrom{
public static void main(String[] dataBag){
int number = 12121;
int palindrom = 0;
int temp = number;

while(temp>0){
palindrom = palindrom*10;
int digit = temp%10;
palindrom += digit;
temp = temp / 10;
}

if(number == palindrom){
System.out.println(number+" is a palindrom number");
}else{
System.out.println(number+" is not palindrom number");
}
}
}


class Fibonacci {
public static void main(String[] dataBag){
int ans = 0 ;
int prev = ans;
int next = 1;

do{

System.out.println(prev);
ans = prev + next;
prev = next;
next = ans;
}while(prev<=25);
}
}

Thursday, February 4, 2016

java code to load and play media file

import javax.media.*;
import java.io.File;

import java.awt.*;
 
public class TrivialJMFPlayer extends Frame {

 
    public static void main (String[] args) {

        try {
            Frame f = new TrivialJMFPlayer();

            f.pack();

            f.setVisible (true);

        } catch (Exception e) {

            e.printStackTrace();

        }
    }
    public TrivialJMFPlayer() 

        throws java.io.IOException,

               java.net.MalformedURLException,
               javax.media.MediaException {

        FileDialog fd = new FileDialog

            (this, "TrivialJMFPlayer", FileDialog.LOAD);

        fd.setVisible(true);

        File f = new File(fd.getDirectory(), fd.getFile());

        Player p = Manager.createRealizedPlayer
            (f.toURI().toURL());

        Component c = p.getVisualComponent();

        add(c);
        p.start();

    }
}

Google Chrome Shotcuts


Navigate elements
Expand/collapse
Enter
Edit attribute
H
Hide element
F2
Toggle edit as HTML
Styles Pane
TabShift + Tab
Next/previous property
Increment value
Decrement value
PageUpShift + ↑
Increment by 10
PageDownShift + ↓
Decrement by 10
Shift + PageUp
Increment by 100
Shift + PageDown
Decrement by 100
Alt + ↑
Increment by 0.1
Alt + ↓
Decrement by 0.1
Debugger
F8Ctrl + \
Pause/ Continue
F10Ctrl + '
Step over
F11Ctrl + ;
Step into
Shift + F11Ctrl + Shift + ;
Step out
Ctrl + .Ctrl + ,
Next/previous call frame
Ctrl + Shift + E
Evaluate selection in console
Ctrl + Shift + A
Add selection to watch
Ctrl + B
Toggle breakpoint
Console
Ctrl + L
Clear console
Tab
Autocomplete common prefix
Accept suggestion
Ctrl + U
Clear console prompt
Next/previous line
Enter
Execute command
Text Editor
Ctrl + Shift + P
Go to member
Ctrl + Space
Autocompletion
Ctrl + G
Go to line
Alt + -
Jump to previous editing location
Alt + +
Jump to next editing location
Ctrl + /
Toggle comment
Alt + ↑
Increment CSS unit by 1
Alt + ↓
Decrement CSS unit by 1
Alt + PageUp
Increment CSS unit by 10
Alt + PageDown
Decrement CSS unit by 10
Ctrl + D
Select next occurrence
Ctrl + U
Soft undo
Ctrl + M
Go to matching bracket
Alt + W
Close editor tab
Alt + O
Switch between files with the same name and different extensions.
Timeline Panel
Ctrl + E
Start/stop recording
F5Ctrl + R
Record page reload
Ctrl + S
Save timeline data
Ctrl + O
Load timeline data
[]
Jump to previous/next frame
Profiles Panel
Ctrl + E
Start/stop recording
All Panels
Ctrl + [Ctrl + ]
Go to the panel to the left/right
Ctrl + Alt + [Ctrl + Alt + ]
Go back/forward in panel history
Ctrl + Tilde
Show console
Esc
Toggle drawer
Ctrl + Shift + M
Toggle device mode
Ctrl + Shift + D
Toggle dock side
Ctrl + F
Search
Ctrl + Shift + F
Search across all sources
Ctrl + Shift + C
Select node to inspect
Ctrl + P
Go to source