#WSQ10-College Advice

--Originally published at diegotc2016

I think this WSQ has been the most enriching task. Just a few days before Ken posted the assignment I was thinking about asking some of my teachers about college advice because I’ve noticed that I’m not a very good programmer as I could be. So these tips have helped me to know the way on how to become a better programmer but it all depends on how I implement those tips.

The tips Joel Spolsky gave are:

  1. Learn how to write before graduating.
  2. Learn C before graduating.
  3. Learn microeconomics before graduating.
  4. Don’t blow off non-CS classes just because they’re boring.
  5. Take programming-intensive courses.
  6. Stop worrying about all the jobs going to India.
  7. No matter what you do, get a good summer internship

I think the most important tips first of all is learning C, as he said C is like the god of all programming languages so if after graduating I wanna have a good job I must lear C.

Another great tip is to don’t blow off non-CS classes just because they’re boring. This CS classes I think are the AEV, EVAP, Ethics and those kind of subjects, so I better make my best in this courses because they are the ones that make your final carrer grade better and most of the recruiters check on how your grade is in order to get a job.

Finally another tip that I find important is to take programming-intensive courses. A friend of mine that is studying these degree too told me that also. My friend told me that taking these kind of courses gives you the better job when you’re graduating.

#WSQ10-College Advice

I got this out of:

http://www.joelonsoftware.com/articles/CollegeAdvice.html

 


#WSQ10-College Advice

#WSQ09- The Movies (Still not finished)

--Originally published at diegotc2016

This WSQ was really hard I have to search for a lot of documentation, I look to this assignment in python and I searched for other classmates assignment.

Here is a picture of my entire code so that you can understand it better: ****file is WSQ 09***

#WSQ09- The Movies (Still not finished)#WSQ09- The Movies (Still not finished)#WSQ09- The Movies (Still not finished)#WSQ09- The Movies (Still not finished)#WSQ09- The Movies (Still not finished)

Here’s the picture from the other file: ****this file is named movies****

#WSQ09- The Movies (Still not finished)#WSQ09- The Movies (Still not finished)

Anyway here are the both files in github:

https://github.com/diegoalatorre/TC2016meromero/blob/master/WSQ09%2Cjava

https://github.com/diegoalatorre/TC2016meromero/blob/master/Movies.java

Note: This WSQ was “based” in one of my classmates WSQ

I got this out of:

https://docs.oracle.com/javase/tutorial/essential/io/

I wont go to the movies again – WSQ09

 


#WSQ09- The Movies (Still not finished)

Why do you think your change to object-oriented programming is difficult or what makes it difficult for the standard student?

--Originally published at diegotc2016

First of all I think changing to OOP was difficult because  I’ve learned this way of programming in a new language which is Java and this programming language has more difficult syntax than python has, most of beginners of programming use a simple language like python.

Why do you think your change to object-oriented programming is difficult or what makes it difficult for the standard student?

The next thing I think has made OOP difficult is the proccess in order to code. I was used to code and just code without any paper proccess before coding. For programming in an object oriented way first you have to design the clases and these goes without any coding process, you are even told that you have to do the design process in paper and not just in an electronic tool.

Why do you think your change to object-oriented programming is difficult or what makes it difficult for the standard student?

And the last thing that makes OOP a little bit difficult is the new concepts. This new concepts include class, method, encapsulation, inheritance, polymorphism. The new concepts may be difficult to understand if you have only worked with variables, lists, conditionals and just in a beginner way of programming.

Why do you think your change to object-oriented programming is difficult or what makes it difficult for the standard student?


Why do you think your change to object-oriented programming is difficult or what makes it difficult for the standard student?

What do you feel are the benefits to object-oriented programming?

--Originally published at diegotc2016

According to c4learn.com these are the advantages of OOP:

  • OOP provides a clear modular structure for programs.
  • It is good for defining abstract data types.
  • Implementation details are hidden from other modules and other modules has a clearly defined interface.
  • It is easy to maintain and modify existing code as new objects can be created with small differences to existing ones.
  • objects, methods, instance, message passing, inheritance are some important properties provided by these particular languages
  • encapsulation, polymorphism, abstraction are also counts in these fundamentals of programming language.
  • It implements real life scenario.
  • In OOP, programmer not only defines data types but also deals with operations applied for data structures.
  • Large programs are very difficult to write. Object Oriented Programs force designers to go through an extensive planning phase, which makes for better designs with less flaws

What do you feel are the benefits to object-oriented programming?

I got this out of:

Advantages And Features Of Object Oriented Programming

https://www.cs.drexel.edu/~introcs/Fa15/notes/06.1_OOP/Advantages.html?CurrentSlide=3


What do you feel are the benefits to object-oriented programming?

What do you feel are the benefits to object-oriented programming?

--Originally published at diegotc2016

According to c4learn.com these are the advantages of OOP:

  • OOP provides a clear modular structure for programs.
  • It is good for defining abstract data types.
  • Implementation details are hidden from other modules and other modules has a clearly defined interface.
  • It is easy to maintain and modify existing code as new objects can be created with small differences to existing ones.
  • objects, methods, instance, message passing, inheritance are some important properties provided by these particular languages
  • encapsulation, polymorphism, abstraction are also counts in these fundamentals of programming language.
  • It implements real life scenario.
  • In OOP, programmer not only defines data types but also deals with operations applied for data structures.
  • Large programs are very difficult to write. Object Oriented Programs force designers to go through an extensive planning phase, which makes for better designs with less flaws

What do you feel are the benefits to object-oriented programming?

I got this out of:

Advantages And Features Of Object Oriented Programming

https://www.cs.drexel.edu/~introcs/Fa15/notes/06.1_OOP/Advantages.html?CurrentSlide=3


What do you feel are the benefits to object-oriented programming?

What are overloading and overriding? How do we implement those in Java?

--Originally published at diegotc2016

 

Overloading: two methods are overloaded if  both methods have the same name but different argument types.

For example:

class DisplayOverloading
{
    public void disp(char c)
    {
         System.out.println(c);
    }
    public void disp(char c, int num)  
    {
         System.out.println(c + " "+num);
    }
}
class Sample
{
   public static void main(String args[])
   {
       DisplayOverloading obj = new DisplayOverloading();
       obj.disp('a');
       obj.disp('a',10);
   }
}

The output would be:

a
a 10

Overriding: is when someone declares a method in subclass which is already present in parent class.

For example:

class Human{
   public void eat()
   {
      System.out.println("Human is eating");
   }
}
class Boy extends Human{
   public void eat(){
      System.out.println("Boy is eating");
   }
   public static void main( String args[]) {
      Boy obj = new Boy();
      obj.eat();
   }
}

The output would be:

Boy is eating

What are overloading and overriding? How do we implement those in Java?

I got this information out of:

Method Overloading in Java with examples

Method overriding in java with example

http://javarevisited.blogspot.mx/2011/12/method-overloading-vs-method-overriding.html

What are overloading and overriding? How do we implement those in Java?


What are overloading and overriding? How do we implement those in Java?

What are overloading and overriding? How do we implement those in Java?

--Originally published at diegotc2016

 

Overloading: two methods are overloaded if  both methods have the same name but different argument types.

For example:

class DisplayOverloading
{
    public void disp(char c)
    {
         System.out.println(c);
    }
    public void disp(char c, int num)  
    {
         System.out.println(c + " "+num);
    }
}
class Sample
{
   public static void main(String args[])
   {
       DisplayOverloading obj = new DisplayOverloading();
       obj.disp('a');
       obj.disp('a',10);
   }
}

The output would be:

a
a 10

Overriding: is when someone declares a method in subclass which is already present in parent class.

For example:

class Human{
   public void eat()
   {
      System.out.println("Human is eating");
   }
}
class Boy extends Human{
   public void eat(){
      System.out.println("Boy is eating");
   }
   public static void main( String args[]) {
      Boy obj = new Boy();
      obj.eat();
   }
}

The output would be:

Boy is eating

What are overloading and overriding? How do we implement those in Java?

I got this information out of:

Method Overloading in Java with examples

Method overriding in java with example

http://javarevisited.blogspot.mx/2011/12/method-overloading-vs-method-overriding.html

What are overloading and overriding? How do we implement those in Java?


What are overloading and overriding? How do we implement those in Java?

Delegation

--Originally published at diegotc2016

Delegation is when a class “delegates” another class to do something.

Delegate is to give the power you have to do something to another person in order to do something.

In OOP delegation is when a class gives one or more functionalities to another class in order to do something.

Here’s an example:

Some parents want to go out. They hire a babysitter and tell her to look after the baby.
But what if the baby gets sick?
There’s a note on the fridge door. “In case of emergency phone Helen 555-3141”

This is a pretty good analogy for delegation. Helen is the
delegate.

//within the parent class
babysitter.delegate = helen
[babysitter lookAfter:baby]

//within the babysitter class
if (baby.isSick)
{
[delegate callAbout:baby]
}

When assigning actions to an object, you can provide that object with a delegate. The delegate will be called when the object needs to inform something or do something beyond the scope of the object.

Delegation

Where I got this information from?

http://es.thefreedictionary.com/delegar

https://www.quora.com/What-is-delegation-in-object-oriented-programming

https://es.wikipedia.org/wiki/Delegaci%C3%B3n_(inform%C3%A1tica)

 


Delegation

Creating Classes

--Originally published at diegotc2016

Creating Class Diagrams

We have to use a UML Diagram, which is written like this:

Creating Classes

Creating Classes

The – and + means that if it is private of public method, – is private and + is public.

Converting Class Diagrams into Code

Let’s make a example to demonstrate this:

This is my first time doing this so know that I might be wrong.

FootballPlayer

+position: String

-benchReps: Integer

+power(): String

+morePower(Integer)

Creating Classes

Exploring Object Lifetime

Making an object so that we can use the object is called instantiation. You create an object in Java by doing this:

Creating Classes

Constructor is a special method that exists to construct the object. The constructors are still part of the instantiation of the object. You can make a constructor on Java by making a method in the class with the same name of the class, for example:

Creating Classes

We also have descructor or a finalizer which are used when an object isn’t needed any more.

Using Static or Shared Members

Static in programming means that it never changes and it could be used in back accounts for example:

Creating Classes

The interest rate is the same for every bank account it doesn’t matter if the account is from Alice, Joe or Sam.

This is how static will look in java:

Creating Classes

If you want to access to an attribute of an object you type first the name of the object and then the type of attribute, for example: samAcct.accountNumber.

However if you want to acces to a static object you type first the name of the class and then a dot and then the name of the static object, for example: SavingsAccount.interestRate

You can also create a static method by just adding the word static in it, static method can only work with static variables. Static objects or methods are identified in UML diagrams by underlined words.


Creating Classes

Domain Modeling (Modeling the App)

--Originally published at diegotc2016

What are the things in the application that we need to be aware of?

Identifying the Classes

We will use the scenarios in order to identify the objects, you can highlight the main classes that are written in the use story. For example:

Scenario: The coach gets into the “Sports Statistics and Performance Improvement” either in his laptop or in a mobile phone. Then the coach selects the sport he wants to evaluate, afterwards the coach types the name of the athlete and the computer will ask for the height, weight, % muscle, % fat, gym performance and sport performance of the athlete. The program will automaticlly display a gym routine based on great nutriologists, a gym routine based on excellent trainers and sport tips for the athlete based on outstanding athletes. If the athlete works well he/she will improve for his/her team

Don’t worry if you miss one or more objects, this is just the begining

Identifying Class Relationships

Taking it back to the last post I’ve made, I got this image.

Domain Modeling (Modeling the App)

The relationships are simply the arrows and it says for example, that if wine was consumed they must pay for wine

Identifying Class Responsabilities

You should highlight again the verbs of the classes. I can show you this point by taking again this example:

Scenario: The coach gets into the “Sports Statistics and Performance Improvement” either in his laptop or in a mobile phone. Then the coach selects the sport he wants to evaluate, afterwards the coach types the name of the athlete and the computer will ask for the height, weight, % muscle, % fat, gym performance and sport performance of the athlete. The program will automaticlly display a gym routine based on great nutriologists, a gym routine based on excellent trainers and sport tips for the athlete based on outstanding athletes. If the athlete works well he/she will improve for his/her team

Always remember that a custmer must be responsible by itself and it can also be responible for other objects. There can be a lot of responsabilities for one simple class.

Using CRC Cards

First of all CRC stands for Class Responsability Collaborators, its main objective is to order the classes. Each card is for one class. A CRC card is written as it follows.

Class Name

Responsabilities Collaborators

A CRC card must be written in paper and not in a digital way because by writing it in paper it makes you more concise and you kind of remember better when you write.


Domain Modeling (Modeling the App)