Jump to content

Eyad Syria-lover

  • Posts

  • Joined

  • Last visited

Previous Fields

  • Languages
    JavaScript, PHP, Node.js

Contact Methods

  • Website URL

Profile Information

  • Gender
  • Location

Eyad Syria-lover's Achievements


Newbie (1/7)



  1. This means that you expose only the functionality without any knowledge of how the actual implementation works. To demonstrate this, let's have an Animal class which is an abstract class: abstract class Animal { public abstract void makeSound(); public void sleep() { System.out.println("Zzz"); } } As you see, the Animal class contains one abstract method, the implementation of this method will soon be provided by the subclasses Let's have a Bird class: class Bird extends Animal { @Override public void makeSound() { System.out.println("Coo"); } } Let's also have a Cat class: class Cat extends Animal { @Override public void makeSound() { System.out.println("Meow"); } } Now you can instantiate a subclass of Animal and call the makeSound() method without caring the actual implementation of the method in each subclass: public class App { public static void main(String[] args) throws Exception { Animal animal; animal = new Bird(); animal.makeSound(); // Coo animal = new Cat(); animal.makeSound(); // Meow } } Do you notice how you call makeSound() without actually caring what kind of animal you have ?, that's what's meant by hiding certain details and showing only essential information to the user Unfortunately, in w3schools they don't clarify it enough, this is usually explained even better using a Factory Class. The idea behind factory class method is to hide the details of object instantiation by creating a mediate class that creates objects for you Let's have a AnimalFactory class: class AnimalFactory { public static Animal getAnimal(String animal) { if (animal == null) { return null; } else if (animal.equalsIgnoreCase("cat")) { return new Cat(); } else if (animal.equalsIgnoreCase("bird")) { return new Bird(); } return null; } } Modify the main program: public class App { public static void main(String[] args) throws Exception { Animal animal; animal = AnimalFactory.getAnimal("bird"); animal.makeSound(); // Coo animal = AnimalFactory.getAnimal("cat"); animal.makeSound(); // Meow } } Do you notice the abstraction ?, you don't instantiate manually, the instantiation process is hidden from you. I would like to say one last sentence: It's always preferable to program to an interface (or maybe an abstract class) rather than an implementation, this means to always create a variable which has a type of the abstract class and assign it an instance of a subclass, just like in the examples above
  2. Since you've added the new Python tutorial , are you planning to add a tutorial for Django framework?
  3. Maybe You Can Add This Tutorial And Teach People How To Setup Babel In Order To Compile Down From ES6 To ES5?,Because W3schools Always Does A Great Tutorials,Better Than Any Another Web Development Tutorials Site...
  4. I Think It Would Be An Excellent Decision If You Add A Tutorial About The Sixth Version Of JavaScript To W3schools...
  5. I Can't Open This Page Here: http://www.w3schools.com/jquery/event_proxy.asp I'am Getting An HTTP Error 400...
  6. How To Create A Quiz With Radio Buttons And Checkboxes? (Just Like Those Quizzes At W3schools.com)
  7. I Want To Create A Function With An Options List Inside It's Parameters,I'am Talking About Something Similar To: counter({ min:0, max:200, mode:"increment" });
  8. Hello. Let's Say That I Have Two Sites,The First One Is http://site1.com , And The Second One Is: http://site2.com , The First Site index's File Got A <div> Element With id="one" , And The Second Site index's File Got A <div> Element With id="two" ,The Question Is: How Can I Load div#one Contents Inside div#two ? I Don't Want To Use Frames. I've Read About jQuery load() Method On W3schools , But It Doesn't Seems To Give An Example About My Case. Sorry For The Prolongation.
  9. Hello. I Was Reading A Stylesheet When I Found A Strange @import Rule,I've Never Faced This Rule. What Is The Difference Between Including A Stylesheet Using @import Rule,And Doing The Same Using <link rel="stylesheet"/>?,And Do You Suggest Me To Use This Rule?.
  10. Hello Mr.Shohan . The Problem Is That JavaScript Is A Client-Side Scripting Language,And Can't Does Actions On The Server (ex. Create A File). You Seems A Little Confused About Server-Side Scripting Languages,But The Bad News Is You Still Need To Learn A Server-Side Language In Order To Control Databases And Create Files On The Server (Or Whatever You Want). My Suggestion To You Is To Learn PHP,Because PHP Is Easy To Learn And Powerful Server-Side Language.
  11. So So I'am Thinking Of A Way To Detect CSS3 Browser Support Using Client-Side Scripting (JavaScript),I Know There's A Library Out There To Handle Such Situations,But I Need A Code Or A Hint To Do This Without Any External Libraries. Any Suggestions Would Be Appreciated...
  12. Okay Sir I'am Sorry If I Made It Look Like An Advertisment,And Honestly I Don't Know Icofont's Developer.
  • Create New...