T

.

Saturday 27 October 2018

RL Filters

High pass filter[edit]

When the inductor is in parallel with the load while the resistor is in series with the inductor and load, this creates a high pass filter.
Series-RL.svg
High pass filter has a transfer function
Frequency response of High pass filter
Cut off frequency,  , frequency at which 

Low pass filter[edit]

When the resistor is in parallel with the load while the inductor is in series with the resistor and load, a low pass filter is created.

Low pass filter has a transfer function
Frequency response of Low pass filter
Cut off frequency,  , frequency at which 
A single RL circuit creates a filter with a 20.0 dB/decade, or 6.02 dB/octave, slope.

Filters and its Types-Electronics


A Low Pass Filter is a circuit that can be designed to modify, reshape or reject all unwanted high frequencies of an electrical signal and accept or pass only those signals wanted by the circuits designer.
In other words they “filter-out” unwanted signals and an ideal filter will separate and pass sinusoidal input signals based upon their frequency. In low frequency applications (up to 100kHz), passive filters are generally constructed using simple RC (Resistor-Capacitor) networks, while higher frequency filters (above 100kHz) are usually made from RLC (Resistor-Inductor-Capacitor) components.
Passive filters are made up of passive components such as resistors, capacitors and inductors and have no amplifying elements (transistors, op-amps, etc) so have no signal gain, therefore their output level is always less than the input.
Filters are so named according to the frequency range of signals that they allow to pass through them, while blocking or “attenuating” the rest. The most commonly used filter designs are the:
  • The Low Pass Filter – the low pass filter only allows low frequency signals from 0Hz to its cut-off frequency, ƒc point to pass while blocking those any higher.
  • The High Pass Filter – the high pass filter only allows high frequency signals from its cut-off frequency, ƒc point and higher to infinity to pass through while blocking those any lower.
  • The Band Pass Filter – the band pass filter allows signals falling within a certain frequency band setup between two points to pass through while blocking both the lower and higher frequencies either side of this frequency band.
Simple First-order passive filters (1st order) can be made by connecting together a single resistor and a single capacitor in series across an input signal, ( VIN ) with the output of the filter, ( VOUT ) taken from the junction of these two components.
Depending on which way around we connect the resistor and the capacitor with regards to the output signal determines the type of filter construction resulting in either a Low Pass Filter or a High Pass Filter.
As the function of any filter is to allow signals of a given band of frequencies to pass unaltered while attenuating or weakening all others that are not wanted, we can define the amplitude response characteristics of an ideal filter by using an ideal frequency response curve of the four basic filter types as shown.

Ideal Filter Response Curves

filter response curve
Filters can be divided into two distinct types: active filters and passive filters. Active filters contain amplifying devices to increase signal strength while passive do not contain amplifying devices to strengthen the signal. As there are two passive components within a passive filter design the output signal has a smaller amplitude than its corresponding input signal, therefore passive RC filters attenuate the signal and have a gain of less than one, (unity).
A Low Pass Filter can be a combination of capacitance, inductance or resistance intended to produce high attenuation above a specified frequency and little or no attenuation below that frequency. The frequency at which the transition occurs is called the “cut-off” or “corner” frequency.
The simplest low pass filters consist of a resistor and capacitor but more sophisticated low pass filters have a combination of series inductors and parallel capacitors. In this tutorial we will look at the simplest type, a passive two component RC low pass filter.

The Low Pass Filter

A simple passive RC Low Pass Filter or LPF, can be easily made by connecting together in series a single Resistor with a single Capacitor as shown below. In this type of filter arrangement the input signal ( VIN ) is applied to the series combination (both the Resistor and Capacitor together) but the output signal ( VOUT ) is taken across the capacitor only.
This type of filter is known generally as a “first-order filter” or “one-pole filter”, why first-order or single-pole?, because it has only “one” reactive component, the capacitor, in the circuit.

RC Low Pass Filter Circuit

passive rc low pass filter
As mentioned previously in the Capacitive Reactance tutorial, the reactance of a capacitor varies inversely with frequency, while the value of the resistor remains constant as the frequency changes. At low frequencies the capacitive reactance, ( XC ) of the capacitor will be very large compared to the resistive value of the resistor, R.
This means that the voltage potential, VC across the capacitor will be much larger than the voltage drop, VR developed across the resistor. At high frequencies the reverse is true with VC being small and VR being large due to the change in the capacitive reactance value.
While the circuit above is that of an RC Low Pass Filter circuit, it can also be thought of as a frequency dependant variable potential divider circuit similar to the one we looked at in the Resistors tutorial. In that tutorial we used the following equation to calculate the output voltage for two single resistors connected in series.
potential divider equation
We also know that the capacitive reactance of a capacitor in an AC circuit is given as:
capacitive reactance equation
Opposition to current flow in an AC circuit is called impedance, symbol Zand for a series circuit consisting of a single resistor in series with a single capacitor, the circuit impedance is calculated as:
ac impedance equation
Then by substituting our equation for impedance above into the resistive potential divider equation gives us:

RC Potential Divider Equation

rc potential divider equation
So, by using the potential divider equation of two resistors in series and substituting for impedance we can calculate the output voltage of an RC Filter for any given frequency.

Low Pass Filter Example No1

Low Pass Filter circuit consisting of a resistor of 4k7Ω in series with a capacitor of 47nF is connected across a 10v sinusoidal supply. Calculate the output voltage ( VOUT ) at a frequency of 100Hz and again at frequency of 10,000Hz or 10kHz.

Voltage Output at a Frequency of 100Hz.

capacitive reactance at 100hz
potential divider at 100hz

Voltage Output at a Frequency of 10,000Hz (10kHz).

capacitive reactance at 10khz
potential divider at 10khz

Frequency Response

We can see from the results above, that as the frequency applied to the RC network increases from 100Hz to 10kHz, the voltage dropped across the capacitor and therefore the output voltage ( VOUT ) from the circuit decreases from 9.9v to 0.718v.
By plotting the networks output voltage against different values of input frequency, the Frequency Response Curve or Bode Plot function of the low pass filter circuit can be found, as shown below.

Frequency Response of a 1st-order Low Pass Filter

low pass filter bode plot
The Bode Plot shows the Frequency Response of the filter to be nearly flat for low frequencies and all of the input signal is passed directly to the output, resulting in a gain of nearly 1, called unity, until it reaches its Cut-off Frequency point ( ƒc ). This is because the reactance of the capacitor is high at low frequencies and blocks any current flow through the capacitor.
After this cut-off frequency point the response of the circuit decreases to zero at a slope of -20dB/ Decade or (-6dB/Octave) “roll-off”. Note that the angle of the slope, this -20dB/ Decade roll-off will always be the same for any RC combination.
Any high frequency signals applied to the low pass filter circuit above this cut-off frequency point will become greatly attenuated, that is they rapidly decrease. This happens because at very high frequencies the reactance of the capacitor becomes so low that it gives the effect of a short circuit condition on the output terminals resulting in zero output.

Green Computing

I. Introduction
Green Computing has become an innovative way on how technology and ecology converge together. With the recent years many industries and companies have turned their attention in realizing how going 'green' can benefit public relations, reduced costs, and lowering global emissions from industrial manufacturing. Though the term green computing covers a vast range of methods, from energy saving techniques, to the study of materials used in our lives, it all fundamentally breaks down to finding ways to not damage or consume all of earth's natural resources.Ultimately green computing focuses on ways in reducing overall environmental impact, its main purpose is to find and promote new ways of reducing pollution, discovering alternative technologies, and creating more recyclable products (Gingichashvili, 2007).
II. Background
The idea of green computing has been around a good time, the government themselves play a role in it. For example the Environmental Protection Agency (EPA) launched the 'energy star' program in the 90s, to promote energy efficient methods. The EPA today still plays an active role by providing not only energy effective methods, but also cost effective methods for the consumers. In 2006 the EPA established a way to save U.S. households and businesses money; "With an eye to saving U.S. households and businesses more than $1.8 billion in energy costs over the next 5 years, today EPA announced new Energy Star specifications for computers and related equipment.These new modifications are also expected to prevent greenhouse gas emissions equal to the annual emissions of 2.7 million cars."(Jones, 2006) Though the EPA is a recognizable agency, they are not the only ones who promoting new ways of going green in the technological aspect. Organizations such as European Union and TCO Certification are one of the leading groups in green computing.

III. How it is beneficial for Human Beings and Environement?

The ever rapid growth of technologies and innovations brings forth many ways on how green computing will have a positive impact, along with great benefits. The benefits of green computing is large, not only from just the consumer, or business, or country's standpoint, but a global benefit. Green computing helps reduce energy demands, waste, and money of how we use technology which positively effects the environment, and our costs.Though the method of green computing can also benefit in simple ways, methods such as turning off your computers during the night. For example, a computer left on for "24 hours will cost you between $115-160 in annual electric costs and also produce 1,500 pounds of CO2 in the atmosphere" (Schneider, 2008). By simply turning off your computer during the nights, you ultimately can save up to" 67 percent annually in your electric bill"(Schneider, 2008), along with reducing greenhouse gases. Overall the benefits of green computing will result in saving money, reducing costs, and conserving energy, along with helping the environment.
IV. Ethical Issues
Going green is not only a fashion statement, it is a real movement that begun back in 1992 with "The Energy Star Program" (Brandrick, 2009). It has become a way of life for many big corporations to try and reduce the amount of energy waste that they would normally excrete and nowadays it is not only expected to be done by such corporations but also by small businesses and individuals alike who have a moral responsibility to their community.Due to the widely known need to save energy and natural resources of our ever dyeing planet many manufacturers have come out with ideas on how to make your device energy efficient, the problem is that with good inventions come the useless ones and those are made to assume a purpose that it is not properly attributed. Some manufacturers will label a product as energy efficient just so it can be sold but sadly it will not work.
Consumers can easily be deceived to buy such products that end up causing more harm to the environment "considering the materials and energy used to manufacture it"(Brandrick, 2009) such products are truly a waste.Like the "Eco Button that promised its consumers that they would save energy and money" (Brandrick, 2009) on their PC but there was a downloadable content available on the internet that would provide the same results. It is not moral or ethical for such manufacturers to lie on the efficiency of their product but it's not illegal to say that the product was misinterpreted by the consumer.
V. Security Concerns & Social Problems
Many belief that being eco-friendly is a get rich idea from big corporations that know that if the consumer is unhappy then they will not buy their product. Even though this is somewhat true and the consumer does look bad at companies believed to be unjust, it is also true that such companies care for the environment. We all remember the "Gulf of Mexico Oil Spill" (Mufson, 2010) and how things like that can "seriously burn their reputation" (Wharton, 2007), this is why such big companies care for the environment and how they affect it. We all remember the oil spill on the gulf of Mexico in 2010 and how that dilemma hurt the BP company and still is hurting it even after a year, if they had followed all the right protocols maybe this tragedy could have been averted.
VI. Further Required Research
Advancements in green computing have become vast. There are so many new ways of combining ecology with technology, that we practically are trying a bit of everything. Such as using solar technology, solar technology now is being used on keyboards and mice now to reduce energy costs. Another green computing method is eliminating certain materials that are hazardous to the environment, and replacing them with cleaner and efficient materials which are biodegradable and eco-friendly. Even now certain computer components such as processor units have reduced heat emissions, and monitors as well with their advancement of flat screens.
Not only is green computing effecting components and other various hardware, it has changed in ways businesses use technology such as cloud computing. Cloud computing essentially is a method of a user connecting to a network or server, through the internet. Ultimately this reduces the need of businesses to have purchase more computers, which can emit greenhouse gases when left on.
The practice of green computing has essentially branched off to every form of technology out there. Cars being a great example, now with hybrids becoming mainstream, people are able to save on gas, money, and also cutting on carbon monoxide, and other various dangerous gases to the atmosphere.
Green computing has also grasped how industries market themselves, and many realize how going green in their technologies can aid them. One great example of green computing corporation is Apple. "Apple has been criticized by some environmental organizations for not being a leader in removing toxic chemicals from its new products, and for not aggressively or properly recycling its old products" (Jobs, 2009) but that has changed, when looking now upon Apple's computers, their unibody designs material is a great source to dissipate heat, along with their products being able to conserve energy very well. Not only have they implemented ways in being more eco-friendly by removing hazardous materials in their computers and products, but their manufacturing and delivering their goods has also been altered to help the environment.

Sunday 16 September 2018

Design and Analysis of Algorithms-Course Outline

Course Description: The design and analysis of algorithms is the core subject matter of Computer
Science. Given a problem, we want to (a) nd an algorithm to solve the problem, (b) prove that the
algorithm solves the problem correctly, (c) prove that we cannot solve the problem any faster, and (d)
implement the algorithm. Designing an algorithm for a computational problem involves knowledge of the
problem domain, a thorough knowledge of the data structures that are available and suitable and no small
measure of creativity. This course concentrates on the above problems, studying useful algorithm design
techniques, and methods for analyzing algorithms.

Data Communication & Networks-Course Outline

GC University Lahore
Department of Computer Science

Course Title: Data Communication & Networks
Course Code: CS - 3106
Course Duration: One Semester (16 weeks of study)
Credit Hour:  03
Course Instructor:Mr. Yahya Khurram 

Course Description: To introduce students to the concept of computer communication. Analogue & digital transmission. Network Layers, Network models (OSI, TCP/IP) and Protocol Standards. Emphasis is given on the understanding of modern network concepts.
Pre-Requisite: None
Course Co-Requisite: Wireless & Mobile Communication

Course Goals & Objective
Goal No.1: Explain introduction to Data Communication, Internet Communication Model, OSI reference Model and TCP/IP protocol architecture.      
              
       Obj No.01:           Explain data communication and computer networks (LAN, WAN, MAN & Wireless LAN), also explain different LAN topologies.
Obj No.02:           Describe OSI reference Model in detail with each layer functionality and different protocols working at different layers.
Obj No.03:           Discuss Guided transmission media (Twisted Pair, Coaxial Cable, Optical Fiber)& Unguided transmission Media.
Obj No.04:          Explain TCP/IP protocol architecture in detail and comparison of TCP/IP with OSI Model.   
Obj No.05:           Discuss LAN protocol architecture and explain popular protocols in detail (TCP, UDP, HTTP, F|TP, SMTP etc.)
   

Goal No.2: Explain Digital Data Communication and Data Link control in detail

Obj No.01:           Explain the Synchronous and Asynchronous communication also discusses error detection and error correction in detail.
Obj No.02:           Describe flow control in data link control, Explain Stop and Wait flow control in detail.
Obj No.03:          Explain different techniques of error control in detail (Stop and Wait ARQ, Go back N ARQ, Selective Reject ARQ).        
Obj No.04:          Discuss the High Level Data Link (HDLC) protocol functionality. 
Obj No.05:          Discuss Analog transmission, Digital transmission and Transmission impairments
       
Goal No.3: Explain & describe the Multiplexing,  Spread Spectrum, Encoding Schemes and Transmission Media.

Obj No.01:          Describe the concept of Frequency Division Multiplexing and Time Division Multiplexing.
                   Obj No.02:          Explain Basic concept of Spread Spectrum, also explain Frequency Hopping spread spectrum and Direct Sequence Spread spectrum.
Obj No.03:           Explain guided transmission media. Discuss wireless transmission and wireless propagation.
                   Obj No.04:          Explain Line of sight propagation and mobile transmission in detail.
                   Obj No.04:          Explain Switched, IP Networks and Inter-networking
       Obj No.05:          Explain Encoding Schemes (Digital Data – Digital Signal, Analog Data – Digital Signal, Digital Data – Analog Signal, Analog Data – Analog Signal).

Goal No.4: Describe the Circuit Switching and Packet Switching. Explain the routing in Switched Networks.

Obj No.01:          Discuss Concept of Circuit switching.
                   Obj No.02:          Discuss Circuit switching networks and control signaling in circuit switching.
Obj No.03:           Explain Packet switching principles and two types of packet switching (Datagram & Virtual Circuits) . Discuss packet size in packet switching.
                   Obj No.04:          Discuss the comparison of circuit switching and packet switching and which is better in different scenarios.
Obj No.05:          Discuss the routing and circuit switching networks and packet switching networks in detail.
                       
Teaching & Learning Strategies

The course will be taught by a combination of lectures, presentations and directed reading material. Unannounced quizzes will be taken during the lectures. All lectures may comprise of a power point presentation, handouts and white board demonstrations. The students will be given the assignments related to the topic covered during the different lecture. Each student will be asked to select a research topic and give at least one assessed presentation to the class.

Lecture Duration will be of 90 Minutes.

Time Management Matrix

  • Goal No.1    18%:  3 Weeks
  • Goal No.2    25%:       4 Weeks
  • Goal No.3    25%:       4 Weeks
  • Goal No. 4   32%:       5 Weeks         

Assessment Strategy

  • Semester Work (Assignments +Quizzes) : 05% + 15 %
  • Mid Term : 20%
  • Final Term (Objective + Subjective): 10 + 50 = 60%

Evaluation is based on how well the student will perform in class, assignments and quizzes. Performance will be monitored throughout the semester. The examination will test the student’s understanding of the various concepts discussed during the course.
The written examination requires students to complete a theoretical paper covering all aspects of the course.

Friday 13 July 2018

Microsoft Urges Congress to Regulate Use of Facial Recognition

Bradford L. Smith, the company’s president, compared the technology to products like medicines and cars that are highly regulated, and he urged Congress to study it and oversee its use.We live in a nation of laws, and the government needs to play an important role in regulating facial recognition technology,” 

Mr. Smith wrote. He added: “A world with vigorous regulation of products that are useful but potentially troubling is better than a world devoid of legal standards.”


Now, Microsoft is moving to position itself as an industry leader by calling for government regulation of facial recognition, and for “the development of norms around acceptable uses,” of the technology. The company may also be trying to get out ahead of a budding movement in states like California to tightly regulate the technology.

Wednesday 11 July 2018

GCU BSCS Entry Test 2018 Details

For more Details and Preparation Sources.Contact through
Email: saadaslam816@gmail.com
Facebook: saadaslam7355
WhatsApp: 0302-4609017
Or post  your comments below in the comments section




Friday 6 April 2018

DSA Mid Term Syllabus


DSA Pre-Mid Topics
1.    All General Algorithms related to search and sort.
2.    Arrays. General arrays and traversal algorithms.
a.     Polynomial algorithms, general matrices.
b.    Dynamic arrays, dynamic declaration, dynamic growth and shrinking.
c.     Inorder insertion. Deletion, inorder deletion.
d.    2D array search, traversal. Complex 2D/3D loops for any purpose.
3.    Algorithm techniques:
         Brute Force vs Divide & Conquer.
4.    Time cost. Loop cost, nested loop, initialization and boundary checking cost. Exact cost verses order of complexity.
5.    Stack: 
          using Array and Linked list. Stack ordering, ToH problem, in-order insertion in stack using a temporary stack, stack search and delete using temporary stack, Sorting using stack.

DSA-Mids Solution-2018


Roll No:-BSCS-2017 Name:____________ Section:

Saturday 31 March 2018

Coupling and Cohesion-OOP



Name:                       Saad Aslam
Roll No:                    0043-BSCS-16
Section:                    E2
Subject:                    Object Oriented Programming

Topics :
Ø Coupling
Ø Reduce Coupling
§  Calling Separate Methods
§  Encapsulation
§  Responsibilty driven design
§  Localizing Changes
Ø Implicit Coupling
Ø Cohesion
Ø Refactoring
§  Refactoring and testing
§  Refactoring for language independence





 
CH #6                            Coupling and Cohesion
REDUCE COUPLING
Ø  By calling separate methods:
If same code is used in different methods again and again than instead of writing  the same code in different methods ,we can implement a separate method and write that code which is similar in different methods and then call that code in that methods where the code was used.


Ø  Encapsulation:
To avoid tight coupling ,we need to use encapsulation by making all public fields to public .This will help us in decoupling the classes and hence decrease in tight coupling.
(“Never make fields public!”)
Proper
encapsulation in
classes reduces
coupling and thus
leads to a better

The encapsulation guideline (hiding implementation information from view) suggests that only information about what a class can do should be visible to the outside, not about how it does it.This has a great advantage: if no other class knows how our information is stored, then we can easily change how it is stored without breaking other classes.

Ø  Responsibility-driven design:
Responsibility-driven design expresses the idea that each class should be responsible for handling
its own data. Often, when we need to add some new functionality to an application, we
need to ask ourselves in which class we should add a method to implement this new function.
Which class should be responsible for the task? The answer is that the class that is responsible
for storing some data should also be responsible for manipulating it.

Ø  Localizing Changes:
Another aspect of the decoupling and responsibility principles is that of localizing change. We
aim to create a class design that makes later changes easy by localizing the effects of a change.
Ideally, only a single class needs to be changed to make a modification. Sometimes several
classes need change, but we then aim at this being as few classes as possible. In addition, the
changes needed in other classes should be obvious, easy to detect, and easy to carry out.
To a large extent, we can achieve this by following good design rules such as using
responsibility-driven design and aiming for loose coupling and high cohesion. In addition, however,
we should have modification and extension in mind when we create our applications. It is important
to anticipate that an aspect of our program might change, in order to make this change easy.

WORSE FORM OF COUPLING
Implicit Coupling:
          There is an even worse form of coupling: implicit coupling.
          Implicit coupling is a situation where one class depends on the internal information of another,but this dependence is not immediately obvious. The tight coupling in the case of the public fields was not good, but at least it was obvious. If we change the public fields in one class and forget about the other, the application will not compile any more and the compiler will point out the problem. In cases of implicit coupling, omitting a necessary change can go undetected.
          This is a fundamental problem, because every time a command is added, the help text needs to be changed, and it is very easy to forget to make this change. The program compiles and runs, and everything seems fine. A maintenance programmer may well believe that the job is finished and release a program that now contains a bug.
This is an example of implicit coupling.

THINKING AHEAD

Q:What is Model View Controller Pattern?

COHESION
A unit of code should always be responsible for one, and only one, task. The principle of cohesion can be applied to classes and methods: classes should display a high degree of cohesion, and so should methods.

Ø  Cohesion in Methods:
When we talk about cohesion of methods, we seek to express the ideal that any one method should be responsible for one, and only one, well-defined task.We can see an example of a cohesive method in the Game class. This class has a private method named printWelcome to show the opening text, and this method is called when the game starts in the play method.

Ø  Cohesion in Classes:
The rule of cohesion of classes states that each class should represent one single, well-defined entity in the problem domain.

BENEFITS OF COHESION

There are several ways in which high cohesion benefits a design. The two most important ones
are readability and reuse

REFACTORING

        Refactoring is the activity of restructuring existing classes and methods to adapt them to
changed functionality and requirements. Often in the lifetime of an application, functionality is
gradually added. One common effect is that, as a side-effect of this, methods and classes slowly
grow in length.
     Refactoring is the rethinking and redesigning of class and method structures. Most commonly,the effect is that classes are split in two or that methods are divided into two or more methods.
Refactoring can also include the joining of multiple classes or methods into one, but that is less
common than splitting.

Ø  Refactoring and testing:
Before we provide an example of refactoring, we need to reflect on the fact that, when we
refactor a program, we are usually proposing to make some potentially large changes to something
that already works. When something is changed, there is a likelihood that errors will be
introduced. Therefore, it is important to proceed cautiously; and, prior to refactoring, we should establish that a set of tests exists for the current version of the program. If tests do not exist, then we should first decide how we can reasonably test the functionality of the program and record those tests (for instance, by writing them down) so that we can repeat the same tests later.

Refactoring will follow the following two steps:

 The first step is to refactor in order to improve the internal structure of the code, but without
making any changes to the functionality of the application. In other words, the program should,
when executed, behave exactly as it did before. Once this stage is completed, the previously
established tests should be repeated to ensure that we have not introduced unintended errors.

 The second step is taken only once we have reestablished the baseline functionality in the refactored version. Then we are in a safe position to enhance the program. Once that has been
done, of course, testing will need to be conducted on the new version.

               Doing good refactoring is as much about thinking in a certain mindset as it is about technical skills. While we make changes and extensions to applications, we should regularly question whether an original class design still represents the best solution. As the functionality changes, arguments for or against certain designs change. What was a good design for a simple application might not be good any more when some extensions are added.

Recognizing these changes and actually making the refactoring modifications to the source
code usually saves a lot of time and effort in the end. The earlier we clean up our design, the
more work we usually save.

Ø  Refactoring for language independence:

          If we want to have language independence in the program, then ideally we should have just one place in the source code where the actual text of command words is stored and have everywhere else refer to commands in a language-independent way. A programming language feature that makes this possible is enumerated types, or enums.

           In its simplest form, an enumerated type definition consists of an outer wrapper that uses the word enum rather than class and a body that is simply a list of variable names denoting the
set of values that belong to this type. By convention, these variable names are fully capitalized.
We never create objects of an enumerated type. In effect, each name within the type definition
represents a unique instance of the type that has already been created for us to use. We refer to these instances as CommandWord.GO, CommandWord.QUIT, etc. Although the syntax for using them is similar, it is important to avoid thinking of these values as being like the numeric class constants Despite the simplicity of their definition, enumerated type values are proper objects and are not the same as integers.

SUMMARY

Ø  Good class design can make a huge difference when an application needs to be corrected, modified,or extended. It also allows us to reuse parts of the application in other contexts (for example, for other projects) and thus creates benefits later.
Ø  There are two key concepts under which class design can be evaluated: coupling and cohesion.
Ø  Coupling refers to the interconnectedness of classes, cohesion to modularization into appropriate units. Good design exhibits loose coupling and high cohesion.
Ø  One way to achieve a good structure is to follow a process of responsibility-driven design. Whenever we add a function to the application, we try to identify which class should be responsible for which part of the task.
Ø  When extending a program, we use regular refactoring to adapt the design to changing requirement and to ensure that classes and methods remain cohesive and loosely coupled.


CONCEPT SUMMARY

 Coupling The term coupling describes the interconnectedness of classes. We strive for loose
coupling in a system—that is, a system where each class is largely independent and communicates with other classes via a small, well-defined interface.

 Cohesion The term cohesion describes how well a unit of code maps to a logical task or entity.In a highly cohesive system, each unit of code (method, class, or module) is responsible
for a well-defined task or entity. Good class design exhibits a high degree of cohesion.

 Code duplication Code duplication (having the same segment of code in an application more
than once) is a sign of bad design. It should be avoided.

 Encapsulation Proper encapsulation in classes reduces coupling and thus leads to a better
design.

 Responsibility-driven design Responsibility-driven design is the process of designing
classes by assigning well-defined responsibilities to each class. This process can be used to
determine which class should implement which part of an application function.

  Localizing change One of the main goals of a good class design is that of localizing change:
making changes to one class should have minimal effects on other classes.

 Method cohesion A cohesive method is responsible for one, and only one, well-defined task.

 Class cohesion A cohesive class represents one well-defined entity.

 Refactoring Refactoring is the activity of restructuring an existing design to maintain a good
class design when the application is modified or extended.

 Switch statement A switch statement selects a sequence of statements for execution from
multiple different options.