Posts

Java Packages

Java Packages Learning a Programming language and especially a robust OOP language such as Java is a process--or rather many processes.  This post covers an example of such a process. I knew what namespaces were/are.  I thought of a namespace as a dictionary, or glossary, or maybe a reference codebook.  I still think that works for me, but I found this definition in one of the links below: A namespace is a group of related elements that each have a unique name or identifier. Just as computer operating systems, domain names, and so many other structures need namespaces, so does Java. I learned how to use packages I just told my IDE (yes, more on command line preferences in other posts) to make a package, then when my classes and interfaces were inside that package they had access to each other. I knew that Java comes with its own packages which provide ways to extend visibility among various classes/java files The package keyword, if it appears, must be ...

Java: Reference vs. Object

Image
Declaring and initializing reference variables When learning Java we see reference variables declared and initialized like this: Case A:  ABC varName = new ABC(); Later in our learning, we see something like this: Case B:  ABC varName = new DEF(); Let's take this as an example for discussion: Dthing varName = new Othing(); What is Dthing and what is Othing? From the first chapters of introduction to Java we know that Dthing is the type, and Othing is a constructor, and so is the class of varName. More advanced instruction shows: Dthing is the Declared Type, or Reference Type (I have found them used interchangeably) Othing is the Object Type This vocabulary is needed for reasons including discussion about when to declare/instantiate with the Declared Type being the same as the Object type, and when they should be different. An example of that decision would be in the below. The why is another subject/post: List<String> varStrin...

Java classpath: showing Java where the classes are

Java ClassPath...its purpose Some of my posts are "what I have learned", others are more "what I am learning".  I prefer the former, bu this one is more the latter. The subject of classpath has been hard for me to internalize...more below on why (IDEs). When I installed my JDK I needed to alter my environmental variables on my computers so I could run java from the command line.  I had to add the location of my JDK to the path.  Installation instructions include this point: Include JDK's " bin " Directory in the  PATH They then show how to access the path and variables on Windows 10 and other platforms. So, of course I already did that. with C:\Program Files\Java\jdk1.8.0_231\bin But then I kept seeing Java documents, textbooks, tutorials saying I must add JARs or packages, or such to the classpath.  I wondered why my projects were working without doing any of that. I wondered about classpath because I had already done the abo...

Spring Boot, parsing the pom.xml

Image
Spring Boot can be easy to start up:options Diving right in letting Spring Boot introductions be covered in another blog.... One way is to navigate to:  https://start.spring.io and find a page like the below: Just select the options then click Generate (not shown).  This will download a zip file which can then be imported easily into your IDE.  I use STS eclipse, after import, the result was: Because I selected Maven, there is a pom.xml file which is instructive.  It includes the necessary dependencies.  I could have specified them on the web page, but I usually just paste them in. Below is the pom.xml file contents from the demo: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelV...

Coding Philosophy

Coding Philosophy/Goals/Mindset: Achieve business and technical requirements Agility means these may change as the environment changes, or coding realities drive changes upstream We must adapt to these changes Consider those (including yourself) who will be reading/modifying the code : Extensibility How easily can new features be added? Readability Includes formatting, proper ID naming, and good quality comments--not too many Maintainability How easy will it be to make changes to this code? Scalability What about growth?  For example, another server, or database may be required Efficiency Especially for larger projects, it is important to minimize resource consumption Project velocity While subordinate to the above and within the bounds of efficiency completing quickly/on-time matters There are many techniques and guidelines for achieving the above such as avoiding magic numbers (use constants) and keeping methods short and single purpose. ...

Simple reference to URL pattern in RESTful methodology

Guidelines for RESTful URLs Finding restful rules between REST clients and servers was more time consuming than other searches.  It must have been a block for others, too as I saw the question posted on various groups.  So I thought maybe it made sense to post my results here. Books as an example seems common, so I use books in my sample below. References: My instructor This reference.  While under a Ruby site, it applies to other languages: https://guides.rubyonrails.org/routing.html#crud-verbs-and-actions   This reference was very useful, but it only goes what I call "one deep"  that means in their example of "photos" we can act on photos/collection of photos.  However, it does not teach us how to add other "things" to photos.  For example, if the application is about users having photos, then we would add photos to a user. Or, if about the various users who have a certain photo, then we would be adding photos to that user A Tutoria...

Software....the first post

Software developer, constructor, coder, writer, builder, engineer, architect, or something else... Here I plan to make notes as to my software experiences and maybe some observations. So what best describes those that "do software"?  I think all of these are appropriate. I like Steve McConnell's discussions in which he favors builder, or maybe engineer. He points out that writer sounds like something like a novelist telling a story.  It is true we write and we code but we are assembling something that does something.  I think I like engineer the best, but all of these describe. I think his observation says much about the profession: Computer science has some of the most colorful language of any field. In what other field can you walk into a sterile room, carefully controlled at 68°F, and find viruses, Trojan horses, worms, bugs, bombs, crashes, flames, twisted sex changers, and fatal errors? ---- Code Complete , Steve McConnell;  978-0-7356-1967-8 ...