Software Engineering from Scratch by Jason Lee Hodges
Author:Jason Lee Hodges
Language: eng
Format: epub, pdf
ISBN: 9781484252062
Publisher: Apress
Terminal Output
> scalac messenger.scala messages.scala
> scala examples.messenger
Hello World!
Listing 9-2Examples of referencing and compiling multiple files from the same package
You might notice that the extension for the files in this example is no longer a .sc extension but rather a .scala extension. Since these files are not going to be interpreted but rather always compiled, it is better to use the .scala file extension, which is equivalent to the Java .java extension and is meant for objects and classes, rather than the Scala script extension.
The two files in this example both start with a declaration that they belong to the package “examples.” This gives them access to each other’s members implicitly. Thus, when the messenger file wants to access a member of the messages object, it can do so as if the code were written in the same file. You’ll notice that only the messenger object uses the extends App keywords as that is the entry point for our now multi-file program. We haven’t declared anything to happen in the messages file, so its purpose is simply to exist as a reference for our main program, messenger, to make a call to one of its members. Once both files have been written, they are compiled at the same time using the command scalac messenger.scala messages.scala which creates a package directory that contains the compiled class files for both files. If you make a change to one of these files and not the other and need to re-compile, you only need to include the name of the changed file after your scalac command. To execute our program, we simply call the main entry point file from its package directory using the same dot notation that you would use to access the member of a class or object. The command scala examples.messenger looks in the package examples for the messenger object and executes it. This prints out the message “Hello World!” which is a string member that exists in the messages object.
Download
Software Engineering from Scratch by Jason Lee Hodges.pdf
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Coding Theory | Localization |
Logic | Object-Oriented Design |
Performance Optimization | Quality Control |
Reengineering | Robohelp |
Software Development | Software Reuse |
Structured Design | Testing |
Tools | UML |
Deep Learning with Python by François Chollet(12579)
Hello! Python by Anthony Briggs(9917)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9796)
The Mikado Method by Ola Ellnestam Daniel Brolund(9780)
Dependency Injection in .NET by Mark Seemann(9340)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8303)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7763)
Grails in Action by Glen Smith Peter Ledbrook(7698)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7557)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(7100)
Microservices with Go by Alexander Shuiskov(6869)
Practical Design Patterns for Java Developers by Miroslav Wengner(6783)
Test Automation Engineering Handbook by Manikandan Sambamurthy(6725)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6419)
Angular Projects - Third Edition by Aristeidis Bampakos(6139)
The Art of Crafting User Stories by The Art of Crafting User Stories(5660)
NetSuite for Consultants - Second Edition by Peter Ries(5593)
Demystifying Cryptography with OpenSSL 3.0 by Alexei Khlebnikov(5404)
Kotlin in Action by Dmitry Jemerov(5067)
