Inner Class Optimization for Reduced Memory Footprint

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Object-oriented programming languages, such as JAVA, face performance overhead and memory issues due to the presence of inner classes, particularly in resource-constrained devices like cell phones, where every space and performance enhancement is crucial.

Innovation Solution

A method is introduced to transform compiled computer programs by moving methods and functions of inner classes into outer classes, reducing the number of inner classes, which can include removing or in-lining them, while ensuring the program's behavior remains unchanged.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Adaptability or versatility

If inner classes are used in object-oriented programming, then code modularity and functionality are improved, but memory footprint and processing overhead increase

Engineering Contradiction:
Improvecode modularityVSAvoidmemory footprint
Core Design Contradiction:
Adaptability or versatilityVSQuantity of substance

Solution Approach 1:

The patent merges inner classes with their outer classes by moving inner class definitions into the outer class namespace. This consolidation eliminates the need for separate inner class structures while preserving the functional relationships, thereby reducing memory footprint while maintaining code modularity through the outer class's organizational structure.

Inventive Principle:
Principle #5Merging (Combining)

Solution Approach 2:

The patent extracts the problematic inner class structure from the codebase and replaces it with alternative implementations using outer classes and interface-based designs. This extraction removes the memory overhead associated with inner classes while preserving the necessary functionality through different architectural patterns.

Inventive Principle:
Principle #2Taking out (Extraction)

2Adaptability or versatility

If inner classes are used in object-oriented programming, then code organization and functionality are improved, but application startup time increases

Engineering Contradiction:
Improvecode organizationVSAvoidapplication startup time
Core Design Contradiction:
Adaptability or versatilityVSLoss of time

Solution Approach 1:

By merging inner classes into outer classes, the patent reduces the total number of class definitions that the Java Virtual Machine must process during startup. This consolidation maintains code organization within the outer class structure while significantly reducing application startup time by eliminating redundant class loading operations.

Inventive Principle:
Principle #5Merging (Combining)

Solution Approach 2:

The patent performs preliminary refactoring of the code structure before compilation, moving inner class definitions to outer classes. This preliminary action ensures that the optimized structure is already in place before runtime, preventing startup time delays caused by inner class processing.

Inventive Principle:
Principle #10Preliminary action

3Adaptability or versatility

If inner classes are used in object-oriented programming, then functional capabilities are improved, but processing overhead increases

Engineering Contradiction:
Improvefunctional capabilitiesVSAvoidprocessing speed
Core Design Contradiction:
Adaptability or versatilityVSProductivity

Solution Approach 1:

The patent combines inner class functionality with outer class structures, eliminating the additional processing overhead associated with inner class instantiation and method resolution. This merging preserves all functional capabilities while improving processing speed by reducing the computational complexity of navigating inner class hierarchies.

Inventive Principle:
Principle #5Merging (Combining)

Solution Approach 2:

Instead of using inner classes to achieve certain functional patterns, the patent inverts the approach by using outer classes with explicit field and method definitions to accomplish the same functionality. This inversion eliminates the processing overhead of inner class mechanisms while maintaining functional capabilities.

Inventive Principle:
Principle #13The other way round (Inversion)

4Adaptability or versatility

If inner classes are used in object-oriented programming, then code flexibility is improved, but search time in JAR files increases

Engineering Contradiction:
Improvecode flexibilityVSAvoidJAR file search time
Core Design Contradiction:
Adaptability or versatilityVSLoss of time

Solution Approach 1:

By merging inner classes into outer classes, the patent reduces the total number of class entries in JAR files. This consolidation maintains code flexibility through the outer class's organizational structure while significantly reducing the time required to search and locate classes within JAR files during runtime and deployment.

Inventive Principle:
Principle #5Merging (Combining)

Data Source

PatentUS8166468B2Refractor inner class with object-oriented program optimizer tool for reduced footprint and faster application start
Publication Date: 2012.04.24 INTERNATIONAL BUSINESS MACHINE CORPORATION
  • US8166468B2 patent drawing
  • US8166468B2 patent drawing
  • US8166468B2 patent drawing

AI summary

A computer implemented method, computer program product, and data processing system for reducing the number of inner classes in a compiled computer program written in an object-oriented programming language. An outer class of the compiled computer program is received, wherein the outer class contains an inner class, wherein the outer class comprises instructions to create an instance of an inner class. The instance is to be used as one of a callback, a listener command, a set of instructions by which an object instance of the inner class transfers information to the corresponding containing instance of the outer class, and combinations thereof. A transformation of the outer class is performed by moving methods of the inner class, as well as their contained instructions, into the outer class. The behavior of the compiled computer program remains unchanged.