Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
Nuclear Physics comes to our web site

One of the major projects that we'll be undertaking in the near future is aimed at improving the findability of information on our site - you shouldn't need to know that you need a blog article dated 2nd Feb 2007 to find about the difference between a comparator and comparable in Java, nor to look up on page /resources/Q907.html to find out about object oriented design - there should be an easier way.

And what better way than to actually use an Object Oriented approach where each of the "Pieces of Content" on the web site can be accessed through the same API (Application Programmer Interface)? Then - whether it's on The Horse's Mouth Blog, in the longer articles of the solution centre, part of a course description or somewhere in the Forum you should be able to find it by keyword or description, and further more have a ranked list of other pieces of content ("poc"s) that may also be relevant offered to you, irrespective of the particular subclass that they belong to.

On yesterday's Perl for larger Projects course, which covers Object Orientation in Perl as one of its key subjects, I took my "poc" project as an example and came up with something of a concept test / spike solution for the first algorithms that we may use. Starting with a series of function calls, we moved on to an object oriented example, showing off most of the features of Perl's OO model - all the "usual OO stuff", plus autoloaders, exporters and the rest. I've added the full series of examples written on to our web site ... so you can look at the source of each stage if you wish; it made an excellent teaching tool:

1. Use of a package
2. Encapsulate code, and add strict checking
3. Adding OO notations
4. AUTOLOAD
5. A list of objects
6. Setters and Getters
7. Inherited classes, and an Exporter
8. and 9. The final demo - the test program to go with ... the Perl module and the two classes

So where does the nuclear physics come in? Well - I've chosen to define an initial ranking for each piece of content, and a "halflife" - the number of days in which it decays to having just a half of its initial significance, as per the decay of a radioactive isotope. Here's the algorithm if you're interesed:
  sub getrank {
  my ($current) = @_;
  my $now = time();
  my $age_in_days = ($now - $current->{otime}) / 3600 / 24;
  my $decaysteps = $age_in_days / $current->{halflife};
  $decaysteps < 0 and $decaysteps = 0; # future content!
  my $decayfactor = 0.5 ** $decaysteps;
  my $rank = sprintf("%.2f",$current->{orank} * $decayfactor);
  return $rank; }

but of course that's going to be encapsulated within the class and "Joe Public" visiting our site - our even our content providers - will be gloriously unaware of the mathematics!


No - the general visitor will be much more interested in the titles and ranking of the pages, as illustrated by running our test program:

Dorothy:plpw grahamellis$ perl poctest
The Vet who liked horse meat
rank is 15.00 down from 15
Copyright, Well House Consultants
 
MySQL left join - howto
rank is 73.82 down from 95
Copyright, Well House Consultants
 
Contacts at Well House Consultants
rank is 95.00 down from 95
Copyright, Well House Consultants
 
Perl for Deep Sea Divers
rank is 50.00 down from 50
Copyright, Well House Consultants
 
95.00 - Contacts at Well House Consultants
73.82 - MySQL left join - howto
50.00 - Perl for Deep Sea Divers
15.00 - The Vet who liked horse meat
Attributes supported - comment halflife orank otime author title
Dorothy:plpw grahamellis$

(written 2008-12-17)

 
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
P218 - Perl - More Objects
  [4366] Changing what operators do on objects - a comparison across different programming languages - (2014-12-26)
  [4356] Object factories in C++, Python, PHP and Perl - (2014-12-19)
  [4098] Using object orientation for non-physical objects - (2013-05-22)
  [4096] Perl design patterns example - (2013-05-20)
  [3941] Building an object based on another object in Perl - (2012-12-03)
  [3581] Perl - calls to methods that use => - what do they mean? - (2012-01-16)
  [3377] What do I mean when I add things in Perl? - (2011-08-02)
  [3098] Learning Object Orientation in Perl through bananas and perhaps Moose - (2010-12-21)
  [3097] Making Perl class definitions more conventional and shorter - (2010-12-20)
  [2972] Some more advanced Perl examples from a recent course - (2010-09-27)
  [2876] Different perl examples - some corners I rarely explore - (2010-07-18)
  [2811] Igloos melt in the summer, but houses do not - (2010-06-15)
  [2717] The Multiple Inheritance Conundrum, interfaces and mixins - (2010-04-11)
  [2651] Calculation within objects - early, last minute, or cached? - (2010-02-26)
  [2427] Operator overloading - redefining addition and other Perl tricks - (2009-09-27)
  [1819] Calling base class constructors - (2008-10-03)
  [1665] Factory method example - Perl - (2008-06-04)
  [1664] Example of OO in Perl - (2008-06-03)
  [1435] Object Oriented Programming in Perl - Course - (2007-11-18)
  [1320] Perl for Larger Projects - Object Oriented Perl - (2007-08-25)
  [1217] What are factory and singleton classes? - (2007-06-04)
  [930] -> , >= and => in Perl - (2006-11-18)
  [831] Comparison of Object Oriented Philosophy - Python, Java, C++, Perl - (2006-08-13)
  [656] Think about your design even if you don't use full UML - (2006-03-24)
  [592] NOT Gone phishing - (2006-02-05)
  [588] Changing @INC - where Perl loads its modules - (2006-02-02)
  [531] Packages in packages in Perl - (2005-12-16)
  [246] When to bless a Perl variable - (2005-03-15)
  [227] Bellringing and Programming and Objects and Perl - (2005-02-25)

Q110 - Object Orientation and General technical topics - Programming Algorithms
  [4707] Some gems from an introduction to Python - (2016-10-29)
  [4656] Identifying the first and last records in a sequence - (2016-02-26)
  [4652] Testing new algorithms in PHP - (2016-02-20)
  [4410] A good example of recursion - a real use in Python - (2015-02-01)
  [4402] Finding sum, minimum, maximum and average in Python (and Ruby) - (2015-01-19)
  [4401] Selecting RECENT and POPULAR news and trends for your web site users - (2015-01-19)
  [4325] Learning to program - what are algorithms and design patterns? - (2014-11-22)
  [3662] Finding all the unique lines in a file, using Python or Perl - (2012-03-20)
  [3620] Finding the total, average, minimum and maximum in a program - (2012-02-22)
  [3451] Why would you want to use a Perl hash? - (2011-09-20)
  [3102] AND and OR operators - what is the difference between logical and bitwise varieties? - (2010-12-24)
  [3093] How many toilet rolls - hotel inventory and useage - (2010-12-18)
  [3072] Finding elements common to many lists / arrays - (2010-11-26)
  [3042] Least Common Ancestor - what is it, and a Least Common Ancestor algorithm implemented in Perl - (2010-11-11)
  [2993] Arrays v Lists - what is the difference, why use one or the other - (2010-10-10)
  [2951] Lots of way of converting 3 letter month abbreviations to numbers - (2010-09-10)
  [2894] Sorting people by their names - (2010-07-29)
  [2617] Comparing floating point numbers - a word of caution and a solution - (2010-02-01)
  [2586] And and Or illustrated by locks - (2010-01-17)
  [2509] A life lesson from the accuracy of numbers in Excel and Lua - (2009-11-21)
  [2259] Grouping rows for a summary report - MySQL and PHP - (2009-06-27)
  [2189] Matching disparate referencing systems (MediaWiki, PHP, also Tcl) - (2009-05-19)
  [1840] Validating Credit Card Numbers - (2008-10-14)
  [1391] Ordnance Survey Grid Reference to Latitude / Longitude - (2007-10-14)
  [1187] Updating a page strictly every minute (PHP, Perl) - (2007-05-14)
  [1157] Speed Networking - a great evening and how we arranged it - (2007-04-21)
  [642] How similar are two words - (2006-03-11)
  [202] Searching for numbers - (2005-02-04)


Back to
Blame Culture
Previous and next
or
Horse's mouth home
Forward to
Copyright of Training Notes and Web Site
Some other Articles
End of Training, 2008
Small Print
Whisky - Setting and reading cookies from Perl
Copyright of Training Notes and Web Site
Nuclear Physics comes to our web site
Blame Culture
Perl substitute - the e modifier
Variable Types in Perl
Summary - Apache httpd build on Linux
Forwarding session and cookie requests from httpd to Tomcat
4724 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95 at 50 posts per page


This is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price.

Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2017: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/mouth/1949_Nuc ... -site.html • PAGE BUILT: Sat Jun 11 12:16:26 2016 • BUILD SYSTEM: WomanWithCat