Using CSS

Using CSS

CSS is the language commonly used with HTML to add more stylistic elements to a webpage, like navigation menus, borders, and margins. It can also change things like the color but that can also be done with HTML.

CSS is formatted so that in between the starting and ending heading tags in a HTML document, add the style tags(<style> </style>) and in that style tag put the inside of the tag you want to add CSS to so if you want to add CSS to <h2> tag  you just put h2 then braces followed by what you want to edit like border, then the specifics like the size , color and type of border.

A clearer example of CSS is shown in the picture below:


Methods

Methods

Methods are segments of the code that are called on to do certain tasks.Those tasks can be things like putting together a text representation of an object,  doing various computations or adding and removing things from lists. So, the majority of your code is going to be a made of methods. Some methods may be made for you in library classes like the Math.sqrt(int i) which returns the square root of a number.

A method is declared with:

public(private) (static) datatype methodName(<parameters>)

When a method is private it means similiar to when a field is private that it can only be used in it’s own class. Also unless the datatype is void a method has to return a value of that datatype this is done with:

return valueofDatatype;

Overloaded methods are when a method shares a name with one or more methods in that class but has different parameters, in this case the compiler determines which method you are talking about by using the parameters, so if you have a method g(int i) and method g(String i) its going to call the former if you put a int in as the parameter and to call the later the parameter needs to a string.

The link to the video focusing on methods, although i ran out of time near the end.

Parameters

Parameters

They are similar to instance variables in that they only work in a certain part of the code, but because they are essentially declared in the heading/declaration of a method or constructor they always apply to the whole method or constructor. Parameters are the values that the piece of the code that called the method sends for the method to use. For example say there was a method that gave you the value of a number ( say i ) to the i-th power. They would need to know the value of the number you want to have go through the program, so they have you send them that value when you call the method. It wouldn’t make sense to make a different method for every number, which would also be fairly impossible to do in a timely manner.

A parameter is as said before declared in the heading of a method or constructor.

An example of how to declare it is shown below:

Public (static) datatype methodName(datatype parameterName1, datatype parameterName2)

The actual parameter declaration is in italics, the rest is the method heading.

Instance Variables

Instance Variables

They are the local variables, so they only work within the pair of braces that they are declared in including any braces that are inside of that pair of braces where they were declared. This means that if you put it into the body of a method it can only be used in that method and if you declared it inside a for statement or if statement that it can only be used without error within those statements. If when you run a program it says that a variable is out of it’s scope then that means you used the variable in a place outside the braces that it was declared in.

A instance variable can be of any datatype except I assume void since void doesn’t really hold any values. It is also initialized when it is declared meaning that it is assigned a value according to its datatype in its declaration, and this value can be a equation or expression so long as the value/answer of said expression or equation is of the variables datatype . Also when you name a instance variable you have to make sure it isn’t the same name as a field because then it can cause errors or bugs since you won’t be able to use that field inside of that variable scope since to the compiler a local variable takes precedence to a field

A instance variable is declared by:

Datatype variableName = value of datatype;

A instance variable is used in a program simply by using the variableName.

Fields

Fields

They are essentially the global variables of a class meaning that they can be used in all constructors and methods in the class, and other classes if the field is public. If it is private then a accessor method needs to be used in order to get the value of the field. Normally a field will be different depending on the object that you call, this is because a objects constructor often changes the value of the field, since those fields are specific to the object , for example say you made two Square objects. The length width and side for those two rectangles/squares will probably be different, so it doesn’t make sense for the length and , width variables to carry over from one object to the next.

A regular public field is called by doing:

objectName.fieldName

The only time that a field stays the same no matter the object is when the field is static. This is because the reserved word static makes it so the field applies to all objects at the same time.You would use static if you were trying to get something like a total or a statistic of all of the objects of the class.

A public static field is called by doing:

className.fieldName

A Field is declared in the body of a class outside of constructors or methods and is generally at the very top right under the brace after the class declaration.

The format for a field declaration is:


public(or private)  (static) data type field Name (= value of datatype) ;

Variables

Variables

Variables are memory locations that hold a value. So when you are using a variable you are accessing that memory location to get the value. Three different types of variables, Fields, which is the global variable which can be used in all of your methods and constructors. Instance Variable which is the local variable and can only be used where it is made(so it can only be used within the braces it is declared ) and a parameter which is a variable that is passed by value to a method or constructor.

For more information on each type go to:

Fields

Parameters

Instance Variables

HTML stylization

HTML stylization

A lot of the stylization of a website in HTML come from another language like CSS, but there are some things you can do with HTML to stylize your website. The first thing you can do is editation of font sizes either by using diffrent heading sizes(<h1>,<h2>,<h3>, etc).

You can also do things like bold<b>, italize<i>, and underline<u>

Make lists Ordered<ol> and Unordered<ul> which need the <li> tag inside for each list iteam.

Add a image<img scr = “url” alt = ” description of picture in case it doesnt show up”> or a link to a external link<a href=”url“> text that link is attached to </a>.

You can also add things like line breaks<br>(which doesn’t need to use a ending tag since it is empty)

Or changing the color,kind, size,ect of font, by putting style=”color:red””font-family: …” “backround-color : . . .” “font-size: ..%”.

Along with things like tables, which I will get into how to make on a later

Below is an example with some of the stylistic elements.

Object oriented programming

Object oriented programming

 Also known as OOP, is a method of programming that is event-driven so instead of just going from the beginning of the code to end like  in procedural programming it goes in order in the main method until it reaches a call to another method or the creation of an object through a constructor. Java is a good example of OOP programming.

   In other words oop programming is like  a virtual world of objects and each object has its own memory and a set of methods(things it can do like send messages , process messages, change its memory or create new objects).  Each object in this world is a part of a class , which determines what the object does, what methods it has and how it’s memory is structured.

 The other important thing about oop programming other than event-driven programming is inheritance, which is where a class extends another class. So, say you made a general balloon object and then later you made a oval balloon and a square balloon, it would be a waste to duplicate the general balloons methods, instead you have oval balloon and a square balloon extend the balloon class, making them a subclass of the general balloon class meaning that they have access to all of general balloons methods. The general balloon class may be called a superclass if another class extends them.

Constructors Basic

Constructors Basic

   They are instructions for  making objects. So, if you make a new object the program at that point stops and goes to the the constructor, which runs until the constructor is finished and then returns  to the point right after where the object was made. A constructor makes a object by taking the parameters it is given and setting the fields equal to those parameters. A constructor always has the same name as it’s class by the way.

In java they give you a constructor known as a no-args constructor which takes no parameters and doesn’t set any fields to anything, in other words it does nothing, but make a object. It disappears if you make a constructor of your own though.

The format for creating a object is:

    ClassName ObjectName = new ClassName(<parameter>);

A constructor is formatted in:

public( private) ClassName(<parameters>)

{

   Field =parameter;

}

So a good example would be say we had a class called Square which makes a Square, the constructor would be something like:

Public class Square     // declaring class

{

 public int side;           // field representing side length

 public Square(int s)  //declaring constructor

 {

     side=s;               //setting field equal to parameter

 }
}                              //ending class

You would create a new object of this class like shown below:

Square mySquare = new Square(4);

Which would make a square with a side length of 4.

A link to a video I made explaining the topic is shown below:https://youtu.be/-Gv19VP1kIg

Front-end Development vs. Back-end Development

Front-end Development vs. Back-end Development

Front-end development is essentially what the client sees so its the browser and stuff like the menus, drop downs and other things that makes a website pretty to the user.So normally a front-end developer will be creating and redesigning websites, specifically ones that don’t interact with information stored on a database The common front-end languages are HTML, CSS, and javascript.

Back-end development is more about how the application functions. Specifically things to do with communication between the application and a database. So, they work on the stuff you can’t see in a application like the computations, or the retrieval of information from a database. Normally a back-end developer will know CSS and HTML, but in order to do the programming that comes under back-end development umbrella they need to know languages like Java , Python, and PHP.

There is one other category known as full-stack development which is basically just both front-end and back-end combined. So, they know both sides, generally they prefer one or the other, but being full-stack gives greater flexibility when finding jobs since, you could get a job that falls under either field.