ALL
Reflection in Java
What is Reflection?Reflection is a feature in Java that allows a program to obtain information about itself at runtime and dynamically manipulate the properties, methods, and constructors of classes or objects. With reflection, we can instantiate objects, call methods, and set properties without knowing the exact class name beforehand.The core of the reflection mechanism is the Class object, which represents a class. The Java Virtual Machine (JVM) automatically creates this Class object when it loads a class.How the JVM Creates a Class?When we write a class and compile it, the compiler convert...
1,401 0 METHOD TUTORIAL JAVA REFLECTION FIELD
Three ways to define class in JavaScript
In object oriented programming, class is the template of object, it defines the properties and methods of a group of objects. Unfortunately, JavaScript doesn't support class, but we can have some workarounds to simulate class.1. Constructor functionThis is the classical approach, it is also the approach mentioned in many text books. It uses the constructor function to simulate class and it uses the keyword this to represent the object internally.function Cat() {  this.name = "Kelly";}when creating the instance, use the new keyword.var cat1=new Cat();alert(cat1.name); //KellyThe p...
12,036 0 JAVASCRIPT METHOD CLASS INHERITANCE PRIVATE
How I Became a Programmer
I posted a very brief response to a post on HackerNews yesterday challenging the notion that 8 weeks of guided tutelage on Ruby on Rails is not going to produce someone who you might consider a "junior RoR developer." It did not garner many upvotes so I figured that like most conversation on the Internet it faded into the general ambient chatter. Imagine my surprise when I woke up to couple handfuls' worth of emails from around the world asking me what I did, how I did it, and how I got a job. I'm assuming, judging by the relatively small amount of mail I got from a random ...
9,014 0 PROGRAMMER ADVICE METHOD STUDY
How to hide PHP Notice & Warning Messages
How to hide PHP Notice & Warning Messages. The PHP notice errors are frustrating and you are tired of seeing them when you are working on your scripts. They are showed at the beggining of your pages and may reveal confidential information to the visitor like the path to the file or the php file name in some cases.// Turn off all error reportingerror_reporting(0);// Report simple running errorserror_reporting(E_ERROR | E_WARNING | E_PARSE);// Reporting E_NOTICE can be good too (to report uninitialized// variables or catch variable name misspellings ...)error_reporting(E_ERROR | E_WARNING | ...
How NOT to teach a computer language
For the past year or so my wife has been taking online classes to get a computer science degree. For most of her classes she’s done great, she’s been flying through HTML and SQL, even up to the point where she can handle multilevel joins and optimizing through indexes. That was until she hit her vb.net class. I had no idea why she was having problems with a language has easy as vb.net so I started helping her out and find out why she was having so many problems. I’ve also added some recommendations in case you have the same problems, hopefully these will help you out. (Nam...
That’s Not TDD
A few months ago I was visiting a client who was having a lot of problems using TDD.“It takes over half an hour to run our unit tests,†he said.“You are not doing TDD,†I said. “In order for tests to be valuable all of them must run fast—within a few seconds, or developers will stop running tests frequently.â€â€œBut how to I make them run fast?†he asked, “Just connecting to the database takes 30 secondsâ€So I showed him a technique called Dependency Injections that allowed him to insert a mock object instead of the database. â€...