<< Chapter < Page Chapter >> Page >

A software framework, in computer programming, is an abstraction in which common code providing generic functionality can be selectivelyoverridden or specialized by user code providing specific functionality.

Frameworks are a special case of software libraries in that they are reusable abstractions of code wrapped in a well-defined API, yet they contain some keydistinguishing features that separate them from normal libraries.

Software frameworks have these distinguishing features that separate them from libraries or normal user applications:

  1. inversion of control - In a framework, unlike in libraries or normal user applications, the overall program's flow of controlis not dictated by the caller, but by the framework.
  2. default behavior - A framework has a default behavior. This default behavior must actually be some useful behavior and not a seriesof no-ops.
  3. extensibility - A framework can be extended by the user by selective overriding of framework code in order to provide specificfunctionality
  4. non-modifiable framework code - The framework code, in general should not normally be modified by the user. Users can extend theframework, but normally should not modify its code.

In short, a software framework is a computer program that helps you to write computer programs.

The Processing PDE fits all of these characteristics of a framework.

Inversion of control

By default, the overall flow of control of a Processing sketch is beyond the control of the programmer. When the sketch starts running, the setup method will be called once and (by default) the draw method will be called repeatedly at a default rate of 60 calls per second.

A small window will be displayed in the default Java display mode. If you haven't overridden the draw method to control the contents of that window, it will look something like that shown in Image 1 .

Image 1. default display window.

Default display window
Image 1. Default display window.

Create the body of a class

Image 2 shows a screen shot of the PDE with program code showing in the leftmost tab.

Image 2. the pde.

The PDE.
Image 2. The PDE.

When you create a new sketch in the PDE and enter code in the leftmost tab, you are actually writing the body of a new class witha class name that matches the name of the tab. The code that you see in Image 2 , for example, constitutes the body of a new class named Cars .

Override setup and draw methods

In general, you need to override the methods named setup and draw in the body of this class. It is the code that you write in these two overridden methods that controls the behavior of the sketch.

The setup method will be called once when you click the run button. You should place any code that needs to be executed to initialize the state of the sketch in this method. Often this code willinitialize variables, instantiate new objects, etc.

After that, by default, the draw method will be called repeatedly until you terminate execution of the sketch. You need to write codein the draw method that controls the ongoing behavior of the sketch. Often, this code will call methods on existing objects, modify thecontents of variables, instantiate and call methods on new objects, etc.

Questions & Answers

Is there any normative that regulates the use of silver nanoparticles?
Damian Reply
what king of growth are you checking .?
Renato
What fields keep nano created devices from performing or assimulating ? Magnetic fields ? Are do they assimilate ?
Stoney Reply
why we need to study biomolecules, molecular biology in nanotechnology?
Adin Reply
?
Kyle
yes I'm doing my masters in nanotechnology, we are being studying all these domains as well..
Adin
why?
Adin
what school?
Kyle
biomolecules are e building blocks of every organics and inorganic materials.
Joe
anyone know any internet site where one can find nanotechnology papers?
Damian Reply
research.net
kanaga
sciencedirect big data base
Ernesto
Introduction about quantum dots in nanotechnology
Praveena Reply
what does nano mean?
Anassong Reply
nano basically means 10^(-9). nanometer is a unit to measure length.
Bharti
do you think it's worthwhile in the long term to study the effects and possibilities of nanotechnology on viral treatment?
Damian Reply
absolutely yes
Daniel
how to know photocatalytic properties of tio2 nanoparticles...what to do now
Akash Reply
it is a goid question and i want to know the answer as well
Maciej
characteristics of micro business
Abigail
for teaching engĺish at school how nano technology help us
Anassong
Do somebody tell me a best nano engineering book for beginners?
s. Reply
there is no specific books for beginners but there is book called principle of nanotechnology
NANO
what is fullerene does it is used to make bukky balls
Devang Reply
are you nano engineer ?
s.
fullerene is a bucky ball aka Carbon 60 molecule. It was name by the architect Fuller. He design the geodesic dome. it resembles a soccer ball.
Tarell
what is the actual application of fullerenes nowadays?
Damian
That is a great question Damian. best way to answer that question is to Google it. there are hundreds of applications for buck minister fullerenes, from medical to aerospace. you can also find plenty of research papers that will give you great detail on the potential applications of fullerenes.
Tarell
what is the Synthesis, properties,and applications of carbon nano chemistry
Abhijith Reply
Mostly, they use nano carbon for electronics and for materials to be strengthened.
Virgil
is Bucky paper clear?
CYNTHIA
carbon nanotubes has various application in fuel cells membrane, current research on cancer drug,and in electronics MEMS and NEMS etc
NANO
so some one know about replacing silicon atom with phosphorous in semiconductors device?
s. Reply
Yeah, it is a pain to say the least. You basically have to heat the substarte up to around 1000 degrees celcius then pass phosphene gas over top of it, which is explosive and toxic by the way, under very low pressure.
Harper
Do you know which machine is used to that process?
s.
how to fabricate graphene ink ?
SUYASH Reply
for screen printed electrodes ?
SUYASH
What is lattice structure?
s. Reply
of graphene you mean?
Ebrahim
or in general
Ebrahim
in general
s.
Graphene has a hexagonal structure
tahir
On having this app for quite a bit time, Haven't realised there's a chat room in it.
Cied
what is biological synthesis of nanoparticles
Sanket Reply
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get the best Algebra and trigonometry course in your pocket!





Source:  OpenStax, The processing programming environment. OpenStax CNX. Feb 26, 2013 Download for free at http://cnx.org/content/col11492/1.5
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'The processing programming environment' conversation and receive update notifications?

Ask